diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-04 08:45:54 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-04 08:45:54 (GMT) |
commit | e22581675866cbf88e948eae2e83eb13a43a2d44 (patch) | |
tree | 782b173b702a48fca5f68d9622cad67d65d01d88 | |
parent | 950cd9b3c1ae6a1b462d596a62aea92f9c231afb (diff) | |
parent | db997a02c1d306260d8bbfe4f13e8312efb6fa7c (diff) | |
download | Qt-e22581675866cbf88e948eae2e83eb13a43a2d44.zip Qt-e22581675866cbf88e948eae2e83eb13a43a2d44.tar.gz Qt-e22581675866cbf88e948eae2e83eb13a43a2d44.tar.bz2 |
Merge commit 'origin/4.6' into 4.6
790 files changed, 21695 insertions, 9500 deletions
@@ -31,6 +31,7 @@ my %modules = ( # path to module name map "QtSql" => "$basedir/src/sql", "QtNetwork" => "$basedir/src/network", "QtSvg" => "$basedir/src/svg", + "QtDeclarative" => "$basedir/src/declarative", "QtScript" => "$basedir/src/script", "QtScriptTools" => "$basedir/src/scripttools", "Qt3Support" => "$basedir/src/qt3support", @@ -682,6 +683,7 @@ foreach (@modules_to_sync) { $master_contents .= "#include <QtGui/QtGui>\n" if("$_" eq "gui"); $master_contents .= "#include <QtNetwork/QtNetwork>\n" if("$_" eq "network"); $master_contents .= "#include <QtSvg/QtSvg>\n" if("$_" eq "svg"); + $master_contents .= "#include <QtDeclarative/QtDeclarative>\n" if("$_" eq "declarative"); $master_contents .= "#include <QtScript/QtScript>\n" if("$_" eq "script"); $master_contents .= "#include <QtScriptTools/QtScriptTools>\n" if("$_" eq "scripttools"); $master_contents .= "#include <Qt3Support/Qt3Support>\n" if("$_" eq "qt3support"); diff --git a/config.tests/unix/opengles1/opengles1.pro b/config.tests/unix/opengles1/opengles1.pro index ad8dd31..1469aa9 100644 --- a/config.tests/unix/opengles1/opengles1.pro +++ b/config.tests/unix/opengles1/opengles1.pro @@ -1,9 +1,9 @@ SOURCES = opengles1.cpp -INCLUDEPATH += $$QMAKE_INCDIR_OPENGL +INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES1 -for(p, QMAKE_LIBDIR_OPENGL) { +for(p, QMAKE_LIBDIR_OPENGL_ES1) { exists($$p):LIBS += -L$$p } CONFIG -= qt -LIBS += $$QMAKE_LIBS_OPENGL_QT +LIBS += $$QMAKE_LIBS_OPENGL_ES1 diff --git a/config.tests/unix/opengles1cl/opengles1cl.pro b/config.tests/unix/opengles1cl/opengles1cl.pro index 415cdbb..c4c069e 100644 --- a/config.tests/unix/opengles1cl/opengles1cl.pro +++ b/config.tests/unix/opengles1cl/opengles1cl.pro @@ -1,9 +1,9 @@ SOURCES = opengles1cl.cpp -INCLUDEPATH += $$QMAKE_INCDIR_OPENGL +INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES1CL -for(p, QMAKE_LIBDIR_OPENGL) { +for(p, QMAKE_LIBDIR_OPENGL_ES1CL) { exists($$p):LIBS += -L$$p } CONFIG -= qt -LIBS += $$QMAKE_LIBS_OPENGL_QT +LIBS += $$QMAKE_LIBS_OPENGL_ES1CL diff --git a/config.tests/unix/opengles2/opengles2.pro b/config.tests/unix/opengles2/opengles2.pro index 0dfae42..c383fd0 100644 --- a/config.tests/unix/opengles2/opengles2.pro +++ b/config.tests/unix/opengles2/opengles2.pro @@ -1,9 +1,9 @@ SOURCES = opengles2.cpp -INCLUDEPATH += $$QMAKE_INCDIR_OPENGL +INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 -for(p, QMAKE_LIBDIR_OPENGL) { +for(p, QMAKE_LIBDIR_OPENGL_ES2) { exists($$p):LIBS += -L$$p } CONFIG -= qt -LIBS += $$QMAKE_LIBS_OPENGL_QT +LIBS += $$QMAKE_LIBS_OPENGL_ES2 @@ -673,6 +673,7 @@ CFG_PHONON=auto CFG_PHONON_BACKEND=yes CFG_MULTIMEDIA=yes CFG_SVG=yes +CFG_DECLARATIVE=auto CFG_WEBKIT=auto # (yes|no|auto) CFG_JAVASCRIPTCORE_JIT=auto @@ -913,7 +914,7 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style yes options - -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-svg|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config) + -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` VAL=yes ;; @@ -1844,6 +1845,17 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi fi + ;; + declarative) + if [ "$VAL" = "yes" ]; then + CFG_DECLARATIVE="yes" + else + if [ "$VAL" = "no" ]; then + CFG_DECLARATIVE="no" + else + UNKNOWN_OPT=yes + fi + fi ;; webkit) if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then @@ -3233,7 +3245,7 @@ Usage: $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend] [-no-openssl] [-openssl] [-openssl-linked] [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-javascript-jit] [-javascript-jit] - [-no-script] [-script] [-no-scripttools] [-scripttools] + [-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative] [additional platform specific options (see below)] @@ -3391,6 +3403,9 @@ fi -no-scripttools .... Do not build the QtScriptTools module. + -scripttools ....... Build the QtScriptTools module. + + -no-declarative .....Do not build the declarative module. + -declarative ....... Build the declarative module. + -platform target ... The operating system and compiler you are building on ($PLATFORM). @@ -5788,6 +5803,19 @@ if [ "$CFG_ALSA" = "auto" ]; then fi fi +if [ -f "$relpath/src/declarative/declarative.pro" ]; then + if [ "$CFG_DECLARATIVE" = "auto" ]; then + CFG_DECLARATIVE=yes + fi +else + if [ "$CFG_DECLARATIVE" = "auto" ] || [ "$CFG_DECLARATIVE" = "no" ]; then + CFG_DECLARATIVE=no + else + echo "Error: Unable to locate the qt-declarative package. Refer to the documentation on how to build the package." + exit 1 + fi +fi + if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/javascriptcore-jit "javascriptcore-jit" $L_FLAGS $I_FLAGS $l_FLAGS @@ -6405,6 +6433,12 @@ else QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SVG" fi +if [ "$CFG_DECLARATIVE" = "yes" ]; then + QT_CONFIG="$QT_CONFIG declarative" +else + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DECLARATIVE" +fi + if [ "$CFG_WEBKIT" = "auto" ]; then CFG_WEBKIT="$canBuildWebKit" fi @@ -7321,6 +7355,7 @@ if [ "$CFG_WEBKIT" = "yes" ]; then echo "JavaScriptCore JIT .. $CFG_JAVASCRIPTCORE_JIT" fi fi +echo "Declarative module .. $CFG_DECLARATIVE" echo "STL support ......... $CFG_STL" echo "PCH support ......... $CFG_PRECOMPILE" echo "MMX/3DNOW/SSE/SSE2.. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}" diff --git a/configure.exe b/configure.exe Binary files differindex f433888..7c11fec 100755 --- a/configure.exe +++ b/configure.exe diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp index 2b75f19..a06e8a1 100644 --- a/demos/boxes/scene.cpp +++ b/demos/boxes/scene.cpp @@ -870,7 +870,7 @@ void Scene::renderCubemaps() float angle = 2.0f * PI * i / m_cubemaps.size(); - center = m_trackBalls[1].rotation().rotateVector(QVector3D(cos(angle), sin(angle), 0.0f)); + center = m_trackBalls[1].rotation().rotatedVector(QVector3D(cos(angle), sin(angle), 0.0f)); for (int face = 0; face < 6; ++face) { m_cubemaps[i]->begin(face); diff --git a/demos/boxes/trackball.cpp b/demos/boxes/trackball.cpp index 2b1b2e4..76324e6 100644 --- a/demos/boxes/trackball.cpp +++ b/demos/boxes/trackball.cpp @@ -93,7 +93,7 @@ void TrackBall::move(const QPointF& p, const QQuaternion &transformation) QLineF delta(m_lastPos, p); m_angularVelocity = 180*delta.length() / (PI*msecs); m_axis = QVector3D(-delta.dy(), delta.dx(), 0.0f).normalized(); - m_axis = transformation.rotateVector(m_axis); + m_axis = transformation.rotatedVector(m_axis); m_rotation = QQuaternion::fromAxisAndAngle(m_axis, 180 / PI * delta.length()) * m_rotation; } break; @@ -118,7 +118,7 @@ void TrackBall::move(const QPointF& p, const QQuaternion &transformation) m_angularVelocity = angle / msecs; m_axis.normalize(); - m_axis = transformation.rotateVector(m_axis); + m_axis = transformation.rotatedVector(m_axis); m_rotation = QQuaternion::fromAxisAndAngle(m_axis, angle) * m_rotation; } break; diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index ba2b051..887e93e 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -30,6 +30,10 @@ information about a particular change. * [245219] Added QXmlQuery::setFocus(const QString &focus); + - QGraphicsBlurEffect + * Since the 4.6 beta Qt::RenderHint has been moved to + QGraphicsBlurEffect::BlurHint. + - QVariant * Many optimisations * Added QVariant::toFloat() and QVariant::toReal() @@ -58,6 +62,66 @@ information about a particular change. - The reading code of QLocalSocket on Windows has been rewritten to improve reading performance. + - On Windows CE the link time code geration has been disabled by default to + be consistent with win32-msvc200x. + +**************************************************************************** +* DirectFB * +**************************************************************************** + + - When running Qt/DirectFB the DirectFB window id of a top level QWidget can + be queried using property("_q_DirectFBWindowID") + + - Allow setting the background color of the primary layer in DirectFB with + connect options. QWS_DISPLAY=directfb:bgcolor=red or + QWS_DISPLAY=directfb:bgcolor=\#aabbccdd + + - Add support for rendering mouse cursor using a top level window when cursor + support is not working in IDirectFBDisplayLayer. Define + QT_DIRECTFB_WINDOW_AS_CURSOR to enable. + + - Add experimental support for optimized locking/unlocking of surfaces. Enable + by defining QT_DIRECTFB_SUBSURFACE. + + - Fix a bug to conceptually allow using QDirectFBScreen as a subscreen of a + proxy screen. Don't make QDirectFBScreen::instance() assume that + QScreen::instance() is a QDirectFBScreen. + + - Optimize move/resize operations with DirectFB. With a properly configured + DirectFB these operations are handled for us and we don't need to force a + repaint of the window. + + - Support top level window opacity in DirectFB + + - Fix a bug when loading RGB32 images that would lead to rendering issues. + + - Fix a bug when painting with invalid pens/brushes. + + - Fix a bug that would show up when QWidget::scroll is called. + + - Implement support for loading pixmaps using IDirectFBImageProvider. + + - Disable color table support by default. This seems to work incorrectly on + most boards and loading these images will generally require an image + conversion anyway. + + - Fix a bug regarding QGraphicsProxyWidgets + + - Fix a crash when resizing windows + + - Compile with versions < 1.0. We still recommend using newer versions. + + - Considerable code cleanup + + - Various optimizations regarding painting, loading of images and creation of + surfaces. + + - Allow forcibly falling back to raster engine for painting operations by + exporting QT_DIRECTFB_FORCE_RASTER=1 + + - Reenable support for RGB32 primary surface. + + **************************************************************************** * Important Behavior Changes * **************************************************************************** @@ -138,11 +202,11 @@ information about a particular change. means that code that assigned a float to a variant would create a variant with userType QMetaType::Float, instead of QVariant::Double. - - QDataStream will now read and write all floating point numbers with the - same precision, regardless of whether it's streamed into or out from a + - QDataStream will now read and write all floating point numbers with the + same precision, regardless of whether it's streamed into or out from a float or double. This is to maintain compatibility across platforms with a different default precision for qreal. The default is 64-bit precision - for all floating point numbers, and this can be changed using the new - function setFloatingPointPrecision(). Set Qt_4_5 as the version of the + for all floating point numbers, and this can be changed using the new + function setFloatingPointPrecision(). Set Qt_4_5 as the version of the QDataStream to get the behavior of previous versions. - + diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 6c53242..9548848 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -2252,6 +2252,18 @@ For example: If the OpenGL implementation uses EGL (most OpenGL/ES systems), then QMAKE_INCDIR_EGL may also need to be set. + \section1 QMAKE_INCDIR_OPENGL_ES1, QMAKE_INCDIR_OPENGL_ES1CL, QMAKE_INCDIR_OPENGL_ES2 + + These variables contain the location of OpenGL headers files to be added + to INCLUDEPATH when building an application with OpenGL ES 1, OpenGL ES 1 Common + Lite or OpenGL ES 2 support respectively. + + The value of this variable is typically handled by \c qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + If the OpenGL implementation uses EGL (most OpenGL/ES systems), + then QMAKE_INCDIR_EGL may also need to be set. + \target QMAKE_INCDIR_OPENVG \section1 QMAKE_INCDIR_OPENVG @@ -2342,6 +2354,8 @@ For example: \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. \section1 QMAKE_LFLAGS_RPATH + + \e {This is used on Unix platforms only.} Library paths in this definition are added to the executable at link time so that the added paths will be preferentially searched at runtime. @@ -2496,6 +2510,17 @@ For example: variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \section1 QMAKE_LIBS_OPENGL_ES1, QMAKE_LIBS_OPENGL_ES1CL, QMAKE_LIBS_OPENGL_ES2 + + These variables contain all the OpenGL libraries for OpenGL ES 1, + OpenGL ES 1 Common Lite profile and OpenGL ES 2. + + The value of these variables is typically handled by \c qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + If the OpenGL implementation uses EGL (most OpenGL/ES systems), + then QMAKE_LIBS_EGL may also need to be set. + \section1 QMAKE_LIBS_OPENVG This variable contains all OpenVG libraries. The value of this @@ -2673,11 +2698,15 @@ For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 45 \section1 QMAKE_RPATH + + \e {This is used on Unix platforms only.} Is equivalent to \l QMAKE_LFLAGS_RPATH. \section1 QMAKE_RPATHDIR + \e {This is used on Unix platforms only.} + A list of library directory paths, these paths are added to the executable at link time so that the paths will be preferentially searched at runtime. diff --git a/doc/src/examples/ftp.qdoc b/doc/src/examples/ftp.qdoc index 8fded88..782613c 100644 --- a/doc/src/examples/ftp.qdoc +++ b/doc/src/examples/ftp.qdoc @@ -40,7 +40,7 @@ ****************************************************************************/ /*! - \example network/ftp + \example network/qftp \title FTP Example The FTP example demonstrates a simple FTP client that can be used diff --git a/doc/src/examples/stickman.qdoc b/doc/src/examples/stickman.qdoc index e70c39b..c9e98d0 100644 --- a/doc/src/examples/stickman.qdoc +++ b/doc/src/examples/stickman.qdoc @@ -55,9 +55,9 @@ Animations are implemented as composite states. Each child state of the animation state represents a frame in the animation by setting the position of each joint in the stickman's skeleton to the positions defined for the particular frame. The frames are then bound together - with animated transitions that trigger on the source state's polished() signal. Thus, the - machine will enter the state representing the next frame in the animation immediately after it - has finished animating into the previous frame. + with animated transitions that trigger on the source state's propertiesAssigned() signal. Thus, + the machine will enter the state representing the next frame in the animation immediately after + it has finished animating into the previous frame. \image stickman-example1.png @@ -67,7 +67,8 @@ \snippet examples/animation/stickman/lifecycle.cpp 1 - The states are then bound together with signal transitions that listen to the polished() signal. + The states are then bound together with signal transitions that listen to the + propertiesAssigned() signal. \snippet examples/animation/stickman/lifecycle.cpp 2 diff --git a/doc/src/frameworks-technologies/statemachine.qdoc b/doc/src/frameworks-technologies/statemachine.qdoc index ed8bc85..b0b13a7 100644 --- a/doc/src/frameworks-technologies/statemachine.qdoc +++ b/doc/src/frameworks-technologies/statemachine.qdoc @@ -75,6 +75,11 @@ states can be configured to set properties and invoke methods on QObjects. Qt's event system is used to drive the state machines. + The state graph in the State Machine framework is hierarchical. States can be nested inside of + other states, and the current configuration of the state machine consists of the set of states + which are currently active. All the states in a valid configuration of the state machine will + have a common ancestor. + \section1 Classes in the State Machine Framework These classes are provided by qt for creating event-driven state machines. @@ -269,9 +274,17 @@ When a parallel state group is entered, all its child states will be simultaneously entered. Transitions within the individual child states - operate normally. However, any of the child states may take a transition - outside the parent state. When this happens, the parent state and all of its - child states are exited. + operate normally. However, any of the child states may take a transition which exits the parent + state. When this happens, the parent state and all of its child states are exited. + + The parallelism in the State Machine framework follows an interleaved semantics. All parallel + operations will be executed in a single, atomic step of the event processing, so no event can + interrupt the parallel operations. However, events will still be processed sequentially, since + the machine itself is single threaded. As an example: Consider the situation where there are two + transitions that exit the same parallel state group, and their conditions become true + simultaneously. In this case, the event that is processed last of the two will not have any + effect, since the first event will already have caused the machine to exit from the parallel + state. \section1 Detecting that a Composite State has Finished @@ -413,18 +426,8 @@ value of the property before any property assignments in states were executed.) Take the following code: - \code - QStateMachine machine; - machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); - - QState *s1 = new QState(); - s1->assignProperty(object, "fooBar", 1.0); - machine.addState(s1); - machine.setInitialState(s1); - QState *s2 = new QState(); - machine.addState(s2); - \endcode + \snippet doc/src/snippets/statemachine/main5.cpp 0 Lets say the property \c fooBar is 0.0 when the machine starts. When the machine is in state \c s1, the property will be 1.0, since the state explicitly assigns this value to it. When the @@ -433,21 +436,8 @@ If we are using nested states, the parent defines a value for the property which is inherited by all descendants that do not explicitly assign a value to the property. - \code - QStateMachine machine; - machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); - QState *s1 = new QState(); - s1->assignProperty(object, "fooBar", 1.0); - machine.addState(s1); - machine.setInitialState(s1); - - QState *s2 = new QState(s1); - s2->assignProperty(object, "fooBar", 2.0); - s1->setInitialState(s2); - - QState *s3 = new QState(s1); - \endcode + \snippet doc/src/snippets/statemachine/main5.cpp 2 Here \c s1 has two children: \c s2 and \c s3. When \c s2 is entered, the property \c fooBar will have the value 2.0, since this is explicitly defined for the state. When the machine is in @@ -460,15 +450,8 @@ properties as they are assigned in states. Say we have the following code: - \code - QState *s1 = new QState(); - QState *s2 = new QState(); - s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); - s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100)); - - s1->addTransition(button, SIGNAL(clicked()), s2); - \endcode + \snippet doc/src/snippets/statemachine/main5.cpp 3 Here we define two states of a user interface. In \c s1 the \c button is small, and in \c s2 it is bigger. If we click the button to transition from \c s1 to \c s2, the geometry of the button @@ -476,16 +459,7 @@ smooth, however, all we need to do is make a QPropertyAnimation and add this to the transition object. - \code - QState *s1 = new QState(); - QState *s2 = new QState(); - - s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); - s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100)); - - QSignalTransition *transition = s1->addTransition(button, SIGNAL(clicked()), s2); - transition->addAnimation(new QPropertyAnimation(button, "geometry")); - \endcode + \snippet doc/src/snippets/statemachine/main5.cpp 4 Adding an animation for the property in question means that the property assignment will no longer take immediate effect when the state has been entered. Instead, the animation will start @@ -504,33 +478,48 @@ property can potentially have any value, depending on the animation. In some cases, it can be useful to be able to detect when the property has actually been assigned - the value defined by a state. For this, we can use the state's polished() signal. - \code - QState *s1 = new QState(); - s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); + the value defined by a state. - QState *s2 = new QState(); + Say we have the following code: - s1->addTransition(s1, SIGNAL(polished()), s2); - \endcode + \snippet doc/src/snippets/statemachine/main5.cpp 5 + + When \c button is clicked, the machine will transition into state \c s2, which will set the + geometry of the button, and then pop up a message box to alert the user that the geometry has + been changed. + + In the normal case, where animations are not used, this will operate as expected. However, if + an animation for the \c geometry of \c button is set on the transition between \c s1 and \c s2, + the animation will be started when \c s2 is entered, but the \c geometry property will not + actually reach its defined value before the animation is finished running. In this case, the + message box will pop up before the geometry of the button has actually been set. + + To ensure that the message box does not pop up until the geometry actually reaches its final + value, we can use the state's propertiesAssigned() signal. The propertiesAssigned() signal will be + emitted when the property is assigned its final value, whether this is done immediately or + after the animation has finished playing. + + \snippet doc/src/snippets/statemachine/main5.cpp 6 - The machine will be in state \c s1 until the \c geometry property has been set. Then it will - immediately transition into \c s2. If the transition into \c s1 has an animation for the \c - geometry property, then the machine will stay in \c s1 until the animation has finished. If there - is no animation, it will simply set the property and immediately enter state \c s2. + In this example, when \c button is clicked, the machine will enter \c s2. It will remain in state + \c s2 until the \c geometry property has been set to \c QRect(0, 0, 50, 50). Then it will + transition into \c s3. When \c s3 is entered, the message box will pop up. If the transition into + \c s2 has an animation for the \c geometry property, then the machine will stay in \c s2 until the + animation has finished playing. If there is no such animation, it will simply set the property and + immediately enter state \c s3. - Either way, when the machine is in state \c s2, the property \c geometry has been assigned the - defined value. + Either way, when the machine is in state \c s3, you are guaranteed that the property \c geometry + has been assigned the defined value. If the global restore policy is set to QStateMachine::RestoreProperties, the state will not emit - the polished() signal until these have been executed as well. + the propertiesAssigned() signal until these have been executed as well. - \section1 What happens if a state is exited before the animation has finished + \section1 What Happens If A State Is Exited Before The Animation Has Finished If a state has property assignments, and the transition into the state has animations for the properties, the state can potentially be exited before the properties have been assigned to the values defines by the state. This is true in particular when there are transitions out from the - state that do not depend on the state being polished, as described in the previous section. + state that do not depend on the propertiesAssigned signal, as described in the previous section. The State Machine API guarantees that a property assigned by the state machine either: \list @@ -545,7 +534,7 @@ If the target state does not assign any value to the property, there are two options: By default, the property will be assigned the value defined by the state it is leaving - (the value it would have been assigned if the animation had been permitted to finish playing.) If + (the value it would have been assigned if the animation had been permitted to finish playing). If a global restore policy is set, however, this will take precedence, and the property will be restored as usual. diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index 05940e4..79cbe89 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -729,7 +729,7 @@ \o \l{network/network-chat}{Network Chat} \o \l{network/fortuneclient}{Fortune Client}\raisedaster \o \l{network/fortuneserver}{Fortune Server}\raisedaster - \o \l{network/ftp}{FTP}\raisedaster + \o \l{network/qftp}{FTP}\raisedaster \o \l{network/http}{HTTP} \o \l{network/loopback}{Loopback} \o \l{network/threadedfortuneserver}{Threaded Fortune Server}\raisedaster diff --git a/doc/src/internationalization/i18n.qdoc b/doc/src/internationalization/i18n.qdoc index e873f4e..2d1b8cc 100644 --- a/doc/src/internationalization/i18n.qdoc +++ b/doc/src/internationalization/i18n.qdoc @@ -51,6 +51,7 @@ \page internationalization.html \title Internationalization with Qt \brief Information about Qt's support for internationalization and multiple languages. + \nextpage Writing Source Code for Translation \keyword internationalization \keyword i18n @@ -59,11 +60,11 @@ the application usable by people in countries other than one's own. \tableofcontents - + \section1 Relevant Qt Classes and APIs These classes support internationalizing of Qt applications. - + \annotatedlist i18n \section1 Languages and Writing Systems @@ -438,9 +439,13 @@ application language. The default event handler for QWidget subclasses responds to the - QEvent::LanguageChange event, and will call this function when necessary; - other application components can also force widgets to update themselves - by posting the \l{QEvent::LanguageChange}{LanguageChange} event to them. + QEvent::LanguageChange event, and will call this function when necessary. + + \l{QEvent::LanguageChange}{LanguageChange} events are posted when a new + translation is installed using the QCoreApplication::installTranslator() + function. Additionally, other application components can also force + widgets to update themselves by posting LanguageChange events to them. + \section1 Translating Non-Qt Classes @@ -516,3 +521,265 @@ For details on Mac-specific translation, refer to the Qt/Mac Specific Issues document \l{Qt for Mac OS X - Specific Issues#Translating the Application Menu and Native Dialogs}{here}. */ + +/*! + \page i18n-source-translation.html + \title Writing Source Code for Translation + \ingroup i18n + \previouspage Internationalization with Qt + \contentspage Internationalization with Qt + \nextpage Translation Rules for Plurals + \brief How to write source code in a way that makes it possible for user-visible text to be translated. + + \tableofcontents + + \section1 The Basics + + Developers use the \l{QObject::}{tr()} function to obtain translated text + for their classes, typically for display purposes. This function is also + used to indicate which text strings in an application are translatable. + + Qt indexes each translatable string by the \e{translation context} it is + associated with; this is generally the name of the QObject subclass it is + used in. + + Translation contexts are defined for new QObject-based classes by the use + of the Q_OBJECT macro in each new class definition. + + When tr() is called, it looks up the translatable string using a QTranslator + object. For translation to work, one or more of these must have been + installed on the application object in the way described in the + \l{#Enabling Translation}{Enabling Translation} section below. + + \section1 Defining a Translation Context + + The translation context for QObject and each QObject subclass is the + class name itself. Developers subclassing QObject must use the + Q_OBJECT macro in their class definition to override the translation + context. This macro sets the context to the name of the subclass. + + For example, the following class definition includes the Q_OBJECT macro, + implementing a new tr() that uses the \c MainWindow context: + + \snippet mainwindows/sdi/mainwindow.h class definition with macro + \dots + + If Q_OBJECT is not used in a class definition, the context will be + inherited from the base class. For example, since all QObject-based + classes in Qt provide a context, a new QWidget subclass defined without + a Q_OBJECT macro will use the \c QWidget context if its tr() function + is invoked. + + \section1 Using tr() to Obtain a Translation + + The following example shows how a translation is obtained for the + class shown in the previous section: + + \snippet mainwindows/sdi/mainwindow.cpp implicit tr context + \dots + + Here, the translation context is \c MainWindow because it is the + \c MainWindow::tr() function that is invoked. The text returned + by the tr() function is a translation of "&File" obtained from + the \c MainWindow context. + + When Qt's translation tool, \l lupdate, is used to process a set of source + files, the text wrapped in tr() calls is stored in a section of the translation + file that corresponds to its translation context. + + In some situations, it is useful to give a translation context explicitly + by fully qualifying the call to tr(); for example: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp explicit tr context + + This call obtains the translated text for "Page up" from the \c QScrollBar + context. Developers can also use the QCoreApplication::translate() function + to obtain a translation for a particular translation context. + + \section1 Translator Comments + + Developers can include information about each translatable string to + help translators with the translation process. These are extracted + when \l lupdate is used to process the source files. The recommended + way to add comments is to annotate the tr() calls in your code with + comments of the form: + + \tt{//: ...} + + or + + \tt{\begincomment: ... \endcomment} + + Examples: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 40 + + In these examples, the comments will be associated with the strings + passed to tr() in the context of each call. + + \section1 Adding Meta-Data to Strings + + Additional data can be attached to each translatable message. These are + extracted when \l lupdate is used to process the source files. The + recommended way to add meta-data is to annotate the tr() calls in your code + with comments of the form: + + \tt{//= <id>} + + This can be used to give the message a unique identifier to support tools + which need it. + + An alternative way to attach meta-data is to use the following syntax: + + \tt{//~ <field name> <field contents>} + + This can be used to attach meta-data to the message. The field name should + consist of a domain prefix (possibly the conventional file extension of the + file format the field is inspired by), a hyphen and the actual field name + in underscore-delimited notation. For storage in TS files, the field name + together with the prefix "extra-" will form an XML element name. The field + contents will be XML-escaped, but otherwise appear verbatim as the + element's contents. Any number of unique fields can be added to each + message. + + Example: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp meta data + + Meta-data appearing right in front of a magic TRANSLATOR comment applies to + the whole TS file. + + \section1 Disambiguation + + If the same translatable string is used in different roles within the same + translation context, an additional identifying string may be passed in + the call to \l{QObject::}{tr()}. This optional disambiguation argument + is used to distinguish between otherwise identical strings. + + Example: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 17 + \dots + + In Qt 4.4 and earlier, this disambiguation parameter was the preferred + way to specify comments to translators. + + \section1 Character Encodings + + You can set the encoding for the source text by calling QTextCodec::setCodecForTr(). + By default, the source text is assumed to be in Latin-1 encoding. + + \section1 Handling Plurals + + Some translatable strings contain placeholders for integer values and need + to be translated differently depending on the values in use. + + To help with this problem, developers pass an additional integer argument + to the \l{QObject::}{tr()} function, and typically use a special notation + for plurals in each translatable string. + + If this argument is equal or greater than zero, all occurrences of + \c %n in the resulting string are replaced with a decimal representation + of the value supplied. In addition, the translation used will adapt to the + value according to the rules for each language. + + Example: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 18 + + The table below shows what string is returned depending on the + active translation: + + \table + \header \o \o{3,1} Active Translation + \header \o \a n \o No Translation \o French \o English + \row \o 0 \o "0 message(s) saved" \o "0 message sauvegard\unicode{0xE9}" \o "0 message\bold{s} saved" + \row \o 1 \o "1 message(s) saved" \o "1 message sauvegard\unicode{0xE9}" \o "1 message saved" + \row \o 2 \o "2 message(s) saved" \o "2 message\bold{s} sauvegard\unicode{0xE9}\bold{s}" \o "2 message\bold{s} saved" + \row \o 37 \o "37 message(s) saved" \o "37 message\bold{s} sauvegard\unicode{0xE9}\bold{s}" \o "37 message\bold{s} saved" + \endtable + + This idiom is more flexible than the traditional approach; e.g., + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 19 + + because it also works with target languages that have several + plural forms (e.g., Irish has a special "dual" form that should + be used when \c n is 2), and it handles the \e n == 0 case + correctly for languages such as French that require the singular. + See the \l{Qt Linguist Manual} for details. + + Instead of \c %n, you can use \c %Ln to produce a localized + representation of \a n. The conversion uses the default locale, + set using QLocale::setDefault(). (If no default locale was + specified, the "C" locale is used.) + + A summary of the rules used to translate strings containing plurals can be + found in the \l{Translation Rules for Plurals} document. + + \section1 Enabling Translation + + Typically, your application's \c main() function will look like + this: + + \snippet doc/src/snippets/code/doc_src_i18n.qdoc 8 + + Note the use of QLibraryInfo::location() to locate the Qt translations. + Developers should request the path to the translations at run-time by + passing QLibraryInfo::TranslationsPath to this function instead of + using the \c QTDIR environment variable in their applications. + + \section1 Further Reading + + \l{Qt Linguist Manual}, \l{Hello tr Example}, \l{Translation Rules for Plurals} +*/ + +/*! + \page i18n-plural-rules.html + \title Translation Rules for Plurals + \ingroup i18n + \previouspage Writing Source Code for Translation + \contentspage Internationalization with Qt + \brief A summary of the translation rules for plurals produced by Qt's i18n tools. + + The table below shows the specific rules that are produced by Qt Linguist + and \c lrelease for a selection of languages. Cells marked \e otherwise + indicate the form used when none of the other rules are appropriate for a + specific language. + + \table 80% + \header \o Language \o Rule 1 \o Rule 2 \o Rule 3 + \row \o English \o \c{n == 1} + \o \e{otherwise} \o N/A + \row \o French \o \c{n < 2} + \o \e{otherwise} \o N/A + \row \o Czech \o \c{n % 100 == 1} + \o \c{n % 100 >= 2 && n % 100 <= 4} + \o \e{otherwise} + \row \o Irish \o \c{n == 1} + \o \c{n == 2} \o \e{otherwise} + \row \o Latvian \o \c{n % 10 == 1&& n % 100 != 11} + \o \c{n != 0} \o \e{otherwise} + \row \o Lithuanian \o \c{n % 10 == 1&& n % 100 != 11} + \o \c{n % 100 != 12 && n % 10 == 2} + \o \e{otherwise} + \row \o Macedonian \o \c{n % 10 == 1} + \o \c{n % 10 == 2} \o \e{otherwise} + \row \o Polish \o \c{n == 1} + \o \c{n % 10 >= 2 && n % 10 <= 4 + && (n % 100 < 10 || n % 100 > 20)} + \o \e{otherwise} + \row \o Romanian \o \c{n == 1} + \o \c{n == 0|| (n % 100 >= 1 && n % 100 <= 20)} + \o \e{otherwise} + \row \o Russian \o \c{n % 10 == 1&& n % 100 != 11} + \o \c{n % 10 >= 2 && n % 10 <= 4 + && (n % 100 < 10 || n % 100 > 20)} + \o \e{otherwise} + \row \o Slovak \o \c{n == 1} \o \c{n >= 2 && n <= 4} + \o \e{otherwise} + \row \o Japanese \o \e{otherwise} \o N/A \o N/A + \endtable + + The rules themselves are not documented and are internal to Qt Linguist and \c lrelease. +*/ diff --git a/doc/src/internationalization/linguist-manual.qdoc b/doc/src/internationalization/linguist-manual.qdoc index 5d388f1..3e06a2f 100644 --- a/doc/src/internationalization/linguist-manual.qdoc +++ b/doc/src/internationalization/linguist-manual.qdoc @@ -62,7 +62,7 @@ software engineers and the translator. The chapter describes the use of two tools. The \l{lupdate} tool is used to synchronize source code and translations. The \l{lrelease} tool is used to - create runtime translation files for use by the released + create run-time translation files for use by the released application. The \l{linguist-translators.html}{Translators} chapter is for @@ -119,7 +119,7 @@ \o Phrases that contain variables, for example, "The 25 files selected will take 63 seconds to process", where the two numbers - are inserted programmatically at runtime may need to be reworded + are inserted programmatically at run-time may need to be reworded because in a different language the word order and therefore the placement of the variables may have to change. @@ -147,7 +147,7 @@ \row \o{1,2} \inlineimage wVista-Cert-border-small.png \o \e{Qt Linguist 4.3 is Certified for Windows Vista} - + \row \o Windows Vista and the Windows Vista Start button are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. @@ -508,7 +508,7 @@ translation. The state is reset to \inlineimage linguist-danger.png , and the number of accepted translations in the \e{Items} column of the \l{Context Window} {context list} is decremented by 1. - + \row \o Not Accepted \o \inlineimage linguist-check-off.png @@ -781,7 +781,7 @@ changed. Whichever character (alpha or digit) is chosen, the translation must be in the form "Ctrl+" followed by the upper case character. \e{Qt} will automatically display the correct name at - runtime. As with Alt key accelerators, if the translator changes + run-time. As with Alt key accelerators, if the translator changes the character, the new character must not conflict with any other Ctrl key accelerator. @@ -790,14 +790,14 @@ supported languages, \e {Qt} automatically translates these strings. - \section2 Handling Numbered Arguments + \section2 Handling Numbered Arguments and Plurals Some phrases contain numbered arguments. A numbered argument is a - placeholder that will be replaced with text at runtime. A numbered + placeholder that will be replaced with text at run-time. A numbered argument appears in a source string as a percent sign followed by a digit. Consider an example: \c{After processing file %1, file %2 is next in line}. In this string to be translated, \c{%1} and - \c{%2} are numbered arguments. At runtime, \c{%1} and \c{%2} will + \c{%2} are numbered arguments. At run-time, \c{%1} and \c{%2} will be replaced with the first and next file names respectively. The same numbered arguments must appear in the translation, but not necessarily in the same order. A German translation of the string @@ -808,336 +808,14 @@ of where argument \e{i} appears in the argument sequence in the source string. - \section2 Plurals - - The problem of plurals in output is resolved by using an overload of - the \c tr() function with the signature - \code - QString tr(const char *text, const char *comment, int n); - \endcode - Using built in comparisons for the value of \c n the tr() function will - translate the phrase to the plural form for the target language. - - Different languages have various forms for plurals beyond simply - \e singular and \e plural. The rules for determining which form of the - plural to use are encoded as conditional tests. Below is a table - representing the numbers associated with the forms rather than the - conditional tests themselves. - - - - \table 90% - \header - \o Language - \o Form 1 - \o Form 2 - \o Form 3 - \o Form 4 - \row - \o Arabic - \o 0, 1, 11-102, 111-202... - \o 2 - \o 3-10, 103-110, 203-210... - \o - \row - \o Basque - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Bulgarian - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Catalan - \o 1 - \o 11, 11 000-11 999, 11 000 000-11 999 999... - \o 0, 2-10, 12-10 999, 12-10 999 999... - \o - \row - \o Chinese-CN - \o 0- - \o - \o - \o - \row - \o Chinese-HK - \o 0- - \o - \o - \o - \row - \o Chinese-TW - \o 0- - \o - \o - \o - \row - \o Croation - \o 1, 21, 31, 41, 51, 61, 71, 81, 91, 101... - \o 2-4, 22-24, 32-34, 42-44... - \o 0, 5-20, 25-30, 35-40... - \o - \row - \o Czech - \o 1 - \o 2-4 - \o 0, 5- - \o - \row - \o Danish - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Dutch - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o English - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o English-US - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Estonian - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Finnish - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o French-CA - \o 0, 1 - \o 2-100, 101- - \o - \o - \row - \o French-FR - \o 0, 1 - \o 2-100, 101- - \o - \o - \row - \o Galician - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o German - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Greek - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Hebrew - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Hungarian - \o 0- - \o - \o - \o - \row - \o Icelandic - \o 1, 21, 31, 41, 51....101, 121, 131... - \o 0, 2-20, 22-30, 32-40...102-120... - \o - \o - \row - \o Indonesian - \o 0- - \o - \o - \o - \row - \o Italian - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Japanese - \o 0- - \o - \o - \o - \row - \o Korean - \o 0- - \o - \o - \o - \row - \o Latvian - \o 0 - \o 1, 21, 31, 41, 51, 61, 71, 81, 91, 101, 131, 141... - \o 2-20, 22-30, 32-40, 42-50...202-220, 222-230... - \o - \row - \o Lithuanian - \o 1, 21, 31, 41, 51...101, 121, 131... - \o 2-9, 22-29, 32-39...102-109, 122-129, 132-139... - \o 0, 10-20, 30, 40, 50...110-120, 130, 140... - \o - \row - \o Malay - \o 0- - \o - \o - \o - \row - \o Norwegian - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Persian - \o 0- - \o - \o - \o - \row - \o Polish - \o 1 - \o 2-4, 22-24, 32-34... - \o 5-21, 25-31, 35-41... - \o - \row - \o Portugese-BR - \o 0, 1 - \o 2-100, 101- - \o - \o - \row - \o Portugese-PT - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Romanian - \o 1 - \o 0, 2-19, 101-119, 201-219... - \o 20-100, 120-200, 220-300... - \o - \row - \o Russian - \o 1, 21, 31, 41, 51, 61, 71, 81, 91, 101... - \o 2-4, 22-24, 32-34... - \o 0, 5-20, 25-30, 35-40... - \o - \row - \o Serbian - \o 1, 21, 31, 41, 51, 61, 71, 81, 91, 101... - \o 2-4, 22-24, 32-34... - \o 0, 5-20, 25-30, 35-40... - \o - \row - \o Slovak - \o 1 - \o 2-4 - \o 0, 5-20, 25-30, 35-40... - \o - \row - \o Slovene - \o 1, 101, 201, 301... - \o 2, 102, 202, 302... - \o 3, 4, 103, 104, 203, 204, 303, 304... - \o 0, 5-100, 105-200, 205-300... - \row - \o Spanish-US - \o 1 - \o 0, 2- - \o - \o - \row - \o Spanish-ES - \o 1 - \o 0, 2- - \o - \o - \row - \o Swedish - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Tagalog - \o 0, 1 - \o 2, 3, 5, 7-8, 10-13, 15, 17-18, 20-23...101...1001 - \o 4, 6, 9, 14, 16, 19, 24, 26, 29...104, 106, 109... - \o - \row - \o Thai - \o 0- - \o - \o - \o - \row - \o Turkish - \o 0- - \o - \o - \o - \row - \o Ukrainian - \o 1, 21, 31, 41, 51, 61, 71, 81, 91, 101... - \o 2-4, 22-24, 32-34... - \o 0, 5-20, 25-30, 35-40... - \o - \row - \o Urdu - \o 1 - \o 0, 2-100, 101- - \o - \o - \row - \o Vietnamese - \o 0- - \o - \o - \o - \endtable - - These rules are embedded within the Qt libraries, there is no need for - the developer to know them. Merely to use the correct \c tr() call. - + The use of numbered arguments is often accompanied by the use of + plurals in the source text. In many languages, the form of the + text will depend on the value shown, and more than one translation + is required. If the developers have marked up the source text in + correct way, fields for each of the possible plural forms will be + available in the translation area. (The + \l{Writing Source Code for Translation#Handling Plurals}{Writing Source Code for Translation} + document contains details about this feature for developers.) \section2 Reusing Translations @@ -1157,7 +835,7 @@ {translation area}, and adapts the number of input fields for plural forms accordingly. If not explicitly set, \QL guesses the target language and country by evaluating the translation source - file name: E.g. \c app_de.ts sets the target language to German, + file name. For example, \c app_de.ts sets the target language to German, and \c app_de_ch.ts sets the target language to German and the target country to Switzerland (this also helps loading translations for the current locale automatically; see @@ -1287,7 +965,7 @@ can be used to edit XLIFF files generated by other programs. For standard Qt projects, however, only the TS file format is used. \o QM \e {Qt message files} \BR are binary files that contain - translations used by an application at runtime. These files are + translations used by an application at run-time. These files are generated by \l lrelease, but can also be generated by \QL. \o \c .qph \e {Qt phrase book files} \BR are human-readable XML files containing standard phrases and their translations. These files @@ -1416,7 +1094,7 @@ \endlist - \o \gui {Tools} + \o \gui {Tools} \list \o \gui {Batch Translation...} \BR Opens a \l{Batch @@ -1427,7 +1105,7 @@ Preview}. This window let you instantly see translations for forms created with \QD. \endlist - \o \gui {View} + \o \gui {View} \list \o \gui {Revert Sorting} \BR puts the items in the \l{Context @@ -1449,7 +1127,7 @@ \endlist - \o \gui {Help} + \o \gui {Help} \list \o \gui {Manual F1} \BR opens this manual. \o \gui {About Qt Linguist} \BR Shows information about \QL. @@ -1621,7 +1299,7 @@ \code CODECFORTR = UTF-8 \endcode - + See the \l lupdate and \l lrelease sections. \section2 Loading Translations @@ -1683,7 +1361,7 @@ \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 9 - \section2 Distinguishing Identical Strings That Require Different Translations + \section2 Distinguishing Between Identical Translatable Strings The \l lupdate program automatically provides a \e context for every source text. This context is the class name of the class that contains diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index 9c92a31..ea5a9dc 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -367,6 +367,9 @@ The QtSql module is part of the \l{Qt Full Framework Edition} and the \l{Open Source Versions of Qt}. + + See the \l{SQL Programming} guide for information about using this + module in your applications. */ /*! @@ -576,7 +579,7 @@ the module under the appropriate version of the GNU LGPL; version 2.1 for applications and libraries licensed under the GNU GPL version 2, or version 3 for applications and libraries licensed under the GNU - GPL version 2. + GPL version 3. \legalese This file is part of the KDE project diff --git a/doc/src/network-programming/qtnetwork.qdoc b/doc/src/network-programming/qtnetwork.qdoc index d9377fb..b44b84f 100644 --- a/doc/src/network-programming/qtnetwork.qdoc +++ b/doc/src/network-programming/qtnetwork.qdoc @@ -155,7 +155,7 @@ commands based on the result of a previous command. It also enables you to provide detailed feedback to the user. - The \l{network/ftp}{FTP} example + The \l{network/qftp}{FTP} example illustrates how to write an FTP client. Writing your own FTP (or HTTP) server is possible using the lower-level classes QTcpSocket and QTcpServer. diff --git a/doc/src/snippets/code/doc_src_i18n.qdoc b/doc/src/snippets/code/doc_src_i18n.qdoc index eca2868..80faabc 100644 --- a/doc/src/snippets/code/doc_src_i18n.qdoc +++ b/doc/src/snippets/code/doc_src_i18n.qdoc @@ -184,7 +184,7 @@ void Clock::setTime(const QTime &time) //! [12] -void QWidget::changeEvent(QEvent *event) +void MyWidget::changeEvent(QEvent *event) { if (e->type() == QEvent::LanguageChange) { titleLabel->setText(tr("Document Title")); diff --git a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp index 4c64374..88d8025 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp @@ -235,9 +235,8 @@ MyWindow::MyWindow() { QLabel *senderLabel = new QLabel(tr("Name:")); QLabel *recipientLabel = new QLabel(tr("Name:", "recipient")); - ... -} //! [17] +} //! [18] diff --git a/doc/src/snippets/statemachine/main2.cpp b/doc/src/snippets/statemachine/main2.cpp index 2419dc2..9a2890f 100644 --- a/doc/src/snippets/statemachine/main2.cpp +++ b/doc/src/snippets/statemachine/main2.cpp @@ -69,17 +69,18 @@ int main(int argv, char **args) //![1] QButton *interruptButton = new QPushButton("Interrupt Button"); + QWidget *mainWindow = new QWidget(); //![3] QHistoryState *s1h = new QHistoryState(s1); QState *s3 = new QState(); s3->assignProperty(label, "text", "In s3"); - QMessageBox mbox; - mbox.addButton(QMessageBox::Ok); - mbox.setText("Interrupted!"); - mbox.setIcon(QMessageBox::Information); - QObject::connect(s3, SIGNAL(entered()), &mbox, SLOT(exec())); + QMessageBox *mbox = new QMessageBox(mainWindow); + mbox->addButton(QMessageBox::Ok); + mbox->setText("Interrupted!"); + mbox->setIcon(QMessageBox::Information); + QObject::connect(s3, SIGNAL(entered()), mbox, SLOT(exec())); s3->addTransition(s1h); machine.addState(s3); diff --git a/doc/src/snippets/statemachine/main5.cpp b/doc/src/snippets/statemachine/main5.cpp index a9d4091..ff25b7b 100644 --- a/doc/src/snippets/statemachine/main5.cpp +++ b/doc/src/snippets/statemachine/main5.cpp @@ -44,14 +44,13 @@ int main(int argv, char **args) { QApplication app(argv, args); + QWidget *button; { //![0] QStateMachine machine; machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); -//![0] -//![1] QState *s1 = new QState(); s1->assignProperty(object, "fooBar", 1.0); machine.addState(s1); @@ -59,7 +58,7 @@ int main(int argv, char **args) QState *s2 = new QState(); machine.addState(s2); -//![1] +//![0] } { @@ -110,21 +109,50 @@ int main(int argv, char **args) } { + QMainWindow *mainWindow = 0; //![5] + QMessageBox *messageBox = new QMessageBox(mainWindow); + messageBox->addButton(QMessageBox::Ok); + messageBox->setText("Button geometry has been set!"); + messageBox->setIcon(QMessageBox::Information); + QState *s1 = new QState(); - s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); QState *s2 = new QState(); + s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); + connect(s2, SIGNAL(entered()), messageBox, SLOT(exec())); - s1->addTransition(s1, SIGNAL(polished()), s2); + s1->addTransition(button, SIGNAL(clicked()), s2); //![5] - } { + QMainWindow *mainWindow = 0; + +//![6] + QMessageBox *messageBox = new QMessageBox(mainWindow); + messageBox->addButton(QMessageBox::Ok); + messageBox->setText("Button geometry has been set!"); + messageBox->setIcon(QMessageBox::Information); + + QState *s1 = new QState(); + + QState *s2 = new QState(); + s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); + + QState *s3 = new QState(); + connect(s3, SIGNAL(entered()), messageBox, SLOT(exec())); + s1->addTransition(button, SIGNAL(clicked()), s2); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); //![6] + + } + + { + +//![7] QState *s1 = new QState(); QState *s2 = new QState(); @@ -134,10 +162,12 @@ int main(int argv, char **args) QStateMachine machine; machine.setInitialState(s1); machine.addDefaultAnimation(new QPropertyAnimation(object, "fooBar")); -//![6] +//![7] } + + return app.exec(); } diff --git a/doc/src/sql-programming/sql-programming.qdoc b/doc/src/sql-programming/sql-programming.qdoc index d0b6776..3aceb17 100644 --- a/doc/src/sql-programming/sql-programming.qdoc +++ b/doc/src/sql-programming/sql-programming.qdoc @@ -49,6 +49,7 @@ /*! \page sql-programming.html \title SQL Programming + \nextpage Connecting to Databases \brief Database integration for Qt applications. @@ -95,7 +96,7 @@ and the SQL API layer. See \l{SQL Database Drivers} for more information. \section2 SQL API Layer - + These classes provide access to databases. Connections are made using the QSqlDatabase class. Database interaction is achieved by using the QSqlQuery class. @@ -119,6 +120,7 @@ \title Connecting to Databases \contentspage SQL Programming + \previouspage SQL Programming \nextpage Executing SQL Statements To access a database with QSqlQuery or QSqlQueryModel, create and diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index 250fb85..1b6f9cd 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -194,14 +194,14 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa topLevel->setInitialState(frameState); else //! [2] - previousState->addTransition(previousState, SIGNAL(polished()), frameState); + previousState->addTransition(previousState, SIGNAL(propertiesAssigned()), frameState); //! [2] previousState = frameState; } // Loop - previousState->addTransition(previousState, SIGNAL(polished()), topLevel->initialState()); + previousState->addTransition(previousState, SIGNAL(propertiesAssigned()), topLevel->initialState()); return topLevel; diff --git a/examples/mainwindows/mdi/mainwindow.cpp b/examples/mainwindows/mdi/mainwindow.cpp index 712d91f..edb33b7 100644 --- a/examples/mainwindows/mdi/mainwindow.cpp +++ b/examples/mainwindows/mdi/mainwindow.cpp @@ -71,7 +71,7 @@ MainWindow::MainWindow() void MainWindow::closeEvent(QCloseEvent *event) { mdiArea->closeAllSubWindows(); - if (activeMdiChild()) { + if (mdiArea->currentSubWindow()) { event->ignore(); } else { writeSettings(); diff --git a/examples/mainwindows/sdi/mainwindow.h b/examples/mainwindows/sdi/mainwindow.h index ca478df..a925e2f 100644 --- a/examples/mainwindows/sdi/mainwindow.h +++ b/examples/mainwindows/sdi/mainwindow.h @@ -50,12 +50,14 @@ class QMenu; class QTextEdit; QT_END_NAMESPACE +//! [class definition with macro] class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(); +//! [class definition with macro] MainWindow(const QString &fileName); protected: diff --git a/examples/multimedia/videographicsitem/videoitem.cpp b/examples/multimedia/videographicsitem/videoitem.cpp index c95e335..99e8df8 100644 --- a/examples/multimedia/videographicsitem/videoitem.cpp +++ b/examples/multimedia/videographicsitem/videoitem.cpp @@ -104,7 +104,7 @@ QList<QVideoFrame::PixelFormat> VideoItem::supportedPixelFormats( bool VideoItem::start(const QVideoSurfaceFormat &format) { if (isFormatSupported(format)) { - imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat()); + imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat()); imageSize = format.frameSize(); framePainted = true; @@ -129,7 +129,7 @@ void VideoItem::stop() bool VideoItem::present(const QVideoFrame &frame) { if (!framePainted) { - if (!isStarted()) + if (!QAbstractVideoSurface::isActive()) setError(StoppedError); return false; diff --git a/examples/multimedia/videographicsitem/videoplayer.cpp b/examples/multimedia/videographicsitem/videoplayer.cpp index 83644db..9ac4152 100644 --- a/examples/multimedia/videographicsitem/videoplayer.cpp +++ b/examples/multimedia/videographicsitem/videoplayer.cpp @@ -119,8 +119,7 @@ void VideoPlayer::openFile() QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie")); if (!fileName.isEmpty()) { - if (videoItem->isStarted()) - videoItem->stop(); + videoItem->stop(); movie.setFileName(fileName); diff --git a/examples/multimedia/videowidget/videoplayer.cpp b/examples/multimedia/videowidget/videoplayer.cpp index ed24714..cd146e8 100644 --- a/examples/multimedia/videowidget/videoplayer.cpp +++ b/examples/multimedia/videowidget/videoplayer.cpp @@ -100,8 +100,7 @@ void VideoPlayer::openFile() QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie")); if (!fileName.isEmpty()) { - if (surface->isStarted()) - surface->stop(); + surface->stop(); movie.setFileName(fileName); diff --git a/examples/multimedia/videowidget/videowidget.cpp b/examples/multimedia/videowidget/videowidget.cpp index 80688e1..f73a52f 100644 --- a/examples/multimedia/videowidget/videowidget.cpp +++ b/examples/multimedia/videowidget/videowidget.cpp @@ -84,7 +84,7 @@ void VideoWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); - if (surface->isStarted()) { + if (surface->isActive()) { const QRect videoRect = surface->videoRect(); if (!videoRect.contains(event->rect())) { diff --git a/examples/multimedia/videowidget/videowidgetsurface.cpp b/examples/multimedia/videowidget/videowidgetsurface.cpp index ec9b8b5..b69375c 100644 --- a/examples/multimedia/videowidget/videowidgetsurface.cpp +++ b/examples/multimedia/videowidget/videowidgetsurface.cpp @@ -73,7 +73,7 @@ bool VideoWidgetSurface::isFormatSupported( { Q_UNUSED(similar); - const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat()); + const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat()); const QSize size = format.frameSize(); return imageFormat != QImage::Format_Invalid @@ -85,7 +85,7 @@ bool VideoWidgetSurface::isFormatSupported( //! [2] bool VideoWidgetSurface::start(const QVideoSurfaceFormat &format) { - const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat()); + const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat()); const QSize size = format.frameSize(); if (imageFormat != QImage::Format_Invalid && !size.isEmpty()) { diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf index cc5c38b..1ae5608 100644 --- a/mkspecs/common/linux.conf +++ b/mkspecs/common/linux.conf @@ -13,6 +13,12 @@ QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS] QMAKE_INCDIR_OPENGL = /usr/X11R6/include QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib +QMAKE_INCDIR_OPENGL_ES1 = $$QMAKE_INCDIR_OPENGL +QMAKE_LIBDIR_OPENGL_ES1 = $$QMAKE_LIBDIR_OPENGL +QMAKE_INCDIR_OPENGL_ES1CL = $$QMAKE_INCDIR_OPENGL +QMAKE_LIBDIR_OPENGL_ES1CL = $$QMAKE_LIBDIR_OPENGL +QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL +QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL QMAKE_INCDIR_EGL = QMAKE_LIBDIR_EGL = QMAKE_INCDIR_OPENVG = @@ -26,6 +32,9 @@ QMAKE_LIBS_NIS = -lnsl QMAKE_LIBS_EGL = -lEGL QMAKE_LIBS_OPENGL = -lGLU -lGL QMAKE_LIBS_OPENGL_QT = -lGL +QMAKE_LIBS_OPENGL_ES1 = -lGLES_CM +QMAKE_LIBS_OPENGL_ES1CL = -lGLES_CL +QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 QMAKE_LIBS_OPENVG = -lOpenVG QMAKE_LIBS_THREAD = -lpthread diff --git a/mkspecs/common/wince/qmake.conf b/mkspecs/common/wince/qmake.conf index d6e4ba7..d87be02 100644 --- a/mkspecs/common/wince/qmake.conf +++ b/mkspecs/common/wince/qmake.conf @@ -64,6 +64,10 @@ QMAKE_LIBS_NETWORK = ws2.lib QMAKE_LIBS_OPENGL = QMAKE_LIBS_COMPAT = +QMAKE_LIBS_OPENGL_ES1 = libGLES_CM.lib +QMAKE_LIBS_OPENGL_ES1CL = libGLES_CL.lib +QMAKE_LIBS_OPENGL_ES2 = libGLESv2.lib + QMAKE_LIBS_QT_ENTRY = -lqtmain QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 7f7d882..af93f11 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -36,7 +36,7 @@ INCLUDEPATH = $$QMAKE_INCDIR_QT $$INCLUDEPATH #prepending prevents us from picki win32:INCLUDEPATH += $$QMAKE_INCDIR_QT/ActiveQt # As order does matter for static libs, we reorder the QT variable here -TMPLIBS = webkit phonon multimedia dbus testlib script scripttools svg qt3support sql xmlpatterns xml egl opengl openvg gui network core +TMPLIBS = declarative webkit phonon multimedia dbus testlib script scripttools svg qt3support sql xmlpatterns xml egl opengl openvg gui network core for(QTLIB, $$list($$TMPLIBS)) { contains(QT, $$QTLIB): QT_ORDERED += $$QTLIB } @@ -169,6 +169,7 @@ for(QTLIB, $$list($$lower($$unique(QT)))) { symbian:isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x040000 0x1600000 } else:isEqual(QTLIB, webkit):qlib = QtWebKit + else:isEqual(QTLIB, declarative):qlib = QtDeclarative else:isEqual(QTLIB, multimedia):qlib = QtMultimedia else:message("Unknown QT: $$QTLIB"):qlib = !isEmpty(qlib) { diff --git a/mkspecs/features/unix/opengl.prf b/mkspecs/features/unix/opengl.prf index 2fdf324..f2db819 100644 --- a/mkspecs/features/unix/opengl.prf +++ b/mkspecs/features/unix/opengl.prf @@ -1,4 +1,22 @@ -INCLUDEPATH += $$QMAKE_INCDIR_OPENGL -!isEmpty(QMAKE_LIBDIR_OPENGL):QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL -target_qt:LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_QT -else:LIBS += $$QMAKE_LIBS_OPENGL +contains(QT_CONFIG, opengles1) { + INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES1 + !isEmpty(QMAKE_LIBDIR_OPENGL_ES1):QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES1 + target_qt:LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1 + else:LIBS += $$QMAKE_LIBS_OPENGL_ES1 +} else:contains(QT_CONFIG, opengles1cl) { + INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES1CL + !isEmpty(QMAKE_LIBDIR_OPENGL_ES1CL):QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES1CL + target_qt:LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1CL + else:LIBS += $$QMAKE_LIBS_OPENGL_ES1CL +} else:contains(QT_CONFIG, opengles2) { + INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 + !isEmpty(QMAKE_LIBDIR_OPENGL_ES2):QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2 + target_qt:LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES2 + else:LIBS += $$QMAKE_LIBS_OPENGL_ES2 +} else { + INCLUDEPATH += $$QMAKE_INCDIR_OPENGL + !isEmpty(QMAKE_LIBDIR_OPENGL):QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL + target_qt:LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_QT + else:LIBS += $$QMAKE_LIBS_OPENGL +} + diff --git a/src/3rdparty/phonon/gstreamer/abstractrenderer.cpp b/src/3rdparty/phonon/gstreamer/abstractrenderer.cpp index 924b611..5d88d10 100644 --- a/src/3rdparty/phonon/gstreamer/abstractrenderer.cpp +++ b/src/3rdparty/phonon/gstreamer/abstractrenderer.cpp @@ -17,6 +17,7 @@ #include "abstractrenderer.h" +#ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE namespace Phonon @@ -52,5 +53,5 @@ void AbstractRenderer::movieSizeChanged(const QSize &size) } //namespace Phonon::Gstreamer QT_END_NAMESPACE - +#endif //QT_NO_PHONON_VIDEO diff --git a/src/3rdparty/phonon/gstreamer/abstractrenderer.h b/src/3rdparty/phonon/gstreamer/abstractrenderer.h index 140413d..10a2822 100644 --- a/src/3rdparty/phonon/gstreamer/abstractrenderer.h +++ b/src/3rdparty/phonon/gstreamer/abstractrenderer.h @@ -23,6 +23,7 @@ #include "medianode.h" #include <phonon/videowidget.h> +#ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE class QString; @@ -58,5 +59,5 @@ protected: } //namespace Phonon::Gstreamer QT_END_NAMESPACE - +#endif //QT_NO_PHONON_VIDEO #endif // Phonon_GSTREAMER_ABSTRACTRENDERER_H diff --git a/src/3rdparty/phonon/gstreamer/artssink.cpp b/src/3rdparty/phonon/gstreamer/artssink.cpp index ff56da9..441607d 100644 --- a/src/3rdparty/phonon/gstreamer/artssink.cpp +++ b/src/3rdparty/phonon/gstreamer/artssink.cpp @@ -233,7 +233,7 @@ static void arts_sink_init (ArtsSink * src, ArtsSinkClass * g_class) Q_UNUSED(g_class); GST_DEBUG_OBJECT (src, "initializing artssink"); src->stream = 0; - +#ifndef QT_NO_LIBRARY p_arts_init = (Ptr_arts_init)QLibrary::resolve(QLatin1String("artsc"), 0, "arts_init"); p_arts_play_stream = (Ptr_arts_play_stream)QLibrary::resolve(QLatin1String("artsc"), 0, "arts_play_stream"); p_arts_close_stream = (Ptr_arts_close_stream)QLibrary::resolve(QLatin1String("artsc"), 0, "arts_close_stream"); @@ -250,6 +250,7 @@ static void arts_sink_init (ArtsSink * src, ArtsSinkClass * g_class) } } sinkCount ++; +#endif //QT_NO_LIBRARY } static void arts_sink_dispose (GObject * object) diff --git a/src/3rdparty/phonon/gstreamer/audioeffect.cpp b/src/3rdparty/phonon/gstreamer/audioeffect.cpp index db72c8b..d3d7a35 100644 --- a/src/3rdparty/phonon/gstreamer/audioeffect.cpp +++ b/src/3rdparty/phonon/gstreamer/audioeffect.cpp @@ -23,7 +23,7 @@ #include "gsthelper.h" #include <gst/gst.h> - +#ifndef QT_NO_PHONON_EFFECT QT_BEGIN_NAMESPACE namespace Phonon @@ -75,4 +75,5 @@ GstElement* AudioEffect::createEffectBin() } //namespace Phonon::Gstreamer QT_END_NAMESPACE +#endif //QT_NO_PHONON_EFFECT #include "moc_audioeffect.cpp" diff --git a/src/3rdparty/phonon/gstreamer/audioeffect.h b/src/3rdparty/phonon/gstreamer/audioeffect.h index 3a985e5..f49f8d2 100644 --- a/src/3rdparty/phonon/gstreamer/audioeffect.h +++ b/src/3rdparty/phonon/gstreamer/audioeffect.h @@ -29,8 +29,8 @@ #include <gst/gst.h> +#ifndef QT_NO_PHONON_EFFECT QT_BEGIN_NAMESPACE - namespace Phonon { namespace Gstreamer @@ -49,7 +49,7 @@ namespace Gstreamer QString m_effectName; }; }} //namespace Phonon::Gstreamer - QT_END_NAMESPACE +#endif //QT_NO_PHONON_EFFECT #endif // Phonon_GSTREAMER_AUDIOEFFECT_H diff --git a/src/3rdparty/phonon/gstreamer/backend.cpp b/src/3rdparty/phonon/gstreamer/backend.cpp index cd49454..e1ffd1f 100644 --- a/src/3rdparty/phonon/gstreamer/backend.cpp +++ b/src/3rdparty/phonon/gstreamer/backend.cpp @@ -55,12 +55,13 @@ Backend::Backend(QObject *parent, const QVariantList &) g_error_free(err); qRegisterMetaType<Message>("Message"); - +#ifndef QT_NO_PROPERTIES setProperty("identifier", QLatin1String("phonon_gstreamer")); setProperty("backendName", QLatin1String("Gstreamer")); setProperty("backendComment", QLatin1String("Gstreamer plugin for Phonon")); setProperty("backendVersion", QLatin1String("0.2")); setProperty("backendWebsite", QLatin1String("http://qt.nokia.com/")); +#endif //QT_NO_PROPERTIES //check if we should enable debug output QString debugLevelString = qgetenv("PHONON_GST_DEBUG"); @@ -117,13 +118,15 @@ QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const m_audioOutputs.append(ao); return ao; } +#ifndef QT_NO_PHONON_EFFECT case EffectClass: return new AudioEffect(this, args[0].toInt(), parent); - +#endif //QT_NO_PHONON_EFFECT case AudioDataOutputClass: logMessage("createObject() : AudioDataOutput not implemented"); break; +#ifndef QT_NO_PHONON_VIDEO case VideoDataOutputClass: logMessage("createObject() : VideoDataOutput not implemented"); break; @@ -132,9 +135,11 @@ QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QWidget *widget = qobject_cast<QWidget*>(parent); return new VideoWidget(this, widget); } - +#endif //QT_NO_PHONON_VIDEO +#ifndef QT_NO_PHONON_VOLUMEFADEREFFECT case VolumeFaderEffectClass: return new VolumeFaderEffect(this, parent); +#endif //QT_NO_PHONON_VOLUMEFADEREFFECT case VisualizationClass: //Fall through default: diff --git a/src/3rdparty/phonon/gstreamer/devicemanager.cpp b/src/3rdparty/phonon/gstreamer/devicemanager.cpp index 2240396..60e860f 100644 --- a/src/3rdparty/phonon/gstreamer/devicemanager.cpp +++ b/src/3rdparty/phonon/gstreamer/devicemanager.cpp @@ -72,18 +72,21 @@ DeviceManager::DeviceManager(Backend *backend) : QObject(backend) , m_backend(backend) { + m_audioSink = qgetenv("PHONON_GST_AUDIOSINK"); + m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE"); + +#ifndef QT_NO_SETTINGS QSettings settings(QLatin1String("Trolltech")); settings.beginGroup(QLatin1String("Qt")); - m_audioSink = qgetenv("PHONON_GST_AUDIOSINK"); if (m_audioSink.isEmpty()) { m_audioSink = settings.value(QLatin1String("audiosink"), "Auto").toByteArray().toLower(); } - m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE"); if (m_videoSinkWidget.isEmpty()) { m_videoSinkWidget = settings.value(QLatin1String("videomode"), "Auto").toByteArray().toLower(); } +#endif //QT_NO_SETTINGS if (m_backend->isValid()) updateDeviceList(); @@ -243,6 +246,7 @@ GstElement *DeviceManager::createAudioSink(Category category) return sink; } +#ifndef QT_NO_PHONON_VIDEO AbstractRenderer *DeviceManager::createVideoRenderer(VideoWidget *parent) { #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES) @@ -265,6 +269,7 @@ AbstractRenderer *DeviceManager::createVideoRenderer(VideoWidget *parent) #endif return new WidgetRenderer(parent); } +#endif //QT_NO_PHONON_VIDEO /* * Returns a positive device id or -1 if device diff --git a/src/3rdparty/phonon/gstreamer/effect.cpp b/src/3rdparty/phonon/gstreamer/effect.cpp index f653535..4937246 100644 --- a/src/3rdparty/phonon/gstreamer/effect.cpp +++ b/src/3rdparty/phonon/gstreamer/effect.cpp @@ -25,8 +25,8 @@ #include <gst/gst.h> +#ifndef QT_NO_PHONON_EFFECT QT_BEGIN_NAMESPACE - namespace Phonon { namespace Gstreamer @@ -241,6 +241,6 @@ void Effect::setParameterValue(const EffectParameter &p, const QVariant &v) } } //namespace Phonon::Gstreamer - QT_END_NAMESPACE +#endif //QT_NO_PHONON_EFFECT #include "moc_effect.cpp" diff --git a/src/3rdparty/phonon/gstreamer/effect.h b/src/3rdparty/phonon/gstreamer/effect.h index dbbb457..51cbe9c 100644 --- a/src/3rdparty/phonon/gstreamer/effect.h +++ b/src/3rdparty/phonon/gstreamer/effect.h @@ -28,8 +28,8 @@ #include <gst/gst.h> +#ifndef QT_NO_PHONON_EFFECT QT_BEGIN_NAMESPACE - namespace Phonon { namespace Gstreamer @@ -58,7 +58,7 @@ namespace Gstreamer QList<Phonon::EffectParameter> m_parameterList; }; }} //namespace Phonon::Gstreamer - QT_END_NAMESPACE +#endif //QT_NO_PHONON_EFFECT #endif // Phonon_GSTREAMER_EFFECT_H diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.cpp b/src/3rdparty/phonon/gstreamer/mediaobject.cpp index 5dcbd42..5713263 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.cpp +++ b/src/3rdparty/phonon/gstreamer/mediaobject.cpp @@ -87,7 +87,7 @@ MediaObject::MediaObject(Backend *backend, QObject *parent) m_name = "MediaObject" + QString::number(count++); if (!m_backend->isValid()) { - setError(tr("Cannot start playback. \n\nCheck your Gstreamer installation and make sure you " + setError(tr("Cannot start playback. \n\nCheck your GStreamer installation and make sure you " "\nhave libgstreamer-plugins-base installed."), Phonon::FatalError); } else { m_root = this; @@ -226,6 +226,7 @@ void MediaObject::cb_unknown_type (GstElement *decodebin, GstPad *pad, GstCaps * QString value = "unknown codec"; // These functions require GStreamer > 0.10.12 +#ifndef QT_NO_LIBRARY static Ptr_gst_pb_utils_init p_gst_pb_utils_init = 0; static Ptr_gst_pb_utils_get_codec_description p_gst_pb_utils_get_codec_description = 0; if (!p_gst_pb_utils_init) { @@ -239,10 +240,13 @@ void MediaObject::cb_unknown_type (GstElement *decodebin, GstPad *pad, GstCaps * codecName = p_gst_pb_utils_get_codec_description (caps); value = QString::fromUtf8(codecName); g_free (codecName); - } else { + } else +#endif //QT_NO_LIBRARY + { // For GStreamer versions < 0.10.12 GstStructure *str = gst_caps_get_structure (caps, 0); value = QString::fromUtf8(gst_structure_get_name (str)); + } media->addMissingCodecName(value); } @@ -392,6 +396,7 @@ bool MediaObject::createPipefromURL(const QUrl &url) */ bool MediaObject::createPipefromStream(const MediaSource &source) { +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM // Remove any existing data source if (m_datasource) { gst_bin_remove(GST_BIN(m_pipeline), m_datasource); @@ -413,6 +418,10 @@ bool MediaObject::createPipefromStream(const MediaSource &source) return false; } return true; +#else //QT_NO_PHONON_ABSTRACTMEDIASTREAM + Q_UNUSED(source); + return false; +#endif } void MediaObject::createPipeline() diff --git a/src/3rdparty/phonon/gstreamer/phononsrc.cpp b/src/3rdparty/phonon/gstreamer/phononsrc.cpp index f893fb5..97d7220 100644 --- a/src/3rdparty/phonon/gstreamer/phononsrc.cpp +++ b/src/3rdparty/phonon/gstreamer/phononsrc.cpp @@ -109,18 +109,25 @@ static void phonon_src_class_init (PhononSrcClass * klass) static void phonon_src_init (PhononSrc * src, PhononSrcClass * g_class) { Q_UNUSED(g_class); +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM src->device = 0; +#else + Q_UNUSED(src); +#endif } static void phonon_src_finalize (GObject * object) { +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM PhononSrc *src; src = GST_PHONON_SRC (object); delete src->device; src->device = 0; +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM G_OBJECT_CLASS (parent_class)->finalize (object); } +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM static gboolean phonon_src_set_device(PhononSrc * src, StreamReader* device) { GstState state; @@ -145,6 +152,7 @@ wrong_state: return FALSE; } } +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM static void phonon_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { @@ -153,6 +161,7 @@ static void phonon_src_set_property (GObject * object, guint prop_id, const GVal src = GST_PHONON_SRC (object); switch (prop_id) { +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM case ARG_PHONONSRC: { StreamReader *dev = (StreamReader*)(g_value_get_pointer(value)); @@ -160,6 +169,9 @@ static void phonon_src_set_property (GObject * object, guint prop_id, const GVal phonon_src_set_device(src, dev); break; } +#else + Q_UNUSED(value); +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -174,9 +186,13 @@ static void phonon_src_get_property (GObject * object, guint prop_id, GValue * v src = GST_PHONON_SRC (object); switch (prop_id) { +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM case ARG_PHONONSRC: g_value_set_pointer(value, src->device); break; +#else //QT_NO_PHONON_ABSTRACTMEDIASTREAM + Q_UNUSED(value); +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -185,6 +201,7 @@ static void phonon_src_get_property (GObject * object, guint prop_id, GValue * v static GstFlowReturn phonon_src_create_read (PhononSrc * src, guint64 offset, guint length, GstBuffer ** buffer) { +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM Q_ASSERT(src->device); if (!src->device) return GST_FLOW_ERROR; @@ -204,6 +221,13 @@ static GstFlowReturn phonon_src_create_read (PhononSrc * src, guint64 offset, gu gst_mini_object_unref(GST_MINI_OBJECT(buf)); return GST_FLOW_ERROR; +#else //QT_NO_PHONON_ABSTRACTMEDIASTREAM + Q_UNUSED(src); + Q_UNUSED(offset); + Q_UNUSED(length); + Q_UNUSED(buffer); + return GST_FLOW_ERROR; +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM } static GstFlowReturn phonon_src_create (GstBaseSrc * basesrc, guint64 offset, guint length, GstBuffer ** buffer) @@ -218,19 +242,23 @@ static GstFlowReturn phonon_src_create (GstBaseSrc * basesrc, guint64 offset, gu static gboolean phonon_src_is_seekable (GstBaseSrc * basesrc) { PhononSrc *src = GST_PHONON_SRC (basesrc); +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM if (src->device) return src->device->streamSeekable(); +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM return false; } static gboolean phonon_src_get_size (GstBaseSrc * basesrc, guint64 * size) { +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM PhononSrc *src; src = GST_PHONON_SRC (basesrc); if (src->device && src->device->streamSeekable()) { *size = src->device->streamSize(); return TRUE; } +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM *size = 0; return FALSE; } diff --git a/src/3rdparty/phonon/gstreamer/phononsrc.h b/src/3rdparty/phonon/gstreamer/phononsrc.h index a2cd8b3..a50f8a2 100644 --- a/src/3rdparty/phonon/gstreamer/phononsrc.h +++ b/src/3rdparty/phonon/gstreamer/phononsrc.h @@ -49,7 +49,9 @@ typedef struct _PhononSrcClass PhononSrcClass; // PhononSrc: struct _PhononSrc { GstBaseSrc element; +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM StreamReader *device; +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM }; struct _PhononSrcClass { diff --git a/src/3rdparty/phonon/gstreamer/streamreader.cpp b/src/3rdparty/phonon/gstreamer/streamreader.cpp index 04fa6cc..f8219e6 100644 --- a/src/3rdparty/phonon/gstreamer/streamreader.cpp +++ b/src/3rdparty/phonon/gstreamer/streamreader.cpp @@ -20,7 +20,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <phonon/streaminterface.h> QT_BEGIN_NAMESPACE - +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM namespace Phonon { namespace Gstreamer @@ -49,5 +49,6 @@ bool StreamReader::read(quint64 pos, int length, char * buffer) } } +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/gstreamer/streamreader.h b/src/3rdparty/phonon/gstreamer/streamreader.h index c2e61c8..387370c 100644 --- a/src/3rdparty/phonon/gstreamer/streamreader.h +++ b/src/3rdparty/phonon/gstreamer/streamreader.h @@ -23,6 +23,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. QT_BEGIN_NAMESPACE +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM + namespace Phonon { class MediaSource; @@ -91,6 +93,8 @@ private: } } +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM + QT_END_NAMESPACE #endif diff --git a/src/3rdparty/phonon/gstreamer/videowidget.cpp b/src/3rdparty/phonon/gstreamer/videowidget.cpp index efc750a..e1f0ec9 100644 --- a/src/3rdparty/phonon/gstreamer/videowidget.cpp +++ b/src/3rdparty/phonon/gstreamer/videowidget.cpp @@ -33,6 +33,7 @@ #include "widgetrenderer.h" #include "x11renderer.h" +#ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE namespace Phonon @@ -383,5 +384,6 @@ void VideoWidget::mediaNodeEvent(const MediaNodeEvent *event) } //namespace Phonon::Gstreamer QT_END_NAMESPACE +#endif //QT_NO_PHONON_VIDEO #include "moc_videowidget.cpp" diff --git a/src/3rdparty/phonon/gstreamer/videowidget.h b/src/3rdparty/phonon/gstreamer/videowidget.h index a0ebe5f..dc0754d 100644 --- a/src/3rdparty/phonon/gstreamer/videowidget.h +++ b/src/3rdparty/phonon/gstreamer/videowidget.h @@ -28,6 +28,7 @@ #include <gst/gst.h> +#ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE class QString; @@ -102,5 +103,5 @@ private: } //namespace Phonon::Gstreamer QT_END_NAMESPACE - +#endif //QT_NO_PHONON_VIDEO #endif // Phonon_GSTREAMER_VIDEOWIDGET_H diff --git a/src/3rdparty/phonon/gstreamer/volumefadereffect.cpp b/src/3rdparty/phonon/gstreamer/volumefadereffect.cpp index d7ee11b..bf0d646 100644 --- a/src/3rdparty/phonon/gstreamer/volumefadereffect.cpp +++ b/src/3rdparty/phonon/gstreamer/volumefadereffect.cpp @@ -21,11 +21,11 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_PHONON_VOLUMEFADEREFFECT namespace Phonon { namespace Gstreamer { - VolumeFaderEffect::VolumeFaderEffect(Backend *backend, QObject *parent) : Effect(backend, parent, AudioSource | AudioSink) , m_fadeCurve(Phonon::VolumeFaderEffect::Fade3Decibel) @@ -156,7 +156,7 @@ bool VolumeFaderEffect::event(QEvent *event) } }} //namespace Phonon::Gstreamer - +#endif //QT_NO_PHONON_VOLUMEFADEREFFECT QT_END_NAMESPACE #include "moc_volumefadereffect.cpp" diff --git a/src/3rdparty/phonon/gstreamer/volumefadereffect.h b/src/3rdparty/phonon/gstreamer/volumefadereffect.h index d74014c..748d2d6 100644 --- a/src/3rdparty/phonon/gstreamer/volumefadereffect.h +++ b/src/3rdparty/phonon/gstreamer/volumefadereffect.h @@ -30,7 +30,7 @@ #include <gst/gst.h> QT_BEGIN_NAMESPACE - +#ifndef QT_NO_PHONON_VOLUMEFADEREFFECT namespace Phonon { namespace Gstreamer @@ -64,7 +64,7 @@ namespace Gstreamer QTime m_fadeStartTime; }; }} //namespace Phonon::Gstreamer - +#endif //QT_NO_PHONON_VOLUMEFADEREFFECT QT_END_NAMESPACE #endif // Phonon_GSTREAMER_VOLUMEFADEREFFECT_H diff --git a/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp b/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp index d4a411f..423af9d 100644 --- a/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp +++ b/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp @@ -32,6 +32,7 @@ # define GL_TEXTURE2 0x84C2 #endif +#ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE static void frameRendered() @@ -148,3 +149,4 @@ bool WidgetRenderer::eventFilter(QEvent * event) } //namespace Phonon::Gstreamer QT_END_NAMESPACE +#endif //QT_NO_PHONON_VIDEO diff --git a/src/3rdparty/phonon/gstreamer/widgetrenderer.h b/src/3rdparty/phonon/gstreamer/widgetrenderer.h index ff64fa7..03ee9c0 100644 --- a/src/3rdparty/phonon/gstreamer/widgetrenderer.h +++ b/src/3rdparty/phonon/gstreamer/widgetrenderer.h @@ -26,6 +26,7 @@ #include <QtOpenGL/QGLWidget> #endif +#ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE class QString; @@ -59,5 +60,5 @@ private: } //namespace Phonon::Gstreamer QT_END_NAMESPACE - +#endif //QT_NO_PHONON_VIDEO #endif // Phonon_GSTREAMER_WIDGETRENDERER_H diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index 214baa0..e9c5e27 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -62,9 +62,9 @@ QHash<QByteArray, QVariant> EffectFactory::audioEffectDescriptions(AbstractAudio switch (type) { case AbstractAudioEffect::EffectAudioEqualizer: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "audio equalizer"), "Audio equalizer."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Audio Equalizer"), "Audio equalizer."); case AbstractAudioEffect::EffectBassBoost: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Bass boost"), "Bass boost."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Bass Boost"), "Bass boost."); case AbstractAudioEffect::EffectDistanceAttenuation: return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Distance Attenuation"), "Distance Attenuation."); case AbstractAudioEffect::EffectEnvironmentalReverb: diff --git a/src/3rdparty/phonon/phonon/factory.cpp b/src/3rdparty/phonon/phonon/factory.cpp index 5c3752a..d5010e7 100644 --- a/src/3rdparty/phonon/phonon/factory.cpp +++ b/src/3rdparty/phonon/phonon/factory.cpp @@ -111,6 +111,7 @@ void Factory::setBackend(QObject *b) bool FactoryPrivate::createBackend() { +#ifndef QT_NO_LIBRARY Q_ASSERT(m_backendObject == 0); #ifndef QT_NO_PHONON_PLATFORMPLUGIN PlatformPlugin *f = globalFactory->platformPlugin(); @@ -186,14 +187,20 @@ bool FactoryPrivate::createBackend() SLOT(objectDescriptionChanged(ObjectDescriptionType))); return true; +#else //QT_NO_LIBRARY + pWarning() << Q_FUNC_INFO << "Trying to use Phonon with QT_NO_LIBRARY defined. " + "That is currently not supported"; + return false; +#endif } FactoryPrivate::FactoryPrivate() + : #ifndef QT_NO_PHONON_PLATFORMPLUGIN - : m_platformPlugin(0), - m_noPlatformPlugin(false) + m_platformPlugin(0), + m_noPlatformPlugin(false), #endif //QT_NO_PHONON_PLATFORMPLUGIN - , m_backendObject(0) + m_backendObject(0) { // Add the post routine to make sure that all other global statics (especially the ones from Qt) // are still available. If the FactoryPrivate dtor is called too late many bad things can happen @@ -442,6 +449,7 @@ QObject *Factory::backend(bool createWhenNull) return globalFactory->m_backendObject; } +#ifndef QT_NO_PROPERTIES #define GET_STRING_PROPERTY(name) \ QString Factory::name() \ { \ @@ -457,7 +465,7 @@ GET_STRING_PROPERTY(backendComment) GET_STRING_PROPERTY(backendVersion) GET_STRING_PROPERTY(backendIcon) GET_STRING_PROPERTY(backendWebsite) - +#endif //QT_NO_PROPERTIES QObject *Factory::registerQObject(QObject *o) { if (o) { diff --git a/src/3rdparty/phonon/phonon/globalconfig.cpp b/src/3rdparty/phonon/phonon/globalconfig.cpp index d13e491..3718c6a 100644 --- a/src/3rdparty/phonon/phonon/globalconfig.cpp +++ b/src/3rdparty/phonon/phonon/globalconfig.cpp @@ -38,7 +38,10 @@ QT_BEGIN_NAMESPACE namespace Phonon { -GlobalConfig::GlobalConfig() : m_config(QLatin1String("kde.org"), QLatin1String("libphonon")) +GlobalConfig::GlobalConfig() +#ifndef QT_NO_SETTINGS + : m_config(QLatin1String("kde.org"), QLatin1String("libphonon")) +#endif //QT_NO_SETTINGS { } @@ -82,6 +85,7 @@ static void filter(ObjectDescriptionType type, BackendInterface *backendIface, Q } } +#ifndef QT_NO_PHONON_SETTINGSGROUP static QList<int> listSortedByConfig(const QSettingsGroup &backendConfig, Phonon::Category category, QList<int> &defaultList) { if (defaultList.size() <= 1) { @@ -126,7 +130,9 @@ static QList<int> listSortedByConfig(const QSettingsGroup &backendConfig, Phonon return deviceList; } +#endif //QT_NO_PHONON_SETTINGSGROUP +#ifndef QT_NO_PHONON_SETTINGSGROUP QList<int> GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, int override) const { //The devices need to be stored independently for every backend @@ -172,7 +178,7 @@ QList<int> GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, int return listSortedByConfig(backendConfig, category, defaultList); } - +#endif //QT_NO_SETTINGSGROUPS int GlobalConfig::audioOutputDeviceFor(Phonon::Category category, int override) const { QList<int> ret = audioOutputDeviceListFor(category, override); @@ -184,6 +190,7 @@ int GlobalConfig::audioOutputDeviceFor(Phonon::Category category, int override) #ifndef QT_NO_PHONON_AUDIOCAPTURE QList<int> GlobalConfig::audioCaptureDeviceListFor(Phonon::Category category, int override) const { +#ifndef QT_NO_PHONON_SETTINGSGROUP //The devices need to be stored independently for every backend const QSettingsGroup backendConfig(&m_config, QLatin1String("AudioCaptureDevice")); // + Factory::identifier()); const QSettingsGroup generalGroup(&m_config, QLatin1String("General")); @@ -226,6 +233,9 @@ QList<int> GlobalConfig::audioCaptureDeviceListFor(Phonon::Category category, in } return listSortedByConfig(backendConfig, category, defaultList); +#else //QT_NO_SETTINGSGROUP + return QList<int>(); +#endif //QT_NO_SETTINGSGROUP } int GlobalConfig::audioCaptureDeviceFor(Phonon::Category category, int override) const diff --git a/src/3rdparty/phonon/phonon/globalconfig_p.h b/src/3rdparty/phonon/phonon/globalconfig_p.h index 023858f..034bce3 100644 --- a/src/3rdparty/phonon/phonon/globalconfig_p.h +++ b/src/3rdparty/phonon/phonon/globalconfig_p.h @@ -46,7 +46,9 @@ namespace Phonon AdvancedDevicesFromSettings = 2, HideUnavailableDevices = 4 }; +#ifndef QT_NO_PHONON_SETTINGSGROUP QList<int> audioOutputDeviceListFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const; +#endif //QT_NO_PHONON_SETTINGSGROUP int audioOutputDeviceFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const; #ifndef QT_NO_PHONON_AUDIOCAPTURE @@ -55,7 +57,9 @@ namespace Phonon #endif //QT_NO_PHONON_AUDIOCAPTURE protected: +#ifndef QT_NO_SETTINGS QSettings m_config; +#endif //QT_NO_SETTINGS }; } // namespace Phonon diff --git a/src/3rdparty/phonon/phonon/qsettingsgroup_p.h b/src/3rdparty/phonon/phonon/qsettingsgroup_p.h index 95f6c9b..501fe37 100644 --- a/src/3rdparty/phonon/phonon/qsettingsgroup_p.h +++ b/src/3rdparty/phonon/phonon/qsettingsgroup_p.h @@ -27,6 +27,8 @@ #include <QtCore/QString> #include <QtCore/QVariant> +#ifndef QT_NO_PHONON_SETTINGSGROUP + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -87,5 +89,6 @@ class QSettingsGroup QT_END_NAMESPACE QT_END_HEADER +#endif //QT_NO_PHONON_SETTINGSGROUP #endif // PHONON_QSETTINGSGROUP_P_H diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index fb7dddf..dc43e0e 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,45 @@ +2009-10-26 Holger Hans Peter Freyther <zecke@selfish.org> + + Rubber-stamped by Darin Adler. + + Export fastMalloc, fastCalloc, fastRealloc and fastFree + https://bugs.webkit.org/show_bug.cgi?id=30769 + + Export the FastMalloc functions outside of the libwebkit library + to be able to instrument memory allocations. These are C++ symbols + but do not require the C++ runtime to be useful and should be of + no harm to plain C code. + + * autotools/symbols.filter: + +2009-10-26 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Jan Alonzo. + + Alternative solution to regression introduced in r48672. + + * GNUmakefile.am: + +2009-10-26 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Update for 1.1.16 release. + + * configure.ac: + +2009-10-24 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Holger Freyther. + + [Qt] [Symbian] Set the capability and memory required to run QtWebKit for Symbian + https://bugs.webkit.org/show_bug.cgi?id=30476 + + Set the stack size to 80 Kb and heap size to the 128kB - 32MB range + to all executables linking against WebKit library. + + * WebKit.pri: + 2009-10-18 Jan Michael Alonzo <jmalonzo@webkit.org> Reviewed by Holger Freyther. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 8d6c2df..e6ab073 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,527 @@ +2009-10-29 Gabor Loki <loki@inf.u-szeged.hu> + + Reviewed by Gavin Barraclough. + + Add cacheFlush support for Thumb-2 on Linux + https://bugs.webkit.org/show_bug.cgi?id=30865 + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + +2009-10-28 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + JSC JIT on ARMv7 cannot link jumps >16Mb range + https://bugs.webkit.org/show_bug.cgi?id=30891 + + Start planing all relative jumps as move-32-bit-immediate-to-register-BX. + In the cases where the jump would fall within a relative jump range, use a relative jump. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * assembler/ARMv7Assembler.h: + (JSC::ARMv7Assembler::~ARMv7Assembler): + (JSC::ARMv7Assembler::LinkRecord::LinkRecord): + (JSC::ARMv7Assembler::): + (JSC::ARMv7Assembler::executableCopy): + (JSC::ARMv7Assembler::linkJump): + (JSC::ARMv7Assembler::relinkJump): + (JSC::ARMv7Assembler::setInt32): + (JSC::ARMv7Assembler::isB): + (JSC::ARMv7Assembler::isBX): + (JSC::ARMv7Assembler::isMOV_imm_T3): + (JSC::ARMv7Assembler::isMOVT): + (JSC::ARMv7Assembler::isNOP_T1): + (JSC::ARMv7Assembler::isNOP_T2): + (JSC::ARMv7Assembler::linkJumpAbsolute): + (JSC::ARMv7Assembler::twoWordOp5i6Imm4Reg4EncodedImmFirst): + (JSC::ARMv7Assembler::twoWordOp5i6Imm4Reg4EncodedImmSecond): + (JSC::ARMv7Assembler::ARMInstructionFormatter::twoWordOp5i6Imm4Reg4EncodedImm): + * assembler/MacroAssemblerARMv7.h: + (JSC::MacroAssemblerARMv7::makeJump): + (JSC::MacroAssemblerARMv7::makeBranch): + * jit/JIT.h: + * wtf/Platform.h: + +2009-10-28 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoff Garen. + + Improve for..in enumeration performance + https://bugs.webkit.org/show_bug.cgi?id=30887 + + Improve indexing of an object with a for..in iterator by + identifying cases where get_by_val is being used with a iterator + as the subscript and replace it with a new get_by_pname + bytecode. get_by_pname then optimizes lookups that directly access + the base object. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): + * bytecode/Opcode.h: + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitGetByVal): + * bytecompiler/BytecodeGenerator.h: + (JSC::BytecodeGenerator::pushOptimisedForIn): + (JSC::BytecodeGenerator::popOptimisedForIn): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JIT.cpp: + (JSC::JIT::privateCompileMainPass): + (JSC::JIT::privateCompileSlowCases): + * jit/JIT.h: + * jit/JITPropertyAccess.cpp: + (JSC::JIT::compileGetDirectOffset): + (JSC::JIT::emit_op_get_by_pname): + (JSC::JIT::emitSlow_op_get_by_pname): + * parser/Nodes.cpp: + (JSC::ForInNode::emitBytecode): + * runtime/JSObject.h: + * runtime/JSPropertyNameIterator.cpp: + (JSC::JSPropertyNameIterator::create): + * runtime/JSPropertyNameIterator.h: + (JSC::JSPropertyNameIterator::getOffset): + (JSC::JSPropertyNameIterator::JSPropertyNameIterator): + * runtime/JSValue.h: + (JSC::JSValue::): + * runtime/Structure.cpp: + (JSC::Structure::addPropertyTransition): + (JSC::Structure::changePrototypeTransition): + (JSC::Structure::despecifyFunctionTransition): + (JSC::Structure::addAnonymousSlotsTransition): + (JSC::Structure::getterSetterTransition): + (JSC::Structure::toDictionaryTransition): + (JSC::Structure::addPropertyWithoutTransition): + Track the existence (or not) of non-enumerable properties. + * runtime/Structure.h: + (JSC::Structure::propertyStorageCapacity): + (JSC::Structure::propertyStorageSize): + (JSC::Structure::hasNonEnumerableProperties): + (JSC::Structure::hasAnonymousSlots): + +2009-10-28 Dmitry Titov <dimich@chromium.org> + + Not reviewed, attemp to fix Windows build. + + Touch the cpp file to cause recompile. + + * wtf/Threading.cpp: + (WTF::threadEntryPoint): + +2009-10-28 Dmitry Titov <dimich@chromium.org> + + Reviewed by David Levin. + + https://bugs.webkit.org/show_bug.cgi?id=30805 + Add MessageQueue::removeIf(Predicate&) to remove certain tasks without pulling them from the queue. + Existing Database tests cover this since Database removes tasks when it is stopped. + + * wtf/MessageQueue.h: + (WTF::::removeIf): + +2009-10-28 Afonso R. Costa Jr. <afonso.costa@openbossa.org> + + Reviewed by Oliver Hunt. + + [Qt] Enable YARR when YARR_JIT is enabled + https://bugs.webkit.org/show_bug.cgi?id=30730 + + When enabling or disabling JIT using JAVASCRIPTCORE_JIT, the ENABLE_YARR should + be toggled also. + + * JavaScriptCore.pri: + +2009-10-24 Martin Robinson <martin.james.robinson@gmail.com> + + Reviewed by Oliver Hunt. + + Fix strict aliasing warning by switching reinterpret_cast to bitwise_cast. + + strict-aliasing warnings in JSFunction.h + https://bugs.webkit.org/show_bug.cgi?id=27869 + + * runtime/JSFunction.h: + (JSC::JSFunction::nativeFunction): + (JSC::JSFunction::scopeChain): + (JSC::JSFunction::setScopeChain): + (JSC::JSFunction::setNativeFunction): + +2009-10-28 Jan-Arve Sæther <jan-arve.saether@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Build-fix for 64-bit Windows + + * wtf/Platform.h: Make sure to use WTF_USE_JSVALUE64 + +2009-10-28 Gavin Barraclough <barraclough@apple.com> + + Reviewed by NOBODY (build fix!). + + * jit/JIT.h: + +2009-10-26 Holger Hans Peter Freyther <zecke@selfish.org> + + Rubber-stamped by Darin Adler. + + Export fastMalloc, fastCalloc, fastRealloc and fastFree on GCC/Unix + https://bugs.webkit.org/show_bug.cgi?id=30769 + + When using -fvisibility=hidden to hide all internal symbols by default + the malloc symbols will be hidden as well. For memory instrumentation + it is needed to provide an instrumented version of these symbols and + override the normal routines and by changing the visibility back to + default this becomes possible. + + The only other solution would be to use system malloc instead of the + TCmalloc implementation but this will not allow to analyze memory + behavior with the default allocator. + + * wtf/FastMalloc.h: Define WTF_FAST_MALLOC_EXPORT for GCC and !darwin + +2009-10-27 Gavin Barraclough <barraclough@apple.com> + + Rubber Stamped by Samuel Q. Weinig. + + Make the asserts protecting the offsets in the JIT more descriptive. + + * jit/JIT.h: + * jit/JITCall.cpp: + (JSC::JIT::compileOpCall): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_method_check): + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::compileGetByIdSlowCase): + (JSC::JIT::emit_op_put_by_id): + +2009-10-27 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + A little bit of refactoring in the date code. + + * JavaScriptCore.exp: Don't export this unused symbol. + + * runtime/DateConstructor.cpp: + (JSC::constructDate): + + * runtime/DateInstance.cpp: + (JSC::DateInstance::DateInstance): + * runtime/DateInstance.h: Removed some unused functions. Changed the default + constructor to ensure that a DateInstance is always initialized. + + * runtime/DatePrototype.cpp: + (JSC::DatePrototype::DatePrototype): Pass an initializer to our constructor, + since it now requires one. + + * wtf/DateMath.cpp: + (WTF::msToGregorianDateTime): Only compute our offset from UTC if our + output will require it. Otherwise, our offset is 0. + +2009-10-27 Geoffrey Garen <ggaren@apple.com> + + Build fix: Mark DateInstaceCache.h private, so other frameworks can see it. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2009-10-27 Geoffrey Garen <ggaren@apple.com> + + Build fix: re-readded this file. + + * runtime/DateInstanceCache.h: Added. + (JSC::DateInstanceData::create): + (JSC::DateInstanceData::DateInstanceData): + (JSC::DateInstanceCache::DateInstanceCache): + (JSC::DateInstanceCache::add): + (JSC::DateInstanceCache::lookup): + +2009-10-27 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Darin Adler and Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=30800 + Cache recently computed date data. + + SunSpider reports a ~0.5% speedup, mostly from date-format-tofte.js. + + * GNUmakefile.am: + * JavaScriptCore.gypi: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: Added new file. + + * runtime/DateInstance.cpp: + (JSC::DateInstance::DateInstance): + (JSC::DateInstance::getGregorianDateTime): Use the shared cache. + + * runtime/DateInstance.h: Renamed m_cache to m_data, to avoid the confusion + of a "cache cache". + + * runtime/DatePrototype.cpp: + (JSC::formatLocaleDate): + (JSC::dateProtoFuncToString): + (JSC::dateProtoFuncToUTCString): + (JSC::dateProtoFuncToISOString): + (JSC::dateProtoFuncToDateString): + (JSC::dateProtoFuncToTimeString): + (JSC::dateProtoFuncGetFullYear): + (JSC::dateProtoFuncGetUTCFullYear): + (JSC::dateProtoFuncToGMTString): + (JSC::dateProtoFuncGetMonth): + (JSC::dateProtoFuncGetUTCMonth): + (JSC::dateProtoFuncGetDate): + (JSC::dateProtoFuncGetUTCDate): + (JSC::dateProtoFuncGetDay): + (JSC::dateProtoFuncGetUTCDay): + (JSC::dateProtoFuncGetHours): + (JSC::dateProtoFuncGetUTCHours): + (JSC::dateProtoFuncGetMinutes): + (JSC::dateProtoFuncGetUTCMinutes): + (JSC::dateProtoFuncGetSeconds): + (JSC::dateProtoFuncGetUTCSeconds): + (JSC::dateProtoFuncGetTimezoneOffset): + (JSC::setNewValueFromTimeArgs): + (JSC::setNewValueFromDateArgs): + (JSC::dateProtoFuncSetYear): + (JSC::dateProtoFuncGetYear): Pass an ExecState to these functions, so they + can access the DateInstanceCache. + + * runtime/JSGlobalData.h: Keep a DateInstanceCache. + +2009-10-27 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Fisher. + + Ensures that JavaScriptCore/wtf/CurrentTime.cpp is not built in PLATFORM(CHROMIUM) builds. + + Chromium uses a different method to calculate the current time than is used in + JavaScriptCore/wtf/CurrentTime.cpp. This can lead to time skew when calls to currentTime() and Chromium's time + function are mixed. In particular, timers can get scheduled in the past which leads to 100% CPU use. + See http://code.google.com/p/chromium/issues/detail?id=25892 for an example. + + https://bugs.webkit.org/show_bug.cgi?id=30833 + + * JavaScriptCore.gyp/JavaScriptCore.gyp: + * wtf/CurrentTime.cpp: + +2009-10-27 Peter Varga <pvarga@inf.u-szeged.hu> + + Rubber-stamped by Tor Arne Vestbø. + + Fix typo in RegexInterpreter.cpp and RegexJIT.cpp alterantive to + alternative. + + * yarr/RegexInterpreter.cpp: + (JSC::Yarr::ByteCompiler::alternativeBodyDisjunction): + (JSC::Yarr::ByteCompiler::alternativeDisjunction): + (JSC::Yarr::ByteCompiler::emitDisjunction): + * yarr/RegexJIT.cpp: + (JSC::Yarr::RegexGenerator::generateDisjunction): + +2009-10-26 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Darin Adler. + + Make .rc files compile on Windows without depending on MFC headers + https://bugs.webkit.org/show_bug.cgi?id=30750 + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc: Use + winresrc.h because it exists even when MFC is not installed, and is + all that's needed here. + +2009-10-26 Gabor Loki <loki@inf.u-szeged.hu> + + Reviewed by Gavin Barraclough. + + The thunkReturnAddress is on JITStackFrame on ARM JIT as well + https://bugs.webkit.org/show_bug.cgi?id=30782 + + Move the thunkReturnAddress from top of the stack into the JITStackFrame + structure. This is a requirement for JSValue32_64 support on ARM. + + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::ret): Return with link register + (JSC::MacroAssemblerARM::prepareCall): Store the return address in link register + * jit/JIT.h: Remove unused ctiReturnRegister + * jit/JITInlineMethods.h: Same as ARMv7 + (JSC::JIT::restoreArgumentReference): Ditto. + (JSC::JIT::restoreArgumentReferenceForTrampoline): Ditto. + * jit/JITOpcodes.cpp: Remove ctiReturnRegister related instruction + * jit/JITStubs.cpp: Store thunkReturnAddress on JITStackFrame. Use + small trampoline functions which handle return addresses for each + CTI_STUB_FUNCTION. + * jit/JITStubs.h: Store thunkReturnAddress on JITStackFrame + (JSC::JITStackFrame::returnAddressSlot): Return with the address of thunkReturnAddress + * yarr/RegexJIT.cpp: + (JSC::Yarr::RegexGenerator::generateEnter): Remove the unnecessary instruction + +2009-10-26 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + Adds ability to disable ReadWriteLock on platforms (eg Android) that use pthreads but do not support pthread_rwlock. + https://bugs.webkit.org/show_bug.cgi?id=30713 + + * wtf/Platform.h: Modified. Defines HAVE_PTHREAD_RWLOCK for all platforms currently using pthreads. + * wtf/Threading.h: Modified. Use pthread_rwlock_t only when HAVE_PTHREAD_RWLOCK is defined. + * wtf/ThreadingPthreads.cpp: Modified. Build ReadWriteLock methods only when HAVE_PTHREAD_RWLOCK is defined. + +2009-10-24 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Holger Freyther. + + [Qt] [Symbian] Set the capability and memory required to run QtWebKit for Symbian + https://bugs.webkit.org/show_bug.cgi?id=30476 + + Assign ReadUserData WriteUserData NetworkServices Symbian capabilities + to jsc.exe. + + * jsc.pro: + +2009-10-23 Steve Block <steveblock@google.com> + + Reviewed by Dmitry Titov. + + Fixes a leak in createThreadInternal on Android. + https://bugs.webkit.org/show_bug.cgi?id=30698 + + * wtf/ThreadingPthreads.cpp: Modified. + (WTF::createThreadInternal): Avoid leaking a ThreadData object on failure. + +2009-10-22 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Alexey Proskuryakov. + + Fixed ASSERT when opening Safari's Caches window while the Web Inspector + is open. + + * runtime/Collector.cpp: + (JSC::typeName): Added two new types to the type name list in the Collector. + These types have been around for a while, but nobody remembered to consider them here. + + * runtime/JSCell.h: + (JSC::JSCell::isPropertyNameIterator): + * runtime/JSPropertyNameIterator.h: + (JSC::JSPropertyNameIterator::isPropertyNameIterator): Give the Collector + a way to tell if a cell is a JSPropertyNameIterator. + +2009-10-22 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Jon Honeycutt. + + https://bugs.webkit.org/show_bug.cgi?id=30686 + Remove debug-specific def file. + Only Debug_All target uses JavaScriptCore_debug.dll naming, and since + that target is only used internally, maintaining two files just to + suppress a single link warning isn't worthwhile. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Removed. + +2009-10-21 Jon Honeycutt <jhoneycutt@apple.com> + + <rdar://problem/7270320> Screenshots of off-screen plug-ins are blank + <rdar://problem/7270314> After halting a transparent PluginView on + Windows, the transparency is applied twice + + Reviewed by Dan Bernstein. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + Export WTF::deleteOwnedPtr(HDC). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + Ditto. + +2009-10-20 Geoffrey Garen <ggaren@apple.com> + + Windows build fix: updated variable name. + + * runtime/DatePrototype.cpp: + (JSC::formatLocaleDate): + +2009-10-20 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Mark Rowe. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_next_pname): Slightly tweaked this #ifdef to match the + size of a JSValue because m_jsStrings is an array of JSValues. + +2009-10-20 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Mark Rowe. + + Fixed a 64-bit regression caused by the fix for + https://bugs.webkit.org/show_bug.cgi?id=30570. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_next_pname): Use TimesEight stepping on 64-bit, since + 64-bit pointers are eight bytes long. + +2009-10-20 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + Refactored DateInstance::msToGregorianDateTime so that a DateInstance's + caller doesn't need to supply the DateInstance's own internal value to + the DateInstance. + + * runtime/DateInstance.cpp: + (JSC::DateInstance::getGregorianDateTime): Renamed from "msToGregorianDateTime". + + * runtime/DateInstance.h: + * runtime/DatePrototype.cpp: + (JSC::formatLocaleDate): + (JSC::dateProtoFuncToString): + (JSC::dateProtoFuncToUTCString): + (JSC::dateProtoFuncToISOString): + (JSC::dateProtoFuncToDateString): + (JSC::dateProtoFuncToTimeString): + (JSC::dateProtoFuncToLocaleString): + (JSC::dateProtoFuncToLocaleDateString): + (JSC::dateProtoFuncToLocaleTimeString): + (JSC::dateProtoFuncGetTime): + (JSC::dateProtoFuncGetFullYear): + (JSC::dateProtoFuncGetUTCFullYear): + (JSC::dateProtoFuncToGMTString): + (JSC::dateProtoFuncGetMonth): + (JSC::dateProtoFuncGetUTCMonth): + (JSC::dateProtoFuncGetDate): + (JSC::dateProtoFuncGetUTCDate): + (JSC::dateProtoFuncGetDay): + (JSC::dateProtoFuncGetUTCDay): + (JSC::dateProtoFuncGetHours): + (JSC::dateProtoFuncGetUTCHours): + (JSC::dateProtoFuncGetMinutes): + (JSC::dateProtoFuncGetUTCMinutes): + (JSC::dateProtoFuncGetSeconds): + (JSC::dateProtoFuncGetUTCSeconds): + (JSC::dateProtoFuncGetTimezoneOffset): + (JSC::setNewValueFromTimeArgs): + (JSC::setNewValueFromDateArgs): + (JSC::dateProtoFuncSetYear): + (JSC::dateProtoFuncGetYear): Also renamed "utc" to "outputIsUTC", for clarity. + +2009-10-20 Gabor Loki <loki@inf.u-szeged.hu> + + Reviewed by Geoffrey Garen. + + The op_next_pname should use 4 bytes addressing mode in case of JSValue32 + https://bugs.webkit.org/show_bug.cgi?id=30570 + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_next_pname): + +2009-10-20 Gabor Loki <loki@inf.u-szeged.hu> + + Reviewed by Oliver Hunt. + + Move OverridesMarkChildren flag from DatePrototype to its parent class + https://bugs.webkit.org/show_bug.cgi?id=30372 + + * runtime/DateInstance.h: + (JSC::DateInstance::createStructure): + * runtime/DatePrototype.h: + 2009-10-19 Geoffrey Garen <ggaren@apple.com> Reviewed by Oliver Hunt. diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi index 4b316c8..03c23c3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi @@ -194,6 +194,7 @@ 'runtime/DateConversion.h', 'runtime/DateInstance.cpp', 'runtime/DateInstance.h', + 'runtime/DateInstanceCache.h', 'runtime/DatePrototype.cpp', 'runtime/DatePrototype.h', 'runtime/Error.cpp', diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri index 89c483e..eb26664 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri @@ -39,10 +39,12 @@ win32-* { contains(JAVASCRIPTCORE_JIT,yes) { DEFINES+=ENABLE_JIT=1 DEFINES+=ENABLE_YARR_JIT=1 + DEFINES+=ENABLE_YARR=1 } contains(JAVASCRIPTCORE_JIT,no) { DEFINES+=ENABLE_JIT=0 DEFINES+=ENABLE_YARR_JIT=0 + DEFINES+=ENABLE_YARR=0 } # In debug mode JIT disabled until crash fixed diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h index 078de44..02ce2e9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h @@ -407,6 +407,11 @@ register writeback class ARMv7Assembler { public: + ~ARMv7Assembler() + { + ASSERT(m_jumpsToLink.isEmpty()); + } + typedef ARMRegisters::RegisterID RegisterID; typedef ARMRegisters::FPRegisterID FPRegisterID; @@ -477,6 +482,17 @@ public: private: + struct LinkRecord { + LinkRecord(intptr_t from, intptr_t to) + : from(from) + , to(to) + { + } + + intptr_t from; + intptr_t to; + }; + // ARMv7, Appx-A.6.3 bool BadReg(RegisterID reg) { @@ -574,6 +590,7 @@ private: OP_SUB_SP_imm_T1 = 0xB080, OP_BKPT = 0xBE00, OP_IT = 0xBF00, + OP_NOP_T1 = 0xBF00, } OpcodeID; typedef enum { @@ -608,6 +625,7 @@ private: OP_MOV_imm_T3 = 0xF240, OP_SUB_imm_T4 = 0xF2A0, OP_MOVT = 0xF2C0, + OP_NOP_T2a = 0xF3AF, OP_LDRH_reg_T2 = 0xF830, OP_LDRH_imm_T3 = 0xF830, OP_STR_imm_T4 = 0xF840, @@ -626,6 +644,7 @@ private: typedef enum { OP_B_T4b = 0x9000, + OP_NOP_T2b = 0x8000, } OpcodeID2; struct FourFours { @@ -1481,6 +1500,15 @@ public: void* executableCopy(ExecutablePool* allocator) { void* copy = m_formatter.executableCopy(allocator); + + unsigned jumpCount = m_jumpsToLink.size(); + for (unsigned i = 0; i < jumpCount; ++i) { + uint16_t* location = reinterpret_cast<uint16_t*>(reinterpret_cast<intptr_t>(copy) + m_jumpsToLink[i].from); + uint16_t* target = reinterpret_cast<uint16_t*>(reinterpret_cast<intptr_t>(copy) + m_jumpsToLink[i].to); + linkJumpAbsolute(location, target); + } + m_jumpsToLink.clear(); + ASSERT(copy); return copy; } @@ -1503,11 +1531,7 @@ public: { ASSERT(to.m_offset != -1); ASSERT(from.m_offset != -1); - - uint16_t* location = reinterpret_cast<uint16_t*>(reinterpret_cast<intptr_t>(m_formatter.data()) + from.m_offset); - intptr_t relative = to.m_offset - from.m_offset; - - linkWithOffset(location, relative); + m_jumpsToLink.append(LinkRecord(from.m_offset, to.m_offset)); } static void linkJump(void* code, JmpSrc from, void* to) @@ -1515,9 +1539,7 @@ public: ASSERT(from.m_offset != -1); uint16_t* location = reinterpret_cast<uint16_t*>(reinterpret_cast<intptr_t>(code) + from.m_offset); - intptr_t relative = reinterpret_cast<intptr_t>(to) - reinterpret_cast<intptr_t>(location); - - linkWithOffset(location, relative); + linkJumpAbsolute(location, to); } // bah, this mathod should really be static, since it is used by the LinkBuffer. @@ -1541,10 +1563,9 @@ public: ASSERT(!(reinterpret_cast<intptr_t>(from) & 1)); ASSERT(!(reinterpret_cast<intptr_t>(to) & 1)); - intptr_t relative = reinterpret_cast<intptr_t>(to) - reinterpret_cast<intptr_t>(from); - linkWithOffset(reinterpret_cast<uint16_t*>(from), relative); + linkJumpAbsolute(reinterpret_cast<uint16_t*>(from), to); - ExecutableAllocator::cacheFlush(reinterpret_cast<uint16_t*>(from) - 2, 2 * sizeof(uint16_t)); + ExecutableAllocator::cacheFlush(reinterpret_cast<uint16_t*>(from) - 5, 5 * sizeof(uint16_t)); } static void relinkCall(void* from, void* to) @@ -1613,14 +1634,14 @@ private: static void setInt32(void* code, uint32_t value) { uint16_t* location = reinterpret_cast<uint16_t*>(code); + ASSERT(isMOV_imm_T3(location - 4) && isMOVT(location - 2)); - uint16_t lo16 = value; - uint16_t hi16 = value >> 16; - - spliceHi5(location - 4, lo16); - spliceLo11(location - 3, lo16); - spliceHi5(location - 2, hi16); - spliceLo11(location - 1, hi16); + ARMThumbImmediate lo16 = ARMThumbImmediate::makeUInt16(static_cast<uint16_t>(value)); + ARMThumbImmediate hi16 = ARMThumbImmediate::makeUInt16(static_cast<uint16_t>(value >> 16)); + location[-4] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOV_imm_T3, lo16); + location[-3] = twoWordOp5i6Imm4Reg4EncodedImmSecond((location[-3] >> 8) & 0xf, lo16); + location[-2] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOVT, hi16); + location[-1] = twoWordOp5i6Imm4Reg4EncodedImmSecond((location[-1] >> 8) & 0xf, hi16); ExecutableAllocator::cacheFlush(location - 4, 4 * sizeof(uint16_t)); } @@ -1630,41 +1651,89 @@ private: setInt32(code, reinterpret_cast<uint32_t>(value)); } - // Linking & patching: - // This method assumes that the JmpSrc being linked is a T4 b instruction. - static void linkWithOffset(uint16_t* instruction, intptr_t relative) - { - // Currently branches > 16m = mostly deathy. - if (((relative << 7) >> 7) != relative) { - // FIXME: This CRASH means we cannot turn the JIT on by default on arm-v7. - fprintf(stderr, "Error: Cannot link T4b.\n"); - CRASH(); - } - - // ARM encoding for the top two bits below the sign bit is 'peculiar'. - if (relative >= 0) - relative ^= 0xC00000; + static bool isB(void* address) + { + uint16_t* instruction = static_cast<uint16_t*>(address); + return ((instruction[0] & 0xf800) == OP_B_T4a) && ((instruction[1] & 0xd000) == OP_B_T4b); + } + + static bool isBX(void* address) + { + uint16_t* instruction = static_cast<uint16_t*>(address); + return (instruction[0] & 0xff87) == OP_BX; + } - // All branch offsets should be an even distance. - ASSERT(!(relative & 1)); + static bool isMOV_imm_T3(void* address) + { + uint16_t* instruction = static_cast<uint16_t*>(address); + return ((instruction[0] & 0xFBF0) == OP_MOV_imm_T3) && ((instruction[1] & 0x8000) == 0); + } - int word1 = ((relative & 0x1000000) >> 14) | ((relative & 0x3ff000) >> 12); - int word2 = ((relative & 0x800000) >> 10) | ((relative & 0x400000) >> 11) | ((relative & 0xffe) >> 1); + static bool isMOVT(void* address) + { + uint16_t* instruction = static_cast<uint16_t*>(address); + return ((instruction[0] & 0xFBF0) == OP_MOVT) && ((instruction[1] & 0x8000) == 0); + } - instruction[-2] = OP_B_T4a | word1; - instruction[-1] = OP_B_T4b | word2; + static bool isNOP_T1(void* address) + { + uint16_t* instruction = static_cast<uint16_t*>(address); + return instruction[0] == OP_NOP_T1; } - // These functions can be used to splice 16-bit immediates back into previously generated instructions. - static void spliceHi5(uint16_t* where, uint16_t what) + static bool isNOP_T2(void* address) { - uint16_t pattern = (what >> 12) | ((what & 0x0800) >> 1); - *where = (*where & 0xFBF0) | pattern; + uint16_t* instruction = static_cast<uint16_t*>(address); + return (instruction[0] == OP_NOP_T2a) && (instruction[1] == OP_NOP_T2b); } - static void spliceLo11(uint16_t* where, uint16_t what) + + static void linkJumpAbsolute(uint16_t* instruction, void* target) { - uint16_t pattern = ((what & 0x0700) << 4) | (what & 0x00FF); - *where = (*where & 0x8F00) | pattern; + // FIMXE: this should be up in the MacroAssembler layer. :-( + const uint16_t JUMP_TEMPORARY_REGISTER = ARMRegisters::ip; + + ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1)); + ASSERT(!(reinterpret_cast<intptr_t>(target) & 1)); + + ASSERT( (isMOV_imm_T3(instruction - 5) && isMOVT(instruction - 3) && isBX(instruction - 1)) + || (isNOP_T1(instruction - 5) && isNOP_T2(instruction - 4) && isB(instruction - 2)) ); + + intptr_t relative = reinterpret_cast<intptr_t>(target) - (reinterpret_cast<intptr_t>(instruction)); + if (((relative << 7) >> 7) == relative) { + // ARM encoding for the top two bits below the sign bit is 'peculiar'. + if (relative >= 0) + relative ^= 0xC00000; + + // All branch offsets should be an even distance. + ASSERT(!(relative & 1)); + // There may be a better way to fix this, but right now put the NOPs first, since in the + // case of an conditional branch this will be coming after an ITTT predicating *three* + // instructions! Looking backwards to modify the ITTT to an IT is not easy, due to + // variable wdith encoding - the previous instruction might *look* like an ITTT but + // actually be the second half of a 2-word op. + instruction[-5] = OP_NOP_T1; + instruction[-4] = OP_NOP_T2a; + instruction[-3] = OP_NOP_T2b; + instruction[-2] = OP_B_T4a | ((relative & 0x1000000) >> 14) | ((relative & 0x3ff000) >> 12); + instruction[-1] = OP_B_T4b | ((relative & 0x800000) >> 10) | ((relative & 0x400000) >> 11) | ((relative & 0xffe) >> 1); + } else { + ARMThumbImmediate lo16 = ARMThumbImmediate::makeUInt16(static_cast<uint16_t>(reinterpret_cast<uint32_t>(target) + 1)); + ARMThumbImmediate hi16 = ARMThumbImmediate::makeUInt16(static_cast<uint16_t>(reinterpret_cast<uint32_t>(target) >> 16)); + instruction[-5] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOV_imm_T3, lo16); + instruction[-4] = twoWordOp5i6Imm4Reg4EncodedImmSecond(JUMP_TEMPORARY_REGISTER, lo16); + instruction[-3] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOVT, hi16); + instruction[-2] = twoWordOp5i6Imm4Reg4EncodedImmSecond(JUMP_TEMPORARY_REGISTER, hi16); + instruction[-1] = OP_BX | (JUMP_TEMPORARY_REGISTER << 3); + } + } + + static uint16_t twoWordOp5i6Imm4Reg4EncodedImmFirst(uint16_t op, ARMThumbImmediate imm) + { + return op | (imm.m_value.i << 10) | imm.m_value.imm4; + } + static uint16_t twoWordOp5i6Imm4Reg4EncodedImmSecond(uint16_t rd, ARMThumbImmediate imm) + { + return (imm.m_value.imm3 << 12) | (rd << 8) | imm.m_value.imm8; } class ARMInstructionFormatter { @@ -1723,8 +1792,11 @@ private: void twoWordOp5i6Imm4Reg4EncodedImm(OpcodeID1 op, int imm4, RegisterID rd, ARMThumbImmediate imm) { - m_buffer.putShort(op | (imm.m_value.i << 10) | imm4); - m_buffer.putShort((imm.m_value.imm3 << 12) | (rd << 8) | imm.m_value.imm8); + ARMThumbImmediate newImm = imm; + newImm.m_value.imm4 = imm4; + + m_buffer.putShort(ARMv7Assembler::twoWordOp5i6Imm4Reg4EncodedImmFirst(op, newImm)); + m_buffer.putShort(ARMv7Assembler::twoWordOp5i6Imm4Reg4EncodedImmSecond(rd, newImm)); } void twoWordOp12Reg4Reg4Imm12(OpcodeID1 op, RegisterID reg1, RegisterID reg2, uint16_t imm) @@ -1749,6 +1821,8 @@ private: private: AssemblerBuffer m_buffer; } m_formatter; + + Vector<LinkRecord> m_jumpsToLink; }; } // namespace JSC diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h index aa8cbb0..7a72b06 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h @@ -65,6 +65,7 @@ public: }; static const RegisterID stackPointerRegister = ARMRegisters::sp; + static const RegisterID linkRegister = ARMRegisters::lr; static const Scale ScalePtr = TimesFour; @@ -530,7 +531,7 @@ public: void ret() { - pop(ARMRegisters::pc); + m_assembler.mov_r(ARMRegisters::pc, linkRegister); } void set32(Condition cond, RegisterID left, RegisterID right, RegisterID dest) @@ -746,11 +747,9 @@ protected: void prepareCall() { - ensureSpace(3 * sizeof(ARMWord), sizeof(ARMWord)); + ensureSpace(2 * sizeof(ARMWord), sizeof(ARMWord)); - // S0 might be used for parameter passing - m_assembler.add_r(ARMRegisters::S1, ARMRegisters::pc, ARMAssembler::OP2_IMM | 0x4); - m_assembler.push_r(ARMRegisters::S1); + m_assembler.mov_r(linkRegister, ARMRegisters::pc); } void call32(RegisterID base, int32_t offset) diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h index a549604..c479517 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h @@ -990,13 +990,15 @@ public: protected: ARMv7Assembler::JmpSrc makeJump() { - return m_assembler.b(); + moveFixedWidthEncoding(Imm32(0), dataTempRegister); + return m_assembler.bx(dataTempRegister); } ARMv7Assembler::JmpSrc makeBranch(ARMv7Assembler::Condition cond) { - m_assembler.it(cond); - return m_assembler.b(); + m_assembler.it(cond, true, true); + moveFixedWidthEncoding(Imm32(0), dataTempRegister); + return m_assembler.bx(dataTempRegister); } ARMv7Assembler::JmpSrc makeBranch(Condition cond) { return makeBranch(armV7Condition(cond)); } ARMv7Assembler::JmpSrc makeBranch(DoubleCondition cond) { return makeBranch(armV7Condition(cond)); } diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp index 18ca2ae..c915934 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp @@ -824,6 +824,16 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& printf("[%4d] get_by_val\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); break; } + case op_get_by_pname: { + int r0 = (++it)->u.operand; + int r1 = (++it)->u.operand; + int r2 = (++it)->u.operand; + int r3 = (++it)->u.operand; + int r4 = (++it)->u.operand; + int r5 = (++it)->u.operand; + printf("[%4d] get_by_pname\t %s, %s, %s, %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str(), registerName(r4).c_str(), registerName(r5).c_str()); + break; + } case op_put_by_val: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; @@ -1015,14 +1025,17 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& break; } case op_get_pnames: { - int r0 = it[0].u.operand; - int r1 = it[1].u.operand; - printf("[%4d] get_pnames\t %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str()); + int r0 = it[1].u.operand; + int r1 = it[2].u.operand; + int r2 = it[3].u.operand; + int r3 = it[4].u.operand; + int offset = it[5].u.operand; + printf("[%4d] get_pnames\t %s, %s, %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str(), offset, location + offset); it += OPCODE_LENGTH(op_get_pnames) - 1; break; } case op_next_pname: { - int dest = it[0].u.operand; + int dest = it[1].u.operand; int iter = it[4].u.operand; int offset = it[5].u.operand; printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, location + offset); diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h index 8968252..4facbef 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h @@ -113,6 +113,7 @@ namespace JSC { macro(op_put_by_id_generic, 8) \ macro(op_del_by_id, 4) \ macro(op_get_by_val, 4) \ + macro(op_get_by_pname, 7) \ macro(op_put_by_val, 4) \ macro(op_del_by_val, 4) \ macro(op_put_by_index, 4) \ diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 41b5c39..04dae15 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -1281,6 +1281,19 @@ RegisterID* BytecodeGenerator::emitDeleteById(RegisterID* dst, RegisterID* base, RegisterID* BytecodeGenerator::emitGetByVal(RegisterID* dst, RegisterID* base, RegisterID* property) { + for (size_t i = m_forInContextStack.size(); i > 0; i--) { + ForInContext& context = m_forInContextStack[i - 1]; + if (context.propertyRegister == property) { + emitOpcode(op_get_by_pname); + instructions().append(dst->index()); + instructions().append(base->index()); + instructions().append(property->index()); + instructions().append(context.expectedSubscriptRegister->index()); + instructions().append(context.iterRegister->index()); + instructions().append(context.indexRegister->index()); + return dst; + } + } emitOpcode(op_get_by_val); instructions().append(dst->index()); instructions().append(base->index()); diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h index 61de173..4648fb5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -61,6 +61,13 @@ namespace JSC { FinallyContext finallyContext; }; + struct ForInContext { + RefPtr<RegisterID> expectedSubscriptRegister; + RefPtr<RegisterID> iterRegister; + RefPtr<RegisterID> indexRegister; + RefPtr<RegisterID> propertyRegister; + }; + class BytecodeGenerator : public FastAllocBase { public: typedef DeclarationStacks::VarStack VarStack; @@ -331,6 +338,17 @@ namespace JSC { void pushFinallyContext(Label* target, RegisterID* returnAddrDst); void popFinallyContext(); + void pushOptimisedForIn(RegisterID* expectedBase, RegisterID* iter, RegisterID* index, RegisterID* propertyRegister) + { + ForInContext context = { expectedBase, iter, index, propertyRegister }; + m_forInContextStack.append(context); + } + + void popOptimisedForIn() + { + m_forInContextStack.removeLast(); + } + LabelScope* breakTarget(const Identifier&); LabelScope* continueTarget(const Identifier&); @@ -467,6 +485,7 @@ namespace JSC { Vector<ControlFlowContext> m_scopeContextStack; Vector<SwitchInfo> m_switchContextStack; + Vector<ForInContext> m_forInContextStack; int m_nextGlobalIndex; int m_nextParameterIndex; diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp index 53964ad..c77a0f1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp @@ -2417,6 +2417,33 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi vPC += OPCODE_LENGTH(op_del_by_id); NEXT_INSTRUCTION(); } + DEFINE_OPCODE(op_get_by_pname) { + int dst = vPC[1].u.operand; + int base = vPC[2].u.operand; + int property = vPC[3].u.operand; + int expected = vPC[4].u.operand; + int iter = vPC[5].u.operand; + int i = vPC[6].u.operand; + + JSValue baseValue = callFrame->r(base).jsValue(); + JSPropertyNameIterator* it = callFrame->r(iter).propertyNameIterator(); + JSValue subscript = callFrame->r(property).jsValue(); + JSValue expectedSubscript = callFrame->r(expected).jsValue(); + int index = callFrame->r(i).i() - 1; + JSValue result; + int offset = 0; + if (subscript == expectedSubscript && baseValue.isCell() && (baseValue.asCell()->structure() == it->cachedStructure()) && it->getOffset(index, offset)) { + callFrame->r(dst) = asObject(baseValue)->getDirectOffset(offset); + vPC += OPCODE_LENGTH(op_get_by_pname); + NEXT_INSTRUCTION(); + } + Identifier propertyName(callFrame, subscript.toString(callFrame)); + result = baseValue.get(callFrame, propertyName); + CHECK_FOR_EXCEPTION(); + callFrame->r(dst) = result; + vPC += OPCODE_LENGTH(op_get_by_pname); + NEXT_INSTRUCTION(); + } DEFINE_OPCODE(op_get_by_val) { /* get_by_val dst(r) base(r) property(r) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h index 1d15ef0..5c43eeb 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h @@ -189,6 +189,22 @@ public: sys_dcache_flush(code, size); sys_icache_invalidate(code, size); } +#elif PLATFORM(ARM_THUMB2) && PLATFORM(LINUX) + static void cacheFlush(void* code, size_t size) + { + asm volatile ( + "push {r7}\n" + "mov r0, %0\n" + "mov r1, %1\n" + "movw r7, #0x2\n" + "movt r7, #0xf\n" + "movs r2, #0x0\n" + "svc 0x0\n" + "pop {r7}\n" + : + : "r" (code), "r" (reinterpret_cast<char*>(code) + size) + : "r0", "r1"); + } #elif PLATFORM(SYMBIAN) static void cacheFlush(void* code, size_t size) { diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp index fa0ac2e..000e4b8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp @@ -239,6 +239,7 @@ void JIT::privateCompileMainPass() DEFINE_OP(op_eq_null) DEFINE_OP(op_get_by_id) DEFINE_OP(op_get_by_val) + DEFINE_OP(op_get_by_pname) DEFINE_OP(op_get_global_var) DEFINE_OP(op_get_pnames) DEFINE_OP(op_get_scoped_var) @@ -385,6 +386,7 @@ void JIT::privateCompileSlowCases() DEFINE_SLOWCASE_OP(op_eq) DEFINE_SLOWCASE_OP(op_get_by_id) DEFINE_SLOWCASE_OP(op_get_by_val) + DEFINE_SLOWCASE_OP(op_get_by_pname) DEFINE_SLOWCASE_OP(op_instanceof) DEFINE_SLOWCASE_OP(op_jfalse) DEFINE_SLOWCASE_OP(op_jnless) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h index 9406d1f..e19ea17 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JIT.h @@ -38,6 +38,8 @@ #define JIT_CLASS_ALIGNMENT #endif +#define ASSERT_JIT_OFFSET(actual, expected) ASSERT_WITH_MESSAGE(actual == expected, "JIT Offset \"%s\" should be %d, not %d.\n", #expected, static_cast<int>(actual), static_cast<int>(expected)); + #include "CodeBlock.h" #include "Interpreter.h" #include "JITCode.h" @@ -249,7 +251,6 @@ namespace JSC { static const RegisterID timeoutCheckRegister = ARMRegisters::r5; static const RegisterID callFrameRegister = ARMRegisters::r4; - static const RegisterID ctiReturnRegister = ARMRegisters::r6; static const RegisterID regT0 = ARMRegisters::r0; static const RegisterID regT1 = ARMRegisters::r1; @@ -427,6 +428,7 @@ namespace JSC { #endif void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, Structure* structure, size_t cachedOffset); void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID resultTag, RegisterID resultPayload, size_t cachedOffset); + void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID structure, RegisterID offset); void compilePutDirectOffset(RegisterID base, RegisterID valueTag, RegisterID valuePayload, Structure* structure, size_t cachedOffset); // Arithmetic opcode helpers @@ -528,6 +530,7 @@ namespace JSC { #endif void compileGetDirectOffset(RegisterID base, RegisterID result, Structure* structure, size_t cachedOffset); void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID result, size_t cachedOffset); + void compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID structure, RegisterID offset, RegisterID scratch); void compilePutDirectOffset(RegisterID base, RegisterID value, Structure* structure, size_t cachedOffset); #if PLATFORM(X86_64) @@ -583,26 +586,26 @@ namespace JSC { #elif PLATFORM(ARM_THUMB2) // These architecture specific value are used to enable patching - see comment on op_put_by_id. static const int patchOffsetPutByIdStructure = 10; - static const int patchOffsetPutByIdExternalLoad = 20; + static const int patchOffsetPutByIdExternalLoad = 26; static const int patchLengthPutByIdExternalLoad = 12; - static const int patchOffsetPutByIdPropertyMapOffset = 40; + static const int patchOffsetPutByIdPropertyMapOffset = 46; // These architecture specific value are used to enable patching - see comment on op_get_by_id. static const int patchOffsetGetByIdStructure = 10; - static const int patchOffsetGetByIdBranchToSlowCase = 20; - static const int patchOffsetGetByIdExternalLoad = 20; + static const int patchOffsetGetByIdBranchToSlowCase = 26; + static const int patchOffsetGetByIdExternalLoad = 26; static const int patchLengthGetByIdExternalLoad = 12; - static const int patchOffsetGetByIdPropertyMapOffset = 40; - static const int patchOffsetGetByIdPutResult = 44; + static const int patchOffsetGetByIdPropertyMapOffset = 46; + static const int patchOffsetGetByIdPutResult = 50; #if ENABLE(OPCODE_SAMPLING) static const int patchOffsetGetByIdSlowCaseCall = 0; // FIMXE #else static const int patchOffsetGetByIdSlowCaseCall = 28; #endif - static const int patchOffsetOpCallCompareToJump = 10; + static const int patchOffsetOpCallCompareToJump = 16; - static const int patchOffsetMethodCheckProtoObj = 18; - static const int patchOffsetMethodCheckProtoStruct = 28; - static const int patchOffsetMethodCheckPutFunction = 46; + static const int patchOffsetMethodCheckProtoObj = 24; + static const int patchOffsetMethodCheckProtoStruct = 34; + static const int patchOffsetMethodCheckPutFunction = 58; #elif PLATFORM(ARM_TRADITIONAL) // These architecture specific value are used to enable patching - see comment on op_put_by_id. static const int patchOffsetPutByIdStructure = 4; @@ -619,7 +622,7 @@ namespace JSC { #if ENABLE(OPCODE_SAMPLING) #error "OPCODE_SAMPLING is not yet supported" #else - static const int patchOffsetGetByIdSlowCaseCall = 36; + static const int patchOffsetGetByIdSlowCaseCall = 28; #endif static const int patchOffsetOpCallCompareToJump = 12; @@ -640,7 +643,7 @@ namespace JSC { static const int sequenceGetByIdHotPathInstructionSpace = 28; static const int sequenceGetByIdHotPathConstantSpace = 3; // sequenceGetByIdSlowCase - static const int sequenceGetByIdSlowCaseInstructionSpace = 40; + static const int sequenceGetByIdSlowCaseInstructionSpace = 32; static const int sequenceGetByIdSlowCaseConstantSpace = 2; // sequencePutById static const int sequencePutByIdInstructionSpace = 28; @@ -682,6 +685,7 @@ namespace JSC { void emit_op_eq_null(Instruction*); void emit_op_get_by_id(Instruction*); void emit_op_get_by_val(Instruction*); + void emit_op_get_by_pname(Instruction*); void emit_op_get_global_var(Instruction*); void emit_op_get_scoped_var(Instruction*); void emit_op_init_arguments(Instruction*); @@ -771,6 +775,7 @@ namespace JSC { void emitSlow_op_eq(Instruction*, Vector<SlowCaseEntry>::iterator&); void emitSlow_op_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&); void emitSlow_op_get_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&); + void emitSlow_op_get_by_pname(Instruction*, Vector<SlowCaseEntry>::iterator&); void emitSlow_op_instanceof(Instruction*, Vector<SlowCaseEntry>::iterator&); void emitSlow_op_jfalse(Instruction*, Vector<SlowCaseEntry>::iterator&); void emitSlow_op_jnless(Instruction*, Vector<SlowCaseEntry>::iterator&); diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp index cfaa69f..f7fcc0a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp @@ -614,7 +614,7 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca END_UNINTERRUPTED_SEQUENCE(sequenceOpCall); addSlowCase(jumpToSlow); - ASSERT(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow) == patchOffsetOpCallCompareToJump); + ASSERT_JIT_OFFSET(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow), patchOffsetOpCallCompareToJump); m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck; // The following is the fast case, only used whan a callee can be linked. diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h index f26457a..93d6ce7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITInlineMethods.h @@ -144,7 +144,7 @@ ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace) #endif -#if PLATFORM(ARM_THUMB2) +#if PLATFORM(ARM) ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg) { @@ -161,7 +161,7 @@ ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address) loadPtr(address, linkRegister); } -#else // PLATFORM(X86) || PLATFORM(X86_64) || PLATFORM(ARM_TRADITIONAL) +#else // PLATFORM(X86) || PLATFORM(X86_64) ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg) { @@ -191,16 +191,13 @@ ALWAYS_INLINE void JIT::restoreArgumentReference() { move(stackPointerRegister, firstArgumentRegister); poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*)); -#if PLATFORM(ARM_TRADITIONAL) - move(ctiReturnRegister, ARMRegisters::lr); -#endif } ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline() { #if PLATFORM(X86) // Within a trampoline the return address will be on the stack at this point. addPtr(Imm32(sizeof(void*)), stackPointerRegister, firstArgumentRegister); -#elif PLATFORM(ARM_THUMB2) +#elif PLATFORM(ARM) move(stackPointerRegister, firstArgumentRegister); #endif // In the trampoline on x86-64, the first argument register is not overwritten. diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp index e10d105..14736cf 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp @@ -1792,7 +1792,6 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable // Setup arg4: This is a plain hack move(stackPointerRegister, ARMRegisters::S0); - move(ctiReturnRegister, ARMRegisters::lr); call(Address(regT1, OBJECT_OFFSETOF(JSFunction, m_data))); addPtr(Imm32(sizeof(ArgList)), stackPointerRegister); @@ -2500,7 +2499,13 @@ void JIT::emit_op_next_pname(Instruction* currentInstruction) // Grab key @ i loadPtr(addressFor(it), regT1); loadPtr(Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStrings)), regT2); + +#if USE(JSVALUE64) loadPtr(BaseIndex(regT2, regT0, TimesEight), regT2); +#else + loadPtr(BaseIndex(regT2, regT0, TimesFour), regT2); +#endif + emitPutVirtualRegister(dst, regT2); // Increment i diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess.cpp index 4241111..bf367a6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess.cpp @@ -33,6 +33,7 @@ #include "JITStubCall.h" #include "JSArray.h" #include "JSFunction.h" +#include "JSPropertyNameIterator.h" #include "Interpreter.h" #include "LinkBuffer.h" #include "RepatchBuffer.h" @@ -934,6 +935,69 @@ void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* str #endif // !ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) +void JIT::compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID structure, RegisterID offset) +{ + ASSERT(sizeof(((Structure*)0)->m_propertyStorageCapacity) == sizeof(int32_t)); + ASSERT(sizeof(JSObject::inlineStorageCapacity) == sizeof(int32_t)); + ASSERT(sizeof(JSValue) == 8); + + Jump notUsingInlineStorage = branch32(NotEqual, Address(structure, OBJECT_OFFSETOF(Structure, m_propertyStorageCapacity)), Imm32(JSObject::inlineStorageCapacity)); + loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSObject, m_inlineStorage)+OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload); + loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSObject, m_inlineStorage)+OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag); + Jump finishedLoad = jump(); + notUsingInlineStorage.link(this); + loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), base); + loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload); + loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag); + finishedLoad.link(this); +} + +void JIT::emit_op_get_by_pname(Instruction* currentInstruction) +{ + unsigned dst = currentInstruction[1].u.operand; + unsigned base = currentInstruction[2].u.operand; + unsigned property = currentInstruction[3].u.operand; + unsigned expected = currentInstruction[4].u.operand; + unsigned iter = currentInstruction[5].u.operand; + unsigned i = currentInstruction[6].u.operand; + + emitLoad2(property, regT1, regT0, base, regT3, regT2); + emitJumpSlowCaseIfNotJSCell(property, regT1); + addSlowCase(branchPtr(NotEqual, regT0, payloadFor(expected))); + // Property registers are now available as the property is known + emitJumpSlowCaseIfNotJSCell(base, regT3); + emitLoadPayload(iter, regT1); + + // Test base's structure + loadPtr(Address(regT2, OBJECT_OFFSETOF(JSCell, m_structure)), regT0); + addSlowCase(branchPtr(NotEqual, regT0, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedStructure)))); + load32(addressFor(i), regT3); + sub32(Imm32(1), regT3); + addSlowCase(branch32(AboveOrEqual, regT3, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_numCacheableSlots)))); + compileGetDirectOffset(regT2, regT1, regT0, regT0, regT3); + + emitStore(dst, regT1, regT0); + map(m_bytecodeIndex + OPCODE_LENGTH(op_get_by_pname), dst, regT1, regT0); +} + +void JIT::emitSlow_op_get_by_pname(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) +{ + unsigned dst = currentInstruction[1].u.operand; + unsigned base = currentInstruction[2].u.operand; + unsigned property = currentInstruction[3].u.operand; + + linkSlowCaseIfNotJSCell(iter, property); + linkSlowCase(iter); + linkSlowCaseIfNotJSCell(iter, base); + linkSlowCase(iter); + linkSlowCase(iter); + + JITStubCall stubCall(this, cti_op_get_by_val); + stubCall.addArgument(base); + stubCall.addArgument(property); + stubCall.call(dst); +} + #else // USE(JSVALUE32_64) void JIT::emit_op_get_by_val(Instruction* currentInstruction) @@ -967,6 +1031,48 @@ void JIT::emit_op_get_by_val(Instruction* currentInstruction) emitPutVirtualRegister(dst); } +void JIT::emit_op_get_by_pname(Instruction* currentInstruction) +{ + unsigned dst = currentInstruction[1].u.operand; + unsigned base = currentInstruction[2].u.operand; + unsigned property = currentInstruction[3].u.operand; + unsigned expected = currentInstruction[4].u.operand; + unsigned iter = currentInstruction[5].u.operand; + unsigned i = currentInstruction[6].u.operand; + + emitGetVirtualRegister(property, regT0); + addSlowCase(branchPtr(NotEqual, regT0, addressFor(expected))); + emitGetVirtualRegisters(base, regT0, iter, regT1); + emitJumpSlowCaseIfNotJSCell(regT0, base); + + // Test base's structure + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2); + addSlowCase(branchPtr(NotEqual, regT2, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedStructure)))); + load32(addressFor(i), regT3); + sub32(Imm32(1), regT3); + addSlowCase(branch32(AboveOrEqual, regT3, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_numCacheableSlots)))); + compileGetDirectOffset(regT0, regT0, regT2, regT3, regT1); + + emitPutVirtualRegister(dst, regT0); +} + +void JIT::emitSlow_op_get_by_pname(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) +{ + unsigned dst = currentInstruction[1].u.operand; + unsigned base = currentInstruction[2].u.operand; + unsigned property = currentInstruction[3].u.operand; + + linkSlowCase(iter); + linkSlowCaseIfNotJSCell(iter, base); + linkSlowCase(iter); + linkSlowCase(iter); + + JITStubCall stubCall(this, cti_op_get_by_val); + stubCall.addArgument(base, regT2); + stubCall.addArgument(property, regT2); + stubCall.call(dst); +} + void JIT::emit_op_put_by_val(Instruction* currentInstruction) { unsigned base = currentInstruction[1].u.operand; @@ -1132,9 +1238,9 @@ void JIT::emit_op_method_check(Instruction* currentInstruction) Jump match = jump(); - ASSERT(differenceBetween(info.structureToCompare, protoObj) == patchOffsetMethodCheckProtoObj); - ASSERT(differenceBetween(info.structureToCompare, protoStructureToCompare) == patchOffsetMethodCheckProtoStruct); - ASSERT(differenceBetween(info.structureToCompare, putFunction) == patchOffsetMethodCheckPutFunction); + ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, protoObj), patchOffsetMethodCheckProtoObj); + ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, protoStructureToCompare), patchOffsetMethodCheckProtoStruct); + ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, putFunction), patchOffsetMethodCheckPutFunction); // Link the failure cases here. notCell.link(this); @@ -1201,22 +1307,22 @@ void JIT::compileGetByIdHotPath(int, int baseVReg, Identifier*, unsigned propert DataLabelPtr structureToCompare; Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))); addSlowCase(structureCheck); - ASSERT(differenceBetween(hotPathBegin, structureToCompare) == patchOffsetGetByIdStructure); - ASSERT(differenceBetween(hotPathBegin, structureCheck) == patchOffsetGetByIdBranchToSlowCase); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetGetByIdStructure); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureCheck), patchOffsetGetByIdBranchToSlowCase) Label externalLoad = loadPtrWithPatchToLEA(Address(regT0, OBJECT_OFFSETOF(JSObject, m_externalStorage)), regT0); Label externalLoadComplete(this); - ASSERT(differenceBetween(hotPathBegin, externalLoad) == patchOffsetGetByIdExternalLoad); - ASSERT(differenceBetween(externalLoad, externalLoadComplete) == patchLengthGetByIdExternalLoad); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, externalLoad), patchOffsetGetByIdExternalLoad); + ASSERT_JIT_OFFSET(differenceBetween(externalLoad, externalLoadComplete), patchLengthGetByIdExternalLoad); DataLabel32 displacementLabel = loadPtrWithAddressOffsetPatch(Address(regT0, patchGetByIdDefaultOffset), regT0); - ASSERT(differenceBetween(hotPathBegin, displacementLabel) == patchOffsetGetByIdPropertyMapOffset); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel), patchOffsetGetByIdPropertyMapOffset); Label putResult(this); END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath); - ASSERT(differenceBetween(hotPathBegin, putResult) == patchOffsetGetByIdPutResult); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, putResult), patchOffsetGetByIdPutResult); } void JIT::emitSlow_op_get_by_id(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) @@ -1251,7 +1357,7 @@ void JIT::compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdSlowCase); - ASSERT(differenceBetween(coldPathBegin, call) == patchOffsetGetByIdSlowCaseCall); + ASSERT_JIT_OFFSET(differenceBetween(coldPathBegin, call), patchOffsetGetByIdSlowCaseCall); // Track the location of the call; this will be used to recover patch information. m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex].callReturnLocation = call; @@ -1282,19 +1388,19 @@ void JIT::emit_op_put_by_id(Instruction* currentInstruction) // It is important that the following instruction plants a 32bit immediate, in order that it can be patched over. DataLabelPtr structureToCompare; addSlowCase(branchPtrWithPatch(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)))); - ASSERT(differenceBetween(hotPathBegin, structureToCompare) == patchOffsetPutByIdStructure); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetPutByIdStructure); // Plant a load from a bogus ofset in the object's property map; we will patch this later, if it is to be used. Label externalLoad = loadPtrWithPatchToLEA(Address(regT0, OBJECT_OFFSETOF(JSObject, m_externalStorage)), regT0); Label externalLoadComplete(this); - ASSERT(differenceBetween(hotPathBegin, externalLoad) == patchOffsetPutByIdExternalLoad); - ASSERT(differenceBetween(externalLoad, externalLoadComplete) == patchLengthPutByIdExternalLoad); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, externalLoad), patchOffsetPutByIdExternalLoad); + ASSERT_JIT_OFFSET(differenceBetween(externalLoad, externalLoadComplete), patchLengthPutByIdExternalLoad); DataLabel32 displacementLabel = storePtrWithAddressOffsetPatch(regT1, Address(regT0, patchGetByIdDefaultOffset)); END_UNINTERRUPTED_SEQUENCE(sequencePutById); - ASSERT(differenceBetween(hotPathBegin, displacementLabel) == patchOffsetPutByIdPropertyMapOffset); + ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel), patchOffsetPutByIdPropertyMapOffset); } void JIT::emitSlow_op_put_by_id(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) @@ -1351,6 +1457,20 @@ void JIT::compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID res } } +void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID structure, RegisterID offset, RegisterID scratch) +{ + ASSERT(sizeof(((Structure*)0)->m_propertyStorageCapacity) == sizeof(int32_t)); + ASSERT(sizeof(JSObject::inlineStorageCapacity) == sizeof(int32_t)); + + Jump notUsingInlineStorage = branch32(NotEqual, Address(structure, OBJECT_OFFSETOF(Structure, m_propertyStorageCapacity)), Imm32(JSObject::inlineStorageCapacity)); + loadPtr(BaseIndex(base, offset, ScalePtr, OBJECT_OFFSETOF(JSObject, m_inlineStorage)), result); + Jump finishedLoad = jump(); + notUsingInlineStorage.link(this); + loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), scratch); + loadPtr(BaseIndex(scratch, offset, ScalePtr, 0), result); + finishedLoad.link(this); +} + void JIT::testPrototype(Structure* structure, JumpList& failureCases) { if (structure->m_prototype.isNull()) diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index 457518c..470ed0b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -570,22 +570,15 @@ HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "stmdb sp!, {r1-r3}" "\n" "stmdb sp!, {r4-r8, lr}" "\n" - "mov r6, pc" "\n" - "add r6, r6, #40" "\n" - "sub sp, sp, #32" "\n" - "ldr r4, [sp, #60]" "\n" + "sub sp, sp, #36" "\n" + "mov r4, r2" "\n" "mov r5, #512" "\n" - // r0 contains the code - "add r8, pc, #4" "\n" - "str r8, [sp, #-4]!" "\n" + "mov lr, pc" "\n" "mov pc, r0" "\n" - "add sp, sp, #32" "\n" + "add sp, sp, #36" "\n" "ldmia sp!, {r4-r8, lr}" "\n" "add sp, sp, #12" "\n" "mov pc, lr" "\n" - - // the return instruction - "ldr pc, [sp], #4" "\n" ); asm volatile ( @@ -593,16 +586,13 @@ asm volatile ( HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "mov r0, sp" "\n" - "mov lr, r6" "\n" - "add r8, pc, #4" "\n" - "str r8, [sp, #-4]!" "\n" - "b " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" + "bl " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" // Both has the same return sequence ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" - "add sp, sp, #32" "\n" + "add sp, sp, #36" "\n" "ldmia sp!, {r4-r8, lr}" "\n" "add sp, sp, #12" "\n" "mov pc, lr" "\n" @@ -946,6 +936,22 @@ static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalD ); \ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION) \ +#elif PLATFORM(ARM_TRADITIONAL) && COMPILER(GCC) + +#define DEFINE_STUB_FUNCTION(rtype, op) \ + extern "C" { \ + rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \ + }; \ + asm volatile ( \ + ".globl " SYMBOL_STRING(cti_##op) "\n" \ + SYMBOL_STRING(cti_##op) ":" "\n" \ + "str lr, [sp, #32]" "\n" \ + "bl " SYMBOL_STRING(JITStubThunked_##op) "\n" \ + "ldr lr, [sp, #32]" "\n" \ + "mov pc, lr" "\n" \ + ); \ + rtype JITStubThunked_##op(STUB_ARGS_DECLARATION) + #else #define DEFINE_STUB_FUNCTION(rtype, op) rtype JIT_STUB cti_##op(STUB_ARGS_DECLARATION) #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h index ccbcd2a..69776cb 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h @@ -163,6 +163,8 @@ namespace JSC { JITStubArg padding; // Unused JITStubArg args[7]; + ReturnAddressPtr thunkReturnAddress; + void* preservedR4; void* preservedR5; void* preservedR6; @@ -173,11 +175,13 @@ namespace JSC { RegisterFile* registerFile; CallFrame* callFrame; JSValue* exception; + + // These arguments passed on the stack. Profiler** enabledProfilerReference; JSGlobalData* globalData; // When JIT code makes a call, it pushes its return address just below the rest of the stack. - ReturnAddressPtr* returnAddressSlot() { return reinterpret_cast<ReturnAddressPtr*>(this) - 1; } + ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; } }; #else #error "JITStackFrame not defined for this platform." diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp index b1e317e..45009dc 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp @@ -1477,6 +1477,7 @@ RegisterID* ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds generator.emitNode(base.get(), m_expr); RefPtr<RegisterID> i = generator.newTemporary(); RefPtr<RegisterID> size = generator.newTemporary(); + RefPtr<RegisterID> expectedSubscript; RefPtr<RegisterID> iter = generator.emitGetPropertyNames(generator.newTemporary(), base.get(), i.get(), size.get(), scope->breakTarget()); generator.emitJump(scope->continueTarget()); @@ -1484,6 +1485,7 @@ RegisterID* ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds generator.emitLabel(loopStart.get()); RegisterID* propertyName; + bool optimizedForinAccess = false; if (m_lexpr->isResolveNode()) { const Identifier& ident = static_cast<ResolveNode*>(m_lexpr)->identifier(); propertyName = generator.registerFor(ident); @@ -1494,6 +1496,10 @@ RegisterID* ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds generator.emitExpressionInfo(divot(), startOffset(), endOffset()); generator.emitPutById(base, ident, propertyName); + } else { + expectedSubscript = generator.emitMove(generator.newTemporary(), propertyName); + generator.pushOptimisedForIn(expectedSubscript.get(), iter.get(), i.get(), propertyName); + optimizedForinAccess = true; } } else if (m_lexpr->isDotAccessorNode()) { DotAccessorNode* assignNode = static_cast<DotAccessorNode*>(m_lexpr); @@ -1518,6 +1524,9 @@ RegisterID* ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds generator.emitNode(dst, m_statement); + if (optimizedForinAccess) + generator.popOptimisedForIn(); + generator.emitLabel(scope->continueTarget()); generator.emitNextPropertyName(propertyName, base.get(), i.get(), size.get(), iter.get(), loopStart.get()); generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine()); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp index a69115c..8b647a0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp @@ -1291,6 +1291,10 @@ static const char* typeName(JSCell* cell) #endif if (cell->isGetterSetter()) return "gettersetter"; + if (cell->isAPIValueWrapper()) + return "value wrapper"; + if (cell->isPropertyNameIterator()) + return "for-in iterator"; ASSERT(cell->isObject()); const ClassInfo* info = cell->classInfo(); return info ? info->className : "Object"; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.cpp index f9b7d84..9908fef 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/DateConstructor.cpp @@ -112,9 +112,7 @@ JSObject* constructDate(ExecState* exec, const ArgList& args) } } - DateInstance* result = new (exec) DateInstance(exec->lexicalGlobalObject()->dateStructure()); - result->setInternalValue(jsNumber(exec, timeClip(value))); - return result; + return new (exec) DateInstance(exec, value); } static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.cpp index 4cd58f5..d4c9ef7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.cpp @@ -32,95 +32,43 @@ using namespace WTF; namespace JSC { -struct DateInstance::Cache { - double m_gregorianDateTimeCachedForMS; - GregorianDateTime m_cachedGregorianDateTime; - double m_gregorianDateTimeUTCCachedForMS; - GregorianDateTime m_cachedGregorianDateTimeUTC; -}; - const ClassInfo DateInstance::info = {"Date", 0, 0, 0}; -DateInstance::DateInstance(NonNullPassRefPtr<Structure> structure) +DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure) : JSWrapperObject(structure) - , m_cache(0) { + setInternalValue(jsNaN(exec)); } DateInstance::DateInstance(ExecState* exec, double time) : JSWrapperObject(exec->lexicalGlobalObject()->dateStructure()) - , m_cache(0) { setInternalValue(jsNumber(exec, timeClip(time))); } -DateInstance::~DateInstance() +bool DateInstance::getGregorianDateTime(ExecState* exec, bool outputIsUTC, GregorianDateTime& t) const { - delete m_cache; -} + double milli = internalNumber(); + if (isnan(milli)) + return false; -void DateInstance::msToGregorianDateTime(double milli, bool outputIsUTC, GregorianDateTime& t) const -{ - if (!m_cache) { - m_cache = new Cache; - m_cache->m_gregorianDateTimeCachedForMS = NaN; - m_cache->m_gregorianDateTimeUTCCachedForMS = NaN; - } + if (!m_data) + m_data = exec->globalData().dateInstanceCache.add(milli); if (outputIsUTC) { - if (m_cache->m_gregorianDateTimeUTCCachedForMS != milli) { - WTF::msToGregorianDateTime(milli, true, m_cache->m_cachedGregorianDateTimeUTC); - m_cache->m_gregorianDateTimeUTCCachedForMS = milli; + if (m_data->m_gregorianDateTimeUTCCachedForMS != milli) { + WTF::msToGregorianDateTime(internalNumber(), true, m_data->m_cachedGregorianDateTimeUTC); + m_data->m_gregorianDateTimeUTCCachedForMS = milli; } - t.copyFrom(m_cache->m_cachedGregorianDateTimeUTC); + t.copyFrom(m_data->m_cachedGregorianDateTimeUTC); } else { - if (m_cache->m_gregorianDateTimeCachedForMS != milli) { - WTF::msToGregorianDateTime(milli, false, m_cache->m_cachedGregorianDateTime); - m_cache->m_gregorianDateTimeCachedForMS = milli; + if (m_data->m_gregorianDateTimeCachedForMS != milli) { + WTF::msToGregorianDateTime(internalNumber(), false, m_data->m_cachedGregorianDateTime); + m_data->m_gregorianDateTimeCachedForMS = milli; } - t.copyFrom(m_cache->m_cachedGregorianDateTime); + t.copyFrom(m_data->m_cachedGregorianDateTime); } -} -bool DateInstance::getTime(GregorianDateTime& t, int& offset) const -{ - double milli = internalNumber(); - if (isnan(milli)) - return false; - - msToGregorianDateTime(milli, false, t); - offset = gmtoffset(t); - return true; -} - -bool DateInstance::getUTCTime(GregorianDateTime& t) const -{ - double milli = internalNumber(); - if (isnan(milli)) - return false; - - msToGregorianDateTime(milli, true, t); - return true; -} - -bool DateInstance::getTime(double& milli, int& offset) const -{ - milli = internalNumber(); - if (isnan(milli)) - return false; - - GregorianDateTime t; - msToGregorianDateTime(milli, false, t); - offset = gmtoffset(t); - return true; -} - -bool DateInstance::getUTCTime(double& milli) const -{ - milli = internalNumber(); - if (isnan(milli)) - return false; - return true; } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.h b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.h index 36d90b1..38b321c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstance.h @@ -32,27 +32,26 @@ namespace JSC { class DateInstance : public JSWrapperObject { public: DateInstance(ExecState*, double); - explicit DateInstance(NonNullPassRefPtr<Structure>); - virtual ~DateInstance(); + explicit DateInstance(ExecState*, NonNullPassRefPtr<Structure>); double internalNumber() const { return internalValue().uncheckedGetNumber(); } - bool getTime(WTF::GregorianDateTime&, int& offset) const; - bool getUTCTime(WTF::GregorianDateTime&) const; - bool getTime(double& milliseconds, int& offset) const; - bool getUTCTime(double& milliseconds) const; - static JS_EXPORTDATA const ClassInfo info; - void msToGregorianDateTime(double, bool outputIsUTC, WTF::GregorianDateTime&) const; + bool getGregorianDateTime(ExecState*, bool outputIsUTC, WTF::GregorianDateTime&) const; + + static PassRefPtr<Structure> createStructure(JSValue prototype) + { + return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags)); + } + + protected: + static const unsigned StructureFlags = OverridesMarkChildren | JSWrapperObject::StructureFlags; private: virtual const ClassInfo* classInfo() const { return &info; } - using JSWrapperObject::internalValue; - - struct Cache; - mutable Cache* m_cache; + mutable RefPtr<DateInstanceData> m_data; }; DateInstance* asDateInstance(JSValue); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstanceCache.h b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstanceCache.h new file mode 100644 index 0000000..b626c1d --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/DateInstanceCache.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DateInstanceCache_h +#define DateInstanceCache_h + +#include <wtf/DateMath.h> +#include <wtf/HashFunctions.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace JSC { + + extern const double NaN; + + class DateInstanceData : public RefCounted<DateInstanceData> { + public: + static PassRefPtr<DateInstanceData> create() { return adoptRef(new DateInstanceData); } + + double m_gregorianDateTimeCachedForMS; + WTF::GregorianDateTime m_cachedGregorianDateTime; + double m_gregorianDateTimeUTCCachedForMS; + WTF::GregorianDateTime m_cachedGregorianDateTimeUTC; + + private: + DateInstanceData() + : m_gregorianDateTimeCachedForMS(NaN) + , m_gregorianDateTimeUTCCachedForMS(NaN) + { + } + }; + + class DateInstanceCache { + public: + DateInstanceCache() + { + for (size_t i = 0; i < cacheSize; ++i) + m_cache[i].key = NaN; + } + + DateInstanceData* add(double d) + { + CacheEntry& entry = lookup(d); + if (d == entry.key) + return entry.value.get(); + + entry.key = d; + entry.value = DateInstanceData::create(); + return entry.value.get(); + } + + private: + static const size_t cacheSize = 64; + + struct CacheEntry { + double key; + RefPtr<DateInstanceData> value; + }; + + CacheEntry& lookup(double d) { return m_cache[WTF::FloatHash<double>::hash(d) & (cacheSize - 1)]; } + + CacheEntry m_cache[cacheSize]; + }; + +} // namespace JSC + +#endif // DateInstanceCache_h diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.cpp index e46ab67..3f3e1f9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.cpp @@ -251,11 +251,12 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, L return jsNontrivialString(exec, timebuffer); } -static JSCell* formatLocaleDate(ExecState* exec, DateInstance* dateObject, double timeInMilliseconds, LocaleDateTimeFormat format, const ArgList&) +static JSCell* formatLocaleDate(ExecState* exec, DateInstance* dateObject, double, LocaleDateTimeFormat format, const ArgList&) { GregorianDateTime gregorianDateTime; - const bool notUTC = false; - dateObject->msToGregorianDateTime(timeInMilliseconds, notUTC, gregorianDateTime); + const bool outputIsUTC = false; + if (!dateObject->getGregorianDateTime(exec, outputIsUTC, gregorianDateTime)) + return jsNontrivialString(exec, "Invalid Date"); return formatLocaleDate(exec, gregorianDateTime, format); } @@ -396,9 +397,8 @@ const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, 0, ExecState // ECMA 15.9.4 DatePrototype::DatePrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure) - : DateInstance(structure) + : DateInstance(exec, structure) { - setInternalValue(jsNaN(exec)); // The constructor will be added later, after DateConstructor has been built. } @@ -420,16 +420,14 @@ JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec, JSObject*, JSValue if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); - return jsNontrivialString(exec, formatDate(t) + " " + formatTime(t, utc)); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNontrivialString(exec, "Invalid Date"); + return jsNontrivialString(exec, formatDate(t) + " " + formatTime(t, outputIsUTC)); } JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) @@ -437,16 +435,14 @@ JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSVal if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); - return jsNontrivialString(exec, formatDateUTCVariant(t) + " " + formatTime(t, utc)); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNontrivialString(exec, "Invalid Date"); + return jsNontrivialString(exec, formatDateUTCVariant(t) + " " + formatTime(t, outputIsUTC)); } JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) @@ -454,19 +450,17 @@ JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSVal if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (!isfinite(milli)) - return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNontrivialString(exec, "Invalid Date"); // Maximum amount of space we need in buffer: 6 (max. digits in year) + 2 * 5 (2 characters each for month, day, hour, minute, second) + 4 (. + 3 digits for milliseconds) // 6 for formatting and one for null termination = 27. We add one extra character to allow us to force null termination. char buffer[28]; - snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + t.year, t.month + 1, t.monthDay, t.hour, t.minute, t.second, static_cast<int>(fmod(milli, 1000))); + snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + t.year, t.month + 1, t.monthDay, t.hour, t.minute, t.second, static_cast<int>(fmod(thisDateObj->internalNumber(), 1000))); buffer[sizeof(buffer) - 1] = 0; return jsNontrivialString(exec, buffer); } @@ -476,15 +470,13 @@ JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec, JSObject*, JSVa if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNontrivialString(exec, "Invalid Date"); return jsNontrivialString(exec, formatDate(t)); } @@ -493,16 +485,14 @@ JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSVa if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); - return jsNontrivialString(exec, formatTime(t, utc)); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNontrivialString(exec, "Invalid Date"); + return jsNontrivialString(exec, formatTime(t, outputIsUTC)); } JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) @@ -511,11 +501,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JS return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); - - return formatLocaleDate(exec, thisDateObj, milli, LocaleDateAndTime, args); + return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDateAndTime, args); } JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) @@ -524,11 +510,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec, JSObject* return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); - - return formatLocaleDate(exec, thisDateObj, milli, LocaleDate, args); + return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDate, args); } JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) @@ -537,11 +519,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject* return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); - - return formatLocaleDate(exec, thisDateObj, milli, LocaleTime, args); + return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleTime, args); } JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) @@ -549,12 +527,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue t if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); - - return jsNumber(exec, milli); + return asDateInstance(thisValue)->internalValue(); } JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) @@ -562,15 +535,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSVal if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, 1900 + t.year); } @@ -579,15 +550,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JS if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, 1900 + t.year); } @@ -596,16 +565,14 @@ JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSVal if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); - return jsNontrivialString(exec, formatDateUTCVariant(t) + " " + formatTime(t, utc)); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNontrivialString(exec, "Invalid Date"); + return jsNontrivialString(exec, formatDateUTCVariant(t) + " " + formatTime(t, outputIsUTC)); } JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) @@ -613,15 +580,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.month); } @@ -630,15 +595,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSVal if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.month); } @@ -647,15 +610,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue t if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.monthDay); } @@ -664,15 +625,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValu if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.monthDay); } @@ -681,15 +640,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue th if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.weekDay); } @@ -698,15 +655,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.weekDay); } @@ -715,15 +670,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.hour); } @@ -732,15 +685,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSVal if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.hour); } @@ -749,15 +700,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValu if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.minute); } @@ -766,15 +715,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSV if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.minute); } @@ -783,15 +730,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValu if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.second); } @@ -800,15 +745,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSV if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = true; + const bool outputIsUTC = true; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, t.second); } @@ -847,15 +790,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*, if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); return jsNumber(exec, -gmtoffset(t) / minutesPerHour); } @@ -890,7 +831,7 @@ static JSValue setNewValueFromTimeArgs(ExecState* exec, JSValue thisValue, const double ms = milli - secs * msPerSecond; GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, inputIsUTC, t); + thisDateObj->getGregorianDateTime(exec, inputIsUTC, t); if (!fillStructuresUsingTimeArgs(exec, args, numArgsToUse, &ms, &t)) { JSValue result = jsNaN(exec); @@ -922,11 +863,11 @@ static JSValue setNewValueFromDateArgs(ExecState* exec, JSValue thisValue, const if (numArgsToUse == 3 && isnan(milli)) // Based on ECMA 262 15.9.5.40 - .41 (set[UTC]FullYear) // the time must be reset to +0 if it is NaN. - thisDateObj->msToGregorianDateTime(0, true, t); + WTF::msToGregorianDateTime(0, true, t); else { double secs = floor(milli / msPerSecond); ms = milli - secs * msPerSecond; - thisDateObj->msToGregorianDateTime(milli, inputIsUTC, t); + thisDateObj->getGregorianDateTime(exec, inputIsUTC, t); } if (!fillStructuresUsingDateArgs(exec, args, numArgsToUse, &ms, &t)) { @@ -1029,7 +970,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); if (args.isEmpty()) { @@ -1045,11 +986,11 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t if (isnan(milli)) // Based on ECMA 262 B.2.5 (setYear) // the time must be reset to +0 if it is NaN. - thisDateObj->msToGregorianDateTime(0, true, t); + WTF::msToGregorianDateTime(0, true, t); else { double secs = floor(milli / msPerSecond); ms = milli - secs * msPerSecond; - thisDateObj->msToGregorianDateTime(milli, utc, t); + thisDateObj->getGregorianDateTime(exec, outputIsUTC, t); } bool ok = true; @@ -1061,7 +1002,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t } t.year = (year > 99 || year < 0) ? year - 1900 : year; - JSValue result = jsNumber(exec, gregorianDateTimeToMS(t, ms, utc)); + JSValue result = jsNumber(exec, gregorianDateTimeToMS(t, ms, outputIsUTC)); thisDateObj->setInternalValue(result); return result; } @@ -1071,15 +1012,13 @@ JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec, JSObject*, JSValue t if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); - const bool utc = false; + const bool outputIsUTC = false; DateInstance* thisDateObj = asDateInstance(thisValue); - double milli = thisDateObj->internalNumber(); - if (isnan(milli)) - return jsNaN(exec); GregorianDateTime t; - thisDateObj->msToGregorianDateTime(milli, utc, t); + if (!thisDateObj->getGregorianDateTime(exec, outputIsUTC, t)) + return jsNaN(exec); // NOTE: IE returns the full year even in getYear. return jsNumber(exec, t.year); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.h index 5fe4f47..f565775 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/DatePrototype.h @@ -43,7 +43,7 @@ namespace JSC { } protected: - static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | DateInstance::StructureFlags; + static const unsigned StructureFlags = OverridesGetOwnPropertySlot | DateInstance::StructureFlags; }; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.h index 16a5131..722ae33 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSCell.h @@ -59,6 +59,7 @@ namespace JSC { virtual bool isGetterSetter() const; bool inherits(const ClassInfo*) const; virtual bool isAPIValueWrapper() const { return false; } + virtual bool isPropertyNameIterator() const { return false; } Structure* structure() const; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.h index b4356c4..fcac9aa 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSFunction.h @@ -66,7 +66,7 @@ namespace JSC { NativeFunction nativeFunction() { - return *reinterpret_cast<NativeFunction*>(m_data); + return *WTF::bitwise_cast<NativeFunction*>(m_data); } virtual ConstructType getConstructData(ConstructData&); @@ -97,7 +97,7 @@ namespace JSC { ScopeChain& scopeChain() { ASSERT(!isHostFunctionNonInline()); - return *reinterpret_cast<ScopeChain*>(m_data); + return *WTF::bitwise_cast<ScopeChain*>(m_data); } void clearScopeChain() { @@ -112,11 +112,11 @@ namespace JSC { void setScopeChain(const ScopeChain& sc) { ASSERT(!isHostFunctionNonInline()); - *reinterpret_cast<ScopeChain*>(m_data) = sc; + *WTF::bitwise_cast<ScopeChain*>(m_data) = sc; } void setNativeFunction(NativeFunction func) { - *reinterpret_cast<NativeFunction*>(m_data) = func; + *WTF::bitwise_cast<NativeFunction*>(m_data) = func; } unsigned char m_data[sizeof(void*)]; }; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.h index 3ad90ad..d2aa2da 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalData.h @@ -30,6 +30,7 @@ #define JSGlobalData_h #include "Collector.h" +#include "DateInstanceCache.h" #include "ExecutableAllocator.h" #include "JITStubs.h" #include "JSValue.h" @@ -116,7 +117,8 @@ namespace JSC { const MarkedArgumentBuffer* emptyList; // Lists are supposed to be allocated on the stack to have their elements properly marked, which is not the case here - but this list has nothing to mark. SmallStrings smallStrings; NumericStrings numericStrings; - + DateInstanceCache dateInstanceCache; + #if ENABLE(ASSEMBLER) ExecutableAllocator executableAllocator; #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h index 1dbab94..5a89c40 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h @@ -202,8 +202,8 @@ namespace JSC { void allocatePropertyStorageInline(size_t oldSize, size_t newSize); bool isUsingInlineStorage() const { return m_structure->isUsingInlineStorage(); } - static const size_t inlineStorageCapacity = sizeof(EncodedJSValue) == 2 * sizeof(void*) ? 4 : 3; - static const size_t nonInlineBaseStorageCapacity = 16; + static const unsigned inlineStorageCapacity = sizeof(EncodedJSValue) == 2 * sizeof(void*) ? 4 : 3; + static const unsigned nonInlineBaseStorageCapacity = 16; static PassRefPtr<Structure> createStructure(JSValue prototype) { diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.cpp index 2cd9f75..6fd0344 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.cpp @@ -43,7 +43,12 @@ JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSObject PropertyNameArray propertyNames(exec); o->getPropertyNames(exec, propertyNames); - JSPropertyNameIterator* jsPropertyNameIterator = new (exec) JSPropertyNameIterator(exec, propertyNames.data()); + size_t numCacheableSlots = 0; + if (!o->structure()->hasNonEnumerableProperties() && !o->structure()->hasAnonymousSlots() && + !o->structure()->isUncacheableDictionary() && !o->structure()->typeInfo().overridesGetPropertyNames()) + numCacheableSlots = o->structure()->propertyStorageSize(); + + JSPropertyNameIterator* jsPropertyNameIterator = new (exec) JSPropertyNameIterator(exec, propertyNames.data(), numCacheableSlots); if (o->structure()->isDictionary()) return jsPropertyNameIterator; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.h index 0559e0b..529ae8b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSPropertyNameIterator.h @@ -50,8 +50,18 @@ namespace JSC { return Structure::create(prototype, TypeInfo(CompoundType, OverridesMarkChildren)); } + virtual bool isPropertyNameIterator() const { return true; } + virtual void markChildren(MarkStack&); + bool getOffset(size_t i, int& offset) + { + if (i >= m_numCacheableSlots) + return false; + offset = i; + return true; + } + JSValue get(ExecState*, JSObject*, size_t i); size_t size() { return m_jsStringsSize; } @@ -62,17 +72,19 @@ namespace JSC { StructureChain* cachedPrototypeChain() { return m_cachedPrototypeChain.get(); } private: - JSPropertyNameIterator(ExecState*, PropertyNameArrayData* propertyNameArrayData); + JSPropertyNameIterator(ExecState*, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlot); Structure* m_cachedStructure; RefPtr<StructureChain> m_cachedPrototypeChain; - size_t m_jsStringsSize; + uint32_t m_numCacheableSlots; + uint32_t m_jsStringsSize; OwnArrayPtr<JSValue> m_jsStrings; }; -inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, PropertyNameArrayData* propertyNameArrayData) +inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlots) : JSCell(exec->globalData().propertyNameIteratorStructure.get()) , m_cachedStructure(0) + , m_numCacheableSlots(numCacheableSlots) , m_jsStringsSize(propertyNameArrayData->propertyNameVector().size()) , m_jsStrings(new JSValue[m_jsStringsSize]) { diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp index a11050f..65b62f9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp @@ -375,6 +375,7 @@ PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, con transition->m_specificValueInPrevious = specificValue; transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; + transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; if (structure->m_propertyTable) { if (structure->m_isPinnedPropertyTable) @@ -417,6 +418,7 @@ PassRefPtr<Structure> Structure::changePrototypeTransition(Structure* structure, transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; + transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; // Don't set m_offset, as one can not transition to this. @@ -433,6 +435,7 @@ PassRefPtr<Structure> Structure::despecifyFunctionTransition(Structure* structur transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; + transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; // Don't set m_offset, as one can not transition to this. @@ -464,6 +467,7 @@ PassRefPtr<Structure> Structure::addAnonymousSlotsTransition(Structure* structur transition->m_specificValueInPrevious = 0; transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; + transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; if (structure->m_propertyTable) { if (structure->m_isPinnedPropertyTable) @@ -492,6 +496,7 @@ PassRefPtr<Structure> Structure::getterSetterTransition(Structure* structure) RefPtr<Structure> transition = create(structure->storedPrototype(), structure->typeInfo()); transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = transition->m_hasGetterSetterProperties; + transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; // Don't set m_offset, as one can not transition to this. @@ -510,6 +515,7 @@ PassRefPtr<Structure> Structure::toDictionaryTransition(Structure* structure, Di transition->m_dictionaryKind = kind; transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; + transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; structure->materializePropertyMapIfNecessary(); transition->m_propertyTable = structure->copyPropertyTable(); @@ -550,6 +556,9 @@ size_t Structure::addPropertyWithoutTransition(const Identifier& propertyName, u materializePropertyMapIfNecessary(); m_isPinnedPropertyTable = true; + if (attributes & DontEnum) + m_hasNonEnumerableProperties = true; + size_t offset = put(propertyName, attributes, specificValue); if (propertyStorageSize() > propertyStorageCapacity()) growPropertyStorageCapacity(); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h index 2496c1b..f355c53 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h @@ -95,8 +95,8 @@ namespace JSC { Structure* previousID() const { return m_previous.get(); } void growPropertyStorageCapacity(); - size_t propertyStorageCapacity() const { return m_propertyStorageCapacity; } - size_t propertyStorageSize() const { return m_propertyTable ? m_propertyTable->keyCount + m_propertyTable->anonymousSlotCount + (m_propertyTable->deletedOffsets ? m_propertyTable->deletedOffsets->size() : 0) : m_offset + 1; } + unsigned propertyStorageCapacity() const { return m_propertyStorageCapacity; } + unsigned propertyStorageSize() const { return m_propertyTable ? m_propertyTable->keyCount + m_propertyTable->anonymousSlotCount + (m_propertyTable->deletedOffsets ? m_propertyTable->deletedOffsets->size() : 0) : m_offset + 1; } bool isUsingInlineStorage() const; size_t get(const Identifier& propertyName); @@ -119,6 +119,10 @@ namespace JSC { bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; } void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; } + bool hasNonEnumerableProperties() const { return m_hasNonEnumerableProperties; } + + bool hasAnonymousSlots() const { return m_propertyTable && m_propertyTable->anonymousSlotCount; } + bool isEmpty() const { return m_propertyTable ? !m_propertyTable->keyCount : m_offset == noOffset; } JSCell* specificValue() { return m_specificValueInPrevious; } @@ -190,12 +194,13 @@ namespace JSC { PropertyMapHashTable* m_propertyTable; - size_t m_propertyStorageCapacity; + uint32_t m_propertyStorageCapacity; signed char m_offset; unsigned m_dictionaryKind : 2; bool m_isPinnedPropertyTable : 1; bool m_hasGetterSetterProperties : 1; + bool m_hasNonEnumerableProperties : 1; #if COMPILER(WINSCW) // Workaround for Symbian WINSCW compiler that cannot resolve unsigned type of the declared // bitfield, when used as argument in make_pair() function calls in structure.ccp. diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp index a3d5290..b36cae5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp @@ -63,6 +63,10 @@ extern "C" time_t mktime(struct tm *t); #include <sys/time.h> #endif +#if PLATFORM(CHROMIUM) +#error Chromium uses a different timer implementation +#endif + namespace WTF { const double msPerSecond = 1000.0; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp index 0386494..2110432 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp @@ -501,13 +501,13 @@ double gregorianDateTimeToMS(const GregorianDateTime& t, double milliSeconds, bo return result; } +// input is UTC void msToGregorianDateTime(double ms, bool outputIsUTC, GregorianDateTime& tm) { - // input is UTC double dstOff = 0.0; - const double utcOff = getUTCOffset(); - - if (!outputIsUTC) { // convert to local time + double utcOff = 0.0; + if (!outputIsUTC) { + utcOff = getUTCOffset(); dstOff = getDSTOffset(ms, utcOff); ms += dstOff + utcOff; } @@ -522,8 +522,7 @@ void msToGregorianDateTime(double ms, bool outputIsUTC, GregorianDateTime& tm) tm.month = monthFromDayInYear(tm.yearDay, isLeapYear(year)); tm.year = year - 1900; tm.isDST = dstOff != 0.0; - - tm.utcOffset = outputIsUTC ? 0 : static_cast<long>((dstOff + utcOff) / msPerSecond); + tm.utcOffset = static_cast<long>((dstOff + utcOff) / msPerSecond); tm.timeZone = NULL; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h index ca0961c..541b05d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h @@ -26,13 +26,19 @@ #include <stdlib.h> #include <new> +#if COMPILER(GCC) +#define WTF_FAST_MALLOC_EXPORT __attribute__((visibility("default"))) +#else +#define WTF_FAST_MALLOC_EXPORT +#endif + namespace WTF { // These functions call CRASH() if an allocation fails. - void* fastMalloc(size_t); + void* fastMalloc(size_t) WTF_FAST_MALLOC_EXPORT; void* fastZeroedMalloc(size_t); - void* fastCalloc(size_t numElements, size_t elementSize); - void* fastRealloc(void*, size_t); + void* fastCalloc(size_t numElements, size_t elementSize) WTF_FAST_MALLOC_EXPORT; + void* fastRealloc(void*, size_t) WTF_FAST_MALLOC_EXPORT; struct TryMallocReturnValue { TryMallocReturnValue(void* data) @@ -71,7 +77,7 @@ namespace WTF { TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size); TryMallocReturnValue tryFastRealloc(void* p, size_t n); - void fastFree(void*); + void fastFree(void*) WTF_FAST_MALLOC_EXPORT; #ifndef NDEBUG void fastMallocForbid(); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h index 12291cc..9c9a4a7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h @@ -55,9 +55,13 @@ namespace WTF { bool waitForMessage(DataType&); template<typename Predicate> MessageQueueWaitResult waitForMessageFilteredWithTimeout(DataType&, Predicate&, double absoluteTime); - void kill(); + + template<typename Predicate> + void removeIf(Predicate&); bool tryGetMessage(DataType&); + + void kill(); bool killed() const; // The result of isEmpty() is only valid if no other thread is manipulating the queue at the same time. @@ -149,6 +153,17 @@ namespace WTF { } template<typename DataType> + template<typename Predicate> + inline void MessageQueue<DataType>::removeIf(Predicate& predicate) + { + MutexLocker lock(m_mutex); + DequeConstIterator<DataType> found = m_queue.end(); + while ((found = m_queue.findIf(predicate)) != m_queue.end()) { + m_queue.remove(found); + } + } + + template<typename DataType> inline bool MessageQueue<DataType>::isEmpty() { MutexLocker lock(m_mutex); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index 7151b514..7632435 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -466,6 +466,7 @@ #if PLATFORM(MAC) && !PLATFORM(IPHONE) #define WTF_PLATFORM_CF 1 #define WTF_USE_PTHREADS 1 +#define HAVE_PTHREAD_RWLOCK 1 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && defined(__x86_64__) #define WTF_USE_PLUGIN_HOST_PROCESS 1 #endif @@ -482,6 +483,7 @@ #if PLATFORM(CHROMIUM) && PLATFORM(DARWIN) #define WTF_PLATFORM_CF 1 #define WTF_USE_PTHREADS 1 +#define HAVE_PTHREAD_RWLOCK 1 #endif #if PLATFORM(IPHONE) @@ -498,6 +500,7 @@ #define HAVE_READLINE 1 #define WTF_PLATFORM_CF 1 #define WTF_USE_PTHREADS 1 +#define HAVE_PTHREAD_RWLOCK 1 #endif #if PLATFORM(WIN) @@ -511,6 +514,7 @@ #if PLATFORM(GTK) #if HAVE(PTHREAD_H) #define WTF_USE_PTHREADS 1 +#define HAVE_PTHREAD_RWLOCK 1 #endif #endif @@ -518,6 +522,7 @@ #define HAVE_POSIX_MEMALIGN 1 #define WTF_USE_CURL 1 #define WTF_USE_PTHREADS 1 +#define HAVE_PTHREAD_RWLOCK 1 #define USE_SYSTEM_MALLOC 1 #define ENABLE_NETSCAPE_PLUGIN_API 0 #endif @@ -698,7 +703,7 @@ #endif #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) -#if PLATFORM(X86_64) && (PLATFORM(DARWIN) || PLATFORM(LINUX)) +#if PLATFORM(X86_64) && (PLATFORM(DARWIN) || PLATFORM(LINUX) || PLATFORM(WIN_OS)) #define WTF_USE_JSVALUE64 1 #elif PLATFORM(ARM) || PLATFORM(PPC64) #define WTF_USE_JSVALUE32 1 @@ -725,8 +730,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 #elif PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE) - /* Under development, temporarily disabled until 16Mb link range limit in assembler is fixed. */ - #define ENABLE_JIT 0 + #define ENABLE_JIT 1 #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0 /* The JIT is tested & working on x86 Windows */ #elif PLATFORM(X86) && PLATFORM(WIN) @@ -792,8 +796,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ /* YARR supports x86 & x86-64, and has been tested on Mac and Windows. */ #if (PLATFORM(X86) && PLATFORM(MAC)) \ || (PLATFORM(X86_64) && PLATFORM(MAC)) \ - /* Under development, temporarily disabled until 16Mb link range limit in assembler is fixed. */ \ - || (PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE) && 0) \ + || (PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE)) \ || (PLATFORM(X86) && PLATFORM(WIN)) #define ENABLE_YARR 1 #define ENABLE_YARR_JIT 1 diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h b/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h index d21d1ff..c9b5742 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h @@ -32,6 +32,7 @@ // Use these to declare and define a static local variable (static T;) so that // it is leaked so that its destructors are not called at exit. Using this // macro also allows workarounds a compiler bug present in Apple's version of GCC 4.0.1. +#ifndef DEFINE_STATIC_LOCAL #if COMPILER(GCC) && defined(__APPLE_CC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 1 #define DEFINE_STATIC_LOCAL(type, name, arguments) \ static type* name##Ptr = new type arguments; \ @@ -40,6 +41,7 @@ #define DEFINE_STATIC_LOCAL(type, name, arguments) \ static type& name = *new type arguments #endif +#endif // OBJECT_OFFSETOF: Like the C++ offsetof macro, but you can use it with classes. // The magic number 0x4000 is insignificant. We use it to avoid using NULL, since diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp index 56bf438..1d4185c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp @@ -51,7 +51,7 @@ static void* threadEntryPoint(void* contextData) setThreadNameInternal(context->name); - // Block until our creating thread has completed any extra setup work + // Block until our creating thread has completed any extra setup work. { MutexLocker locker(context->creationMutex); } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h index 5154545..71c9402 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h @@ -128,7 +128,11 @@ void detachThread(ThreadIdentifier); #if USE(PTHREADS) typedef pthread_mutex_t PlatformMutex; +#if HAVE(PTHREAD_RWLOCK) typedef pthread_rwlock_t PlatformReadWriteLock; +#else +typedef void* PlatformReadWriteLock; +#endif typedef pthread_cond_t PlatformCondition; #elif PLATFORM(GTK) typedef GOwnPtr<GMutex> PlatformMutex; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp index e4fb419..6cad5e3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp @@ -167,6 +167,7 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con if (pthread_create(&threadHandle, 0, runThreadWithRegistration, static_cast<void*>(threadData))) { LOG_ERROR("Failed to create pthread at entry point %p with data %p", entryPoint, data); + delete threadData; return 0; } return establishIdentifierForPthreadHandle(threadHandle); @@ -270,7 +271,7 @@ void Mutex::unlock() ASSERT_UNUSED(result, !result); } - +#if HAVE(PTHREAD_RWLOCK) ReadWriteLock::ReadWriteLock() { pthread_rwlock_init(&m_readWriteLock, NULL); @@ -324,6 +325,7 @@ void ReadWriteLock::unlock() int result = pthread_rwlock_unlock(&m_readWriteLock); ASSERT_UNUSED(result, !result); } +#endif // HAVE(PTHREAD_RWLOCK) ThreadCondition::ThreadCondition() { diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp index aafea3c..d088086 100644 --- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexInterpreter.cpp @@ -1490,7 +1490,7 @@ public: closeBodyAlternative(); } - void alterantiveBodyDisjunction() + void alternativeBodyDisjunction() { int newAlternativeIndex = m_bodyDisjunction->terms.size(); m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex; @@ -1499,7 +1499,7 @@ public: m_currentAlternativeIndex = newAlternativeIndex; } - void alterantiveDisjunction() + void alternativeDisjunction() { int newAlternativeIndex = m_bodyDisjunction->terms.size(); m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex; @@ -1515,9 +1515,9 @@ public: if (alt) { if (disjunction == m_pattern.m_body) - alterantiveBodyDisjunction(); + alternativeBodyDisjunction(); else - alterantiveDisjunction(); + alternativeDisjunction(); } PatternAlternative* alternative = disjunction->m_alternatives[alt]; diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp index b635a45..5ce579a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp @@ -1264,7 +1264,7 @@ class RegexGenerator : private MacroAssembler { // complex here in compilation, and in the common case we should end up coallescing the checks. // // FIXME: a nice improvement here may be to stop trying to match sooner, based on the least - // of the minimum-alterantive-lengths. E.g. if I have two alternatives of length 200 and 150, + // of the minimum-alternative-lengths. E.g. if I have two alternatives of length 200 and 150, // and a string of length 100, we'll end up looping index from 0 to 100, checking whether there // is sufficient input to run either alternative (constantly failing). If there had been only // one alternative, or if the shorter alternative had come first, we would have terminated @@ -1309,9 +1309,6 @@ class RegexGenerator : private MacroAssembler { loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), output); #endif #elif PLATFORM(ARM) -#if PLATFORM(ARM_TRADITIONAL) - push(ARMRegisters::lr); -#endif push(ARMRegisters::r4); push(ARMRegisters::r5); push(ARMRegisters::r6); diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 488c6a0..98f007c 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,8 +4,8 @@ This is a snapshot of the Qt port of WebKit from The commit imported was from the - qtwebkit-4.6-snapshot-22102009 branch/tag + qtwebkit-4.6-snapshot-20091003 branch/tag and has the sha1 checksum - 0639bb8e812c8923287cd5523248ca64fa5f7a50 + 8f810287200d21aded375664cc0a6ac0476dbdea diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 4e5dff8..2b36014 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,4260 @@ +2009-11-02 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Rubber-stamped by Antti Koivisto. + + [Qt] Build fix for Windows CE + + * plugins/PluginDatabase.cpp: + +2009-11-02 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Fix Qt build on Windows. + https://bugs.webkit.org/show_bug.cgi?id=30905 + + * WebCore.pro: + * platform/graphics/BitmapImage.h: + * platform/graphics/qt/ImageQt.cpp: + (WebCore::BitmapImage::BitmapImage): + (WebCore::BitmapImage::create): + +2009-10-28 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Don't run JavaScript URLs in view source mode + https://bugs.webkit.org/show_bug.cgi?id=30881 + + Just say no. + + Test: http/tests/security/view-source-no-javascript-url.html + + * bindings/ScriptControllerBase.cpp: + (WebCore::ScriptController::executeIfJavaScriptURL): + +2009-10-29 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Unreviewed. Fixes style problems pointed out by Evan Martin. + + * platform/gtk/Language.cpp: + (WebCore::defaultLanguage): + +2009-10-29 Dan Bernstein <mitz@apple.com> + + Rubber-stamped by Mark Rowe. + + 64-bit Leopard build fix after r50259 + + * platform/graphics/mac/ComplexTextControllerATSUI.cpp: + Declared ATSUTextInserted in 64-bit. + (WebCore::fontHasMirroringInfo): Use %d format and cast to int. + (WebCore::disableLigatures): Ditto. + (WebCore::initializeATSUStyle): Ditto. + (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Ditto. + +2009-10-29 Dan Bernstein <mitz@apple.com> + + Tiger build fix after r50259 + + * platform/graphics/mac/ComplexTextController.h: + * platform/graphics/mac/ComplexTextControllerATSUI.cpp: + +2009-10-29 Dan Bernstein <mitz@apple.com> + + Attempted Tiger build fix after r50259 + + * platform/graphics/mac/ComplexTextControllerATSUI.cpp: + +2009-10-28 Steve Falkenburg <sfalken@apple.com> + + Rubber stamped by Mark Rowe. + + https://bugs.webkit.org/show_bug.cgi?id=30899 + WebKit fails to build release on 32-bit Windows systems + + * WebCore.vcproj/WebCore.vcproj: Excluded files from project. + * bindings/js/JSBindingsAllInOne.cpp: Added. + +2009-10-28 Dan Bernstein <mitz@apple.com> + + Reviewed by Jon Honeycutt. + + Fixed typos in color names. + + * inspector/front-end/Color.js: + +2009-10-28 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + Share code between the ATSUI- and Core Text-based Font implementations by doing the + following: + - Generalize CoreTextController as ComplexTextController, keeping the Core Text-specific + parts in ComplexTextControllerCoreText.cpp. + - Generalize FontMacCoreText as FontComplexTextMac using ComplexTextController + - Implement ATSUI-specific parts of ComplexTextController in ComplexTextControllerATSUI. + - Remove FontMacATSUI. + + * WebCore.xcodeproj/project.pbxproj: Removed CoreTextController.{cpp,h}, FontMacATSUI.mm, + and FontMacCoreText.cpp, and added ComplexTextController.{cpp,h}, + ComplexTextControllerATSUI.cpp, ComplexTextControllerCoreText.cpp, and + FontComplexTextMac.cpp. + + * platform/graphics/mac/ComplexTextController.cpp: Copied from CoreTextController.cpp and + kept the non-Core Text-specific bits. + (WebCore::ComplexTextController::ComplexTextController): Updated for renames, including + its own. + (WebCore::ComplexTextController::offsetForPosition): Updated for renames and for + m_complexTextRuns holding references instead of objects. + (WebCore::ComplexTextController::collectComplexTextRuns): Updated for renames, including + its own. + (WebCore::ComplexTextController::advance): Updated for renames. + (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Updated for renames and for + m_complexTextRuns holding references instead of objects, and changed to use the glyphs() + and advances() accessors. + + * platform/graphics/mac/ComplexTextController.h: Copied from CoreTextController.h and + renamed CoreTextController to ComplexTextController and CoreTextRun to ComplexTextRun. Made + the latter RefCounted, added ATSUI-specific members to it, and made some other members + Core Text-specific. Renamed m_coreTextRuns to m_complexTextRuns and made it hold references + rather than objects. + (WebCore::ComplexTextController::ComplexTextRun::create): + (WebCore::ComplexTextController::ComplexTextRun::glyphs): + (WebCore::ComplexTextController::ComplexTextRun::advances): + + * platform/graphics/mac/ComplexTextControllerATSUI.cpp: Added. Includes ATSUI-specific + parts of the ComplexTextController implementation. + (WebCore::ComplexTextController::ComplexTextRun::overrideLayoutOperation): This ATSUI + callback populates the ComplexTextRun’s glyphs, advances and indices vectors. It is invoked + when the ComplexTextRun constructor calls ATSUGetGlyphBounds(). + (WebCore::isArabicLamWithAlefLigature): Helper function, copied from FontMacATSUI.mm. + (WebCore::shapeArabic): Helper function, adapted from FontMacATSUI.mm. + (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Sets up the + ATSUTextLayout, substituting the text buffer if necessary for things like shaping Arabic, + mirroring glyphs or directionality overrides, then calls ATSUGetGlyphBounds() in order to + get the glyphs, advances and indices vectors populated. + (WebCore::fontHasMirroringInfo): Helper function, copied from FontMacATSUI.mm. + (WebCore::disableLigatures): Ditto. + (WebCore::initializeATSUStyle): Ditto, somewhat cleaned up and simplified. + (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Constructs + ComplexTextRuns, either missing-glyphs ones or ATSUTextLayout-based ones. + + * platform/graphics/mac/ComplexTextControllerCoreText.cpp: Copied from + CoreTextController.cpp and kept the Core Text-specific bits. + (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Updated for renames, + including its own, and moved the code to initialize m_glyphs and m_advances here. Previously + this was done in adjustGlyphsAndAdvances(). + (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Updated for renames, + including its own. + * platform/graphics/mac/CoreTextController.cpp: Removed. + * platform/graphics/mac/CoreTextController.h: Removed. + * platform/graphics/mac/FontComplexTextMac.cpp: Renamed FontMacCoreText.cpp to this. + (WebCore::Font::selectionRectForComplexText): Changed to use ComplexTextController instead + of CoreTextController. + (WebCore::Font::drawComplexText): Ditto. + (WebCore::Font::floatWidthForComplexText): Ditto. + (WebCore::Font::offsetForPositionForComplexText): Ditto. + * platform/graphics/mac/FontMacATSUI.mm: Removed. + * platform/graphics/mac/FontMacCoreText.cpp: Removed. + +2009-10-27 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + WAI-ARIA: add support for 'option' role + https://bugs.webkit.org/show_bug.cgi?id=30843 + + Test: accessibility/aria-option-role.html + + * accessibility/AccessibilityListBoxOption.h: + (WebCore::AccessibilityListBoxOption::canHaveChildren): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::RoleEntry::): + (WebCore::AccessibilityRenderObject::canHaveChildren): + +2009-10-28 Jens Alfke <snej@chromium.org> + + Reviewed by Eric Seidel. + + Fix GCC compiler warnings in WebCore, and enable -Wall and -Werror for Chromium build. + https://bugs.webkit.org/show_bug.cgi?id=30716 + + * WebCore.gyp/WebCore.gyp: Enable "chromium_code" flag, just on Mac build for now. + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::createARIARoleMap): Fix struct visibiity warning. + * bindings/v8/ScriptCallStack.h: Fix out-of-order member initialization warning. + * bindings/v8/V8Collection.h: + (WebCore::getV8Object): Function in header should not be 'static' (fixes unused-static warning.) + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::convertNewNodeToV8Object): Fix signed/unsigned comparison warning. + * bindings/v8/V8GCController.cpp: + (WebCore::ObjectGrouperVisitor::applyGrouping): Fix unused-variable warning. + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Enable ListButtonPart case to avoid + warning about missing cases in 'switch' statement. + * editing/EditorCommand.cpp: + (WebCore::createCommandMap): Fix struct visibiity warning. + * platform/graphics/skia/PlatformContextSkia.cpp: + (PlatformContextSkia::State::State): Fix out-of-order member initialization warning. + * rendering/RenderMediaControlsChromium.cpp: + (WebCore::RenderMediaControlsChromium::shouldRenderMediaControlPart): Add empty 'default' case in + 'switch' statement to avoid missing-case warning. + (WebCore::RenderMediaControlsChromium::paintMediaControlsPart): Ditto. + * xml/XPathFunctions.cpp: + (WebCore::XPath::createFunctionMap): Fix struct visibiity warning. + +2009-10-29 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + REGRESSION: crashes in WebCore::RedirectScheduler::timerFired(WebCore::Timer<WebCore::RedirectScheduler>*) + https://bugs.webkit.org/show_bug.cgi?id=30839 + + Added null check for the case when the frame is detached from the page. + + * loader/RedirectScheduler.cpp: + (WebCore::RedirectScheduler::timerFired): + +2009-10-28 Joanmarie Diggs <joanmarie.diggs@gmail.com> + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=30817 + Use parentObjectUnignored instead of parentObject in webkit_accessible_get_parent + + Also removes the hack I had originally added to solve bug 25411, because + the fix here is what I should have done in the first place. + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (webkit_accessible_get_parent): + +2009-10-28 Dmitry Titov <dimich@chromium.org> + + Reviewed by David Levin. + + https://bugs.webkit.org/show_bug.cgi?id=30805 + Add MessageQueue::removeIf(Predicate&) to remove certain tasks without pulling them from the queue. + Existing Database tests cover this, no change in functionality. + + * storage/DatabaseThread.cpp: + (WebCore::SameDatabasePredicate::SameDatabasePredicate): Added predicate that flags the tasks belonging to a specified database. + (WebCore::SameDatabasePredicate::operator()): + (WebCore::DatabaseThread::unscheduleDatabaseTasks): changed to use the new removeIf method. + +2009-10-28 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Glue subsequent timeline records with same category + and title together. + + https://bugs.webkit.org/show_bug.cgi?id=30885 + + * English.lproj/localizedStrings.js: + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype.addRecordToTimeline): + (WebInspector.TimelinePanel.prototype._formatRecord): + (WebInspector.TimelineRecordTreeElement.prototype.onattach): + (WebInspector.TimelineRecordTreeElement.prototype.refresh): + +2009-10-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + [GTK] Fails new test fast/js/navigator-language.html + https://bugs.webkit.org/show_bug.cgi?id=30440 + + Reimplement WebCore::defaultLanguage to account for changes in + locale done by setLocale. + + Already existing test: fast/js/navigator-language.html + + * platform/gtk/Language.cpp: + (WebCore::defaultLanguage): + +2009-10-28 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Simon Fraser. + + <rdar://problem/7303145> + Can't exit full screen mode or restart movie after pressing command -R. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::removedFromDocument): + (WebCore::HTMLMediaElement::documentWillBecomeInactive): + Exit from fullscreen if necessary. + * html/HTMLMediaElement.h: + +2009-10-28 Alexey Proskuryakov <ap@apple.com> + + Unreviewed - a trivial fix to get Windows bots running. + + https://bugs.webkit.org/show_bug.cgi?id=30841 + <rdar://problem/7342730> WebKit should not pass Referer header through a redirect to a non-secure site + + * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::setHeaderFields): Don't try to + access empty vector's data. + +2009-10-28 Joanmarie Diggs <joanmarie.diggs@gmail.com> + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=25897 + [Gtk] Extraneous object of ROLE_PANEL in hierarchy for entries + + Remove the extraneous object of ROLE_PANEL. + + * accessibility/gtk/AccessibilityObjectAtk.cpp: + (AccessibilityObject::accessibilityPlatformIncludesObject): + +2009-10-28 Jonathan Dixon <joth@chromium.org> + + Reviewed by Eric Seidel. + + Bug 30547: (Chromium) searchbox not rendered properly due to the css property -webkit-border-radius + https://bugs.webkit.org/show_bug.cgi?id=30547 + + Test: fast/css/text-input-with-webkit-border-radius.html + + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::paintTextFieldInternal): + Implemented rounded border rendering in Chromium Windows theme renderer. + +2009-10-28 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Pull items collections from resources panel and + timeline panel into AbstractTimelinePanel. + + https://bugs.webkit.org/show_bug.cgi?id=30875 + + * inspector/front-end/AbstractTimelinePanel.js: + (WebInspector.AbstractTimelinePanel): + (WebInspector.AbstractTimelinePanel.prototype.populateSidebar): + (WebInspector.AbstractTimelinePanel.prototype.createItemTreeElement): + (WebInspector.AbstractTimelinePanel.prototype.createItemGraph): + (WebInspector.AbstractTimelinePanel.prototype._showCategory): + (WebInspector.AbstractTimelinePanel.prototype._hideCategory): + (WebInspector.AbstractTimelinePanel.prototype.filter): + (WebInspector.AbstractTimelinePanel.prototype._createGraph): + (WebInspector.AbstractTimelinePanel.prototype.updateMainViewWidth): + (WebInspector.AbstractTimelinePanel.prototype.refresh): + (WebInspector.AbstractTimelinePanel.prototype.reset): + (WebInspector.AbstractTimelinePanel.prototype.get calculator): + (WebInspector.AbstractTimelinePanel.prototype.set calculator): + (WebInspector.AbstractTimelinePanel.prototype.addItem): + (WebInspector.AbstractTimelinePanel.prototype.removeItem): + (WebInspector.AbstractTimelinePanel.prototype.refreshItem): + (WebInspector.AbstractTimelinePanel.prototype.revealAndSelectItem): + (WebInspector.AbstractTimelinePanel.prototype.sortItems): + (WebInspector.AbstractTimelinePanel.prototype.adjustScrollPosition): + (WebInspector.AbstractTimelineCategory): + (WebInspector.AbstractTimelineCategory.prototype.toString): + * inspector/front-end/ResourceCategory.js: + (WebInspector.ResourceCategory): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel): + (WebInspector.ResourcesPanel.prototype.createItemTreeElement): + (WebInspector.ResourcesPanel.prototype.createItemGraph): + (WebInspector.ResourcesPanel.prototype.isCategoryVisible): + (WebInspector.ResourcesPanel.prototype.populateSidebar): + (WebInspector.ResourcesPanel.prototype.get searchableViews): + (WebInspector.ResourcesPanel.prototype.get searchResultsSortFunction.sortFuction): + (WebInspector.ResourcesPanel.prototype.get searchResultsSortFunction): + (WebInspector.ResourcesPanel.prototype.searchMatchFound): + (WebInspector.ResourcesPanel.prototype.searchCanceled): + (WebInspector.ResourcesPanel.prototype.performSearch): + (WebInspector.ResourcesPanel.prototype.refresh): + (WebInspector.ResourcesPanel.prototype.reset): + (WebInspector.ResourcesPanel.prototype.removeResource): + (WebInspector.ResourcesPanel.prototype.addMessageToResource): + (WebInspector.ResourcesPanel.prototype.clearMessages): + (WebInspector.ResourcesPanel.prototype.refreshResource): + (WebInspector.ResourcesPanel.prototype.recreateViewForResourceIfNeeded): + (WebInspector.ResourcesPanel.prototype.showResource): + (WebInspector.ResourcesPanel.prototype._sortResourcesIfNeeded): + (WebInspector.ResourcesPanel.prototype._toggleLargerResources): + (WebInspector.ResourcesPanel.prototype._toggleResourceTracking): + (WebInspector.ResourcesPanel.prototype.get _resources): + (WebInspector.ResourceTimeCalculator.prototype._upperBound): + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel): + (WebInspector.TimelinePanel.prototype.get categories): + (WebInspector.TimelinePanel.prototype.populateSidebar): + (WebInspector.TimelinePanel.prototype.addRecordToTimeline): + (WebInspector.TimelinePanel.prototype.createItemTreeElement): + (WebInspector.TimelinePanel.prototype.createItemGraph): + (WebInspector.TimelinePanel.prototype._formatRecord): + (WebInspector.TimelineCategory): + * inspector/front-end/inspector.css: + * inspector/front-end/inspector.html: + +2009-10-28 Kelly Norton <knorton@google.com> + + Reviewed by Pavel Feldman. + + Resets InspectorFrontend in InspectorTimelineAgent instead of removing it so + that it remains active on refreshs and page transitions. + https://bugs.webkit.org/show_bug.cgi?id=30874 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::setFrontendProxyObject): + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent::resetFrontendProxyObject): + * inspector/InspectorTimelineAgent.h: + +2009-10-27 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + Provide a way to get counter values with layoutTestContoller + https://bugs.webkit.org/show_bug.cgi?id=30555 + + Expose WebCore::counterValueForElement as a WebCore API. + + * WebCore.base.exp: + * rendering/RenderTreeAsText.cpp: + (WebCore::writeCounterValuesFromChildren): + (WebCore::counterValueForElement): + * rendering/RenderTreeAsText.h: + +2009-10-28 Nate Chapin <japhet@chromium.org> + + Unreviewed, Chromium build fix for r50225. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::defaultObjectContentType): + +2009-10-28 Eric Z. Ayers <zundel@google.com> + + Reviewed by Pavel Feldman. + + Adds InspectorTimelineAgent instrumentation for encountering a + <SCRIPT> tag when parsing an HTML document. + + https://bugs.webkit.org/show_bug.cgi?id=30861 + + * bindings/js/ScriptSourceCode.h: + (WebCore::ScriptSourceCode::ScriptSourceCode): + (WebCore::ScriptSourceCode::startLine): + (WebCore::ScriptSourceCode::url): + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::scriptHandler): + (WebCore::HTMLTokenizer::scriptExecution): + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent::willLoadXHR): + (WebCore::InspectorTimelineAgent::willScriptTag): + (WebCore::InspectorTimelineAgent::didScriptTag): + * inspector/InspectorTimelineAgent.h: + (WebCore::): + * inspector/TimelineRecordFactory.cpp: + (WebCore::TimelineRecordFactory::createScriptTagTimelineRecord): + * inspector/TimelineRecordFactory.h: + * inspector/front-end/TimelineAgent.js: + +2009-10-28 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + Makes sure that Geolocation watch IDs remain positive on overflow. + https://bugs.webkit.org/show_bug.cgi?id=30122 + + No new tests possible. + + * page/Geolocation.cpp: Modified. + (WebCore::Geolocation::watchPosition): Modified. Reset the watch ID to 1 on overflow. + +2009-10-28 George Staikos <george.staikos@torchmobile.com> + + Attempt to fix the Mac debug build after 50225. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::defaultObjectContentType): + +2009-10-28 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=30841 + <rdar://problem/7342730> WebKit should not pass Referer header through a redirect to a non-secure site + + Tests: http/tests/ssl/referer-301.html + http/tests/ssl/referer-303.html + + * platform/network/mac/ResourceHandleMac.mm: + (-[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:]): + Remove Referer header if redirecting from https to another protocol. + + * platform/network/ResourceRequestBase.cpp: + (WebCore::ResourceRequestBase::clearHTTPReferrer): Update request counterparts, as it is + always done when changing or adding header fields. + (WebCore::ResourceRequestBase::clearHTTPOrigin): Ditto. + + * platform/network/ResourceRequestBase.h: clearHTTPReferrer() and clearHTTPOrigin() are + no longer inline, since they have non-trivial implementations. + + * platform/network/mac/ResourceRequestMac.mm: + (WebCore::ResourceRequest::doUpdatePlatformRequest): Fixed to synchronize header field removals. + (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto. + + * platform/network/cf/ResourceHandleCFNet.cpp: + (WebCore::willSendRequest): + * platform/network/cf/ResourceRequestCFNet.cpp: + (WebCore::setHeaderFields): + (WebCore::ResourceRequest::doUpdatePlatformRequest): + (WebCore::ResourceRequest::doUpdateResourceRequest): + Match Mac changes. + +2009-10-28 Joe Mason <jmason@rim.com> + + Reviewed by Adam Treat. + + Add FrameLoader::defaultObjectContentType, containing common code for + implementing FrameLoaderClient::objectContentType. (Currently the gtk + and win ports have copied this code, and the qt port uses similar code + with a few extra clauses. Moving this to a utility function cuts down + on copied code.) This causes no behavioural change. + + https://bugs.webkit.org/show_bug.cgi?id=30868 + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::defaultObjectContentType): + * loader/FrameLoader.h: + +2009-10-28 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + [Qt] QWebHistory::saveState() is inconsistent with the Qt API + https://bugs.webkit.org/show_bug.cgi?id=30710 + + Enforce the versioning, by ignoring any version different + from 1. + + * history/qt/HistoryItemQt.cpp: + (WebCore::HistoryItem::restoreState): + (WebCore::HistoryItem::saveState): + +2009-10-28 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: follow up fix to InspectorControllerStub. + Define it after inspector.js due to namespace + + https://bugs.webkit.org/show_bug.cgi?id=30866 + + * inspector/front-end/inspector.html: + +2009-10-28 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Add InspectorController stub in order to + support opening in standalone mode. + + https://bugs.webkit.org/show_bug.cgi?id=30866 + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/InspectorControllerStub.js: Added. + (.WebInspector.InspectorControllerStub): + (.WebInspector.InspectorControllerStub.prototype.wrapCallback): + (.WebInspector.InspectorControllerStub.prototype.isWindowVisible): + (.WebInspector.InspectorControllerStub.prototype.platform): + (.WebInspector.InspectorControllerStub.prototype.closeWindow): + (.WebInspector.InspectorControllerStub.prototype.attach): + (.WebInspector.InspectorControllerStub.prototype.detach): + (.WebInspector.InspectorControllerStub.prototype.storeLastActivePanel): + (.WebInspector.InspectorControllerStub.prototype.clearMessages): + (.WebInspector.InspectorControllerStub.prototype.searchingForNode): + (.WebInspector.InspectorControllerStub.prototype.search): + (.WebInspector.InspectorControllerStub.prototype.toggleNodeSearch): + (.WebInspector.InspectorControllerStub.prototype.setAttachedWindowHeight): + (.WebInspector.InspectorControllerStub.prototype.moveByUnrestricted): + (.WebInspector.InspectorControllerStub.prototype.addResourceSourceToFrame): + (.WebInspector.InspectorControllerStub.prototype.addSourceToFrame): + (.WebInspector.InspectorControllerStub.prototype.getResourceDocumentNode): + (.WebInspector.InspectorControllerStub.prototype.highlightDOMNode): + (.WebInspector.InspectorControllerStub.prototype.hideDOMNodeHighlight): + (.WebInspector.InspectorControllerStub.prototype.inspectedWindow): + (.WebInspector.InspectorControllerStub.prototype.loaded): + (.WebInspector.InspectorControllerStub.prototype.localizedStringsURL): + (.WebInspector.InspectorControllerStub.prototype.windowUnloading): + (.WebInspector.InspectorControllerStub.prototype.hiddenPanels): + (.WebInspector.InspectorControllerStub.prototype.debuggerEnabled): + (.WebInspector.InspectorControllerStub.prototype.enableResourceTracking): + (.WebInspector.InspectorControllerStub.prototype.disableResourceTracking): + (.WebInspector.InspectorControllerStub.prototype.resourceTrackingEnabled): + (.WebInspector.InspectorControllerStub.prototype.enableDebugger): + (.WebInspector.InspectorControllerStub.prototype.disableDebugger): + (.WebInspector.InspectorControllerStub.prototype.addBreakpoint): + (.WebInspector.InspectorControllerStub.prototype.removeBreakpoint): + (.WebInspector.InspectorControllerStub.prototype.updateBreakpoint): + (.WebInspector.InspectorControllerStub.prototype.pauseInDebugger): + (.WebInspector.InspectorControllerStub.prototype.pauseOnExceptions): + (.WebInspector.InspectorControllerStub.prototype.setPauseOnExceptions): + (.WebInspector.InspectorControllerStub.prototype.resumeDebugger): + (.WebInspector.InspectorControllerStub.prototype.profilerEnabled): + (.WebInspector.InspectorControllerStub.prototype.enableProfiler): + (.WebInspector.InspectorControllerStub.prototype.disableProfiler): + (.WebInspector.InspectorControllerStub.prototype.startProfiling): + (.WebInspector.InspectorControllerStub.prototype.stopProfiling): + (.WebInspector.InspectorControllerStub.prototype.getProfileHeaders): + (.WebInspector.InspectorControllerStub.prototype.getProfile): + (.WebInspector.InspectorControllerStub.prototype.takeHeapSnapshot): + (.WebInspector.InspectorControllerStub.prototype.databaseTableNames): + (.WebInspector.InspectorControllerStub.prototype.stepIntoStatementInDebugger): + (.WebInspector.InspectorControllerStub.prototype.stepOutOfFunctionInDebugger): + (.WebInspector.InspectorControllerStub.prototype.stepOverStatementInDebugger): + (.WebInspector.InspectorControllerStub.prototype.setSetting): + (.WebInspector.InspectorControllerStub.prototype.dispatchOnInjectedScript): + (.WebInspector.InspectorControllerStub.prototype.releaseWrapperObjectGroup): + (.WebInspector.InspectorControllerStub.prototype.setting): + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + (WebInspector.UIString): + +2009-10-28 Joanmarie Diggs <joanmarie.diggs@gmail.com> + + Reviewed by Jan Alonzo. + + https://bugs.webkit.org/show_bug.cgi?id=25897 + [Gtk] Extraneous object of ROLE_PANEL in hierarchy for entries + + Expands upon the new funtionality which allows platforms to indicate + that a particular object should not be ignored, so that they can + specify that an object should be ignored or that it should be left up + to the default handling to decide. + + * accessibility/AccessibilityObject.h: + * accessibility/chromium/AccessibilityObjectChromium.cpp: + * accessibility/gtk/AccessibilityObjectAtk.cpp: + * accessibility/mac/AccessibilityObjectMac.mm: + * accessibility/qt/AccessibilityObjectQt.cpp: + * accessibility/win/AccessibilityObjectWin.cpp: + * accessibility/wx/AccessibilityObjectWx.cpp: + (AccessibilityObject::accessibilityPlatformIncludesObject): + * accessibility/AccessibilityRenderObject.cpp: + (AccessibilityRenderObject::accessibilityIsIgnored): + + +2009-10-28 Joanmarie Diggs <joanmarie.diggs@gmail.com> + + Reviewed by Jan Alonzo. + + https://bugs.webkit.org/show_bug.cgi?id=25534 + [GTK] Objects of ROLE_TABLE should implement the accessible table interface + + Expose the table summary as the accessible description because there is no summary object. + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (webkit_accessible_get_description): + +2009-10-28 Steve Block <steveblock@google.com> + + Reviewed by Eric Seidel. + + Adds ScriptController::intializeThreading(), with both JSC and V8 implementations. + https://bugs.webkit.org/show_bug.cgi?id=30678 + + This new method is used from common code, rather than calling JSC::initializeThreading() (or the V8 equivalent) directly. + + Build fix, no new tests required. + + * bindings/js/ScriptController.cpp: Modified. + (WebCore::ScriptController::initializeThreading): Added. + * bindings/js/ScriptController.h: Modified. Adds ScriptController::initializeThreading(). + * bindings/v8/ScriptController.cpp: Modified. + (WebCore::ScriptController::initializeThreading): Added. + * bindings/v8/ScriptController.h: Modified. Adds ScriptController::initializeThreading(). + * loader/icon/IconDatabase.cpp: Modified. + (WebCore::iconDatabase): Call ScriptController::initializeThreading(), rather than JSC::initializeThreading(). + * storage/Database.cpp: Modified. + (WebCore::Database::Database): Call ScriptController::initializeThreading(), rather than JSC::initializeThreading(). + +2009-10-26 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Darin Adler. + + Document a feature of the m_liveDecodedResources list. + https://bugs.webkit.org/show_bug.cgi?id=30209 + + The code made the assumption that the list is sorted by + the m_lastDecodedAccessTime property of the CachedResource. + The above is not true when CachedResource::setDecodedSize + is called and the item is inserted the first time. In this + case the m_lastDecodedAccessTime is still zero and the + m_liveDecodedResources list becomes unsorted. + + It is impossible that Cache::pruneLiveResources will + stop to process the list too early due this feature and + the alternatives of updating m_lastDecodedAccessTime in + CachedResource::setDecodedSize or changing the insert + to search the right position have a negative impact on + performance. The best solution for now is to document + this feature. + + * loader/Cache.cpp: + (WebCore::Cache::pruneLiveResources): + * loader/CachedResource.cpp: + (WebCore::CachedResource::setDecodedSize): + +2009-10-28 Xan Lopez <xlopez@igalia.com> + + Reviewed by Jan Alonzo. + + [Gtk] Extraneous object of ROLE_PANEL in hierarchy for entries + https://bugs.webkit.org/show_bug.cgi?id=25897 + + Make text controls always implement the text interface, and the + editable text interface when they are not read only. This is what + ATK-users expect. + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (getInterfaceMaskFromObject): + +2009-10-27 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Simon Fraser. + + Change HitTestResult methods to use (3d) transformation aware methods + https://bugs.webkit.org/show_bug.cgi?id=27347 + + The current HitTestResult methods are not using the (3d) + transformation aware routines. This can lead to an assertion + SVGRenderBase::mapLocalToContainer method. + + Change HitTestResult::imageRect to use the (3d) transformation + aware RenderBox::absoluteContentQuad to avoid running into + an assertion with SVG content. + + Remove HitTestResult::boundingBox() as it is only used in + two places and conceptually doesn't belong into a HitTest + which is operating on points. + + A classic test case is not possible as the methods are not excercised + from within HTML/SVG but from the WebKit API Layer. A unittest + for Qt/Gtk+/Mac would need to be written but Qt/Gtk+ currently + do not support 3d transformations making it impossible to write + a reliable test case and the Mac port is currently not doing + unit testing. + + + * rendering/HitTestResult.cpp: Remove boundingBox() method + (WebCore::HitTestResult::imageRect): Use transformation aware method + * rendering/HitTestResult.h: Remove boundingBox() + +2009-10-26 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Eric Seidel. + + [Qt] Custom Cursor doesn't use hotspot. + https://bugs.webkit.org/show_bug.cgi?id=30820 + + Cursors loaded from a QPixmap didn't specifiy the + hotspot. Take the hotspot values from the mac + implementation. + + * platform/qt/CursorQt.cpp: + +2009-10-27 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Initial revision of the Timeline grid. + + https://bugs.webkit.org/show_bug.cgi?id=30834 + + * English.lproj/localizedStrings.js: + * WebCore.gypi: + * inspector/front-end/AbstractTimelinePanel.js: + (WebInspector.AbstractTimelinePanel.prototype.populateSidebar): + (WebInspector.AbstractTimelinePanel.prototype.refresh): + (WebInspector.AbstractTimelineCalculator): + * inspector/front-end/Images/timelineBarBlue.png: Added. + * inspector/front-end/Images/timelineBarGray.png: Added. + * inspector/front-end/Images/timelineBarGreen.png: Added. + * inspector/front-end/Images/timelineBarOrange.png: Added. + * inspector/front-end/Images/timelineBarPurple.png: Added. + * inspector/front-end/Images/timelineBarRed.png: Added. + * inspector/front-end/Images/timelineBarYellow.png: Added. + * inspector/front-end/Images/timelineCheckmarks.png: Added. + * inspector/front-end/Images/timelineDots.png: Added. + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourceTimeCalculator): + (WebInspector.ResourceTransferSizeCalculator): + * inspector/front-end/TimelineAgent.js: + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel): + (WebInspector.TimelinePanel.prototype.get statusBarItems): + (WebInspector.TimelinePanel.prototype.get categories): + (WebInspector.TimelinePanel.prototype.populateSidebar): + (WebInspector.TimelinePanel.prototype._createStatusbarButtons): + (WebInspector.TimelinePanel.prototype.addItemToTimeline): + (WebInspector.TimelinePanel.prototype.refresh): + (WebInspector.TimelinePanel.prototype._toggleTimelineButtonClick): + (WebInspector.TimelinePanel.prototype.reset): + (WebInspector.TimelinePanel.prototype._formatRecord): + (WebInspector.TimelinePanel.prototype.showCategory): + (WebInspector.TimelinePanel.prototype.hideCategory): + (WebInspector.TimelineRecordTreeElement): + (WebInspector.TimelineRecordTreeElement.prototype.onattach): + (WebInspector.TimelineCalculator): + (WebInspector.TimelineCalculator.prototype.computeBarGraphPercentages): + (WebInspector.TimelineCalculator.prototype.computePercentageFromEventTime): + (WebInspector.TimelineCalculator.prototype.computeBarGraphLabels): + (WebInspector.TimelineCalculator.prototype.updateBoundaries): + (WebInspector.TimelineCalculator.prototype.formatValue): + (WebInspector.TimelineGraph): + (WebInspector.TimelineGraph.prototype.get graphElement): + (WebInspector.TimelineGraph.prototype.refreshLabelPositions): + (WebInspector.TimelineGraph.prototype.refresh): + * inspector/front-end/inspector.css: + * inspector/front-end/inspector.js: + (WebInspector._createPanels): + +2009-10-27 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Move runAfterPendingDispatches to TestController for Clarity + https://bugs.webkit.org/show_bug.cgi?id=30844 + + * inspector/front-end/TestController.js: + (WebInspector.TestController.prototype.runAfterPendingDispatches): + * inspector/front-end/inspector.js: moved runAfterPendingDispatches + +2009-10-27 Darin Fisher <darin@chromium.org> + + Reviewed by Dimitri Glazkov. + + Add missing forward declaration of FramelessScrollView. + https://bugs.webkit.org/show_bug.cgi?id=30824 + + * platform/chromium/FramelessScrollViewClient.h: + +2009-10-27 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Adele Peterson. + + WAI-ARIA: add support for 'presentation' role + https://bugs.webkit.org/show_bug.cgi?id=30806 + + Test: accessibility/aria-presentational-role.html + + * accessibility/AccessibilityObject.h: + (WebCore::): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): + (WebCore::RoleEntry::): + +2009-10-27 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + ARIA menu/menu item need AXRoleDescription + https://bugs.webkit.org/show_bug.cgi?id=30804 + + Make sure that role descriptions will default to the system's first, before + returning an unknown role. + + Test: platform/mac/accessibility/aria-menu-role-descriptions.html + + * accessibility/mac/AccessibilityObjectWrapper.mm: + (-[AccessibilityObjectWrapper roleDescription]): + +2009-10-27 Geoffrey Garen <ggaren@apple.com> + + Qt build fix: migrated away from API that no longer exists. + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertQVariantToValue): + +2009-10-27 Geoffrey Garen <ggaren@apple.com> + + Qt build fix: migrated away from API that no longer exists. + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + +2009-10-27 Oliver Hunt <oliver@apple.com> + + Fix wording in comment. + + * bridge/objc/objc_instance.mm: + (allocateAutoReleasePool): + +2009-10-27 Oliver Hunt <oliver@apple.com> + + Reviewed by Darin Adler. + + Crash occurs after launching Newsfire 1.6 for the first time + https://bugs.webkit.org/show_bug.cgi?id=30807 + + We allocate an autorelease pool but then store it off the stack. In a + GC environment this led to it being collected, and thus caused badness + to ensue. To work around this we simply avoid using a pool at all in + a GC environment as it would be a no-op anyway. + + * bridge/objc/objc_instance.mm: + (allocateAutoReleasePool): + (ObjcInstance::virtualBegin): + +2009-10-27 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + When a Geolocation method is called, immediately calls the error calback asynchronously if permissions + have already been denied. + https://bugs.webkit.org/show_bug.cgi?id=27944. + + Tests: fast/dom/Geolocation/permission-denied-already-error.html + fast/dom/Geolocation/permission-denied-already-success.html + + * page/Geolocation.cpp: Modified. + (WebCore::Geolocation::GeoNotifier::GeoNotifier): Modified. GeoNotifier takes Geolocation object as constructor argument. + (WebCore::Geolocation::GeoNotifier::setFatalError): Added. Sets a fatal error for this notifier, causing it to terminate immediately and call the error callback asynchronously. + (WebCore::Geolocation::GeoNotifier::timerFired): Added. Used to call the error callback asynchronously on fatal error. + (WebCore::Geolocation::getCurrentPosition): Modified. Calls startRequest. + (WebCore::Geolocation::watchPosition): Modified. Calls startRequest. + (WebCore::Geolocation::startRequest): Added. Common functionality for starting a one-shot or watch request. Sets a fatal error on the notifier if permissions have already been denied. + (WebCore::Geolocation::fatalErrorOccurred): Added. Registers that a notifier has encountered a fatal error and should be destroyed. + (WebCore::Geolocation::setIsAllowed): Modified. Uses a standard error message for the error callback when permissions are denied. + * page/Geolocation.h: Modified. + (WebCore::Geolocation::isDenied): Added. Determines whether permissions have been denied. + +2009-10-27 Chris Marrin <cmarrin@apple.com> + + Reviewed by Oliver Hunt. + + Fixed a bug where I was using the wrong Canvas pointer to do a cross-domain check + https://bugs.webkit.org/show_bug.cgi?id=30840 + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::drawImage): + +2009-10-27 Eric Seidel <eric@webkit.org> + + Reviewed by Nikolas Zimmermann. + + SVGStyledElement::getPresentationAttribute() can return a shared CSSValue (some SVG tests randomly fail on the bot, and in release builds) + https://bugs.webkit.org/show_bug.cgi?id=29620 + + SVG was modifying CSSValues cached of off CSSMappedAttributeDeclarations. + This patch fixes the check to make sure that a new CSSMappedAttributeDeclaration is + created before returning a CSSValue that JavaScript can modify. + + Test: svg/dom/getPresentationAttribute-cache-corruption.svg + + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::getPresentationAttribute): + +2009-10-27 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + Incomplete repaint of text field in relative positioned inline at imdb.com + https://bugs.webkit.org/show_bug.cgi?id=30047 + + Test: fast/repaint/inline-relative-positioned.html + + Implemented offsetFromContainer(), mapLocalToContainer() and + mapAbsoluteToLocalPoint() in RenderInline. + + * rendering/RenderBox.h: Fixed argument names in the declaration of + mapLocalToContainer(). + * rendering/RenderInline.cpp: + (WebCore::RenderInline::offsetFromContainer): + (WebCore::RenderInline::mapLocalToContainer): + (WebCore::RenderInline::mapAbsoluteToLocalPoint): + * rendering/RenderInline.h: + +2009-10-27 Jeremy Orlow <jorlow@chromium.org> + + Speculative build fix for Chromium. + + * platform/graphics/GraphicsContext3D.h: + +2009-10-27 Chris Marrin <cmarrin@apple.com> + + Reviewed by Simon Fraser. + + Make WebGL context failure more robust and make it succeed in more cases + https://bugs.webkit.org/show_bug.cgi?id=30349 + + Bubble a failure to get a CGLContext up to HTMLContextElement so it can + return null from getContext. Also added a more robust pixel format choosing + mechanism and can render correctly when a SW renderer is chosen. + + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::getContext): + * html/canvas/CanvasRenderingContext.h: + * html/canvas/CanvasRenderingContext2D.cpp: + * html/canvas/CanvasRenderingContext3D.cpp: + * html/canvas/CanvasRenderingContext3D.h: + (WebCore::CanvasRenderingContext3D::graphicsContext3D): + (WebCore::CanvasRenderingContext3D::cleanupAfterGraphicsCall): + * platform/graphics/GraphicsContext3D.h: + * platform/graphics/mac/Canvas3DLayer.mm: + (-[Canvas3DLayer copyCGLPixelFormatForDisplayMask:]): + * platform/graphics/mac/GraphicsContext3DMac.cpp: + (WebCore::setPixelFormat): + (WebCore::GraphicsContext3D::create): + (WebCore::GraphicsContext3D::GraphicsContext3D): + (WebCore::GraphicsContext3D::~GraphicsContext3D): + (WebCore::GraphicsContext3D::reshape): + (WebCore::ensureContext): + +2009-10-27 Geoffrey Garen <ggaren@apple.com> + + Mac build fix: a forwarding header. + + * ForwardingHeaders/wtf/DateInstanceCache.h: Added. + +2009-10-27 Ryosuke Niwa <rniwa@webkit.org> + + No Review. + + Making fontWeightIsBold static to fix Snow Leopard build. + + * editing/ApplyStyleCommand.cpp: + (WebCore::fontWeightIsBold): + +2009-10-27 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Eric Seidel. + + WebKit cannot remove nested bold tags + https://bugs.webkit.org/show_bug.cgi?id=30784 + + This patch modifies getPropertiesNotInComputedStyle so that it compares font-weight + more flexibly. Instead of comparing cssText, it uses fontWeightIsBold which converts + all font weights to either bold or unbold state. + + * editing/ApplyStyleCommand.cpp: + (WebCore::fontWeightIsBold): + (WebCore::getPropertiesNotInComputedStyle): Removes font-weight property + if two style have the same value under getFontWeightValue + +2009-10-27 Carol Szabo <carol.szabo@nokia.com> + + Reviewed by Darin Adler. + + Give an ability to WebKit to free statically allocated pointers + before quit. + https://bugs.webkit.org/show_bug.cgi?id=27980 + + No new tests for this as the change does not affect WebKit + functionality, but only memory usage. + + * JavaScriptCore/wtf/StdLibExtras.h: + Allowed for the override of DEFINE_STATIC_LOCAL via compiler + commandline options or elsewhere in the code. Useful for + implementing custom builds that free resources allocated via + DEFINE_STATIC_LOCAL. + +2009-10-27 Dumitru Daniliuc <dumi@chromium.org> + + Build fix, no review needed. + + Fixing the BUILD. m_estimatedSize in Database.h should be of type + 'unsigned long' instead of 'unsigned long long'. + + No tests required. + + * storage/Database.h: + +2009-10-27 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Refactoring the Database class to not depend on + OriginQuotaManager. Also, adding a SecurityOrigin copy to each + Database instance, that is safe to use on the file + thread. Finally, adding new simple fields and getters to the + Database object for storing/getting the display name and estimated + size specified by the user in the openDatabase() call. + + https://bugs.webkit.org/show_bug.cgi?id=30548 + + * page/SecurityOrigin.h: + * storage/Database.cpp: + (WebCore::Database::openDatabase): Storing the display name and + the estimated size in the Database object. + (WebCore::Database::Database): Storing the display name and the + estimated size in the Database object, as well as a SecurityOrigin + instance that is safe to use on the DB thread. + (WebCore::Database::maximumSize): Delegate the call to + DatabaseTracker::getMaxSizeForDatabase(). + (WebCore::Database::databaseThreadSecurityOrigin): Return the + SecurityOrigin instance that's safe to use on the DB thread. + (WebCore::Database::threadSafeSecurityOrigin): Return the + SecurityOrigin instance that's safe to use on the current thread. + (WebCore::Database::displayName): Return the display name + specified by the user in the openDatabase() call. + (WebCore::Database::estimatedSize): Return the estimated size + specified by the user in the openDatabase() call. + (WebCore::Database::fileName): Return the name of the file where + the current Database is tored. + * storage/Database.h: + * storage/DatabaseTracker.cpp: + (WebCore::DatabaseTracker::getMaxSizeForDatabase): Returns the + maximum size for a DB file based on the current size of that file + and the space available for that origin. + * storage/DatabaseTracker.h: + * storage/SQLTransaction.cpp: + * storage/SQLTransactionClient.cpp: + (WebCore::SQLTransactionClient::didCommitTransaction): Use the + correct SecurityOrigin instance. + +2009-10-27 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Pretty Print all HTML Collection Types like we do for NodeList + https://bugs.webkit.org/show_bug.cgi?id=30709 + + Test: inspector/console-format-collections.html + + * inspector/front-end/InjectedScript.js: + (Object.type): check for instances of HTMLCollection like we do for NodeList + * inspector/front-end/inspector.js: added WebInspector.pendingDispatches counter + (WebInspector.dispatch): increment and decrement dispatch counter + (WebInspector.runAfterPendingDispatches): run when there are no more dispatches + +2009-10-27 Kelly Norton <knorton@google.com> + + Reviewed by Timothy Hatcher. + + Adds XMLHttpRequest support to InspectorTimelineAgent. + https://bugs.webkit.org/show_bug.cgi?id=30578 + + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent::willChangeXHRReadyState): + (WebCore::InspectorTimelineAgent::didChangeXHRReadyState): + (WebCore::InspectorTimelineAgent::willLoadXHR): + (WebCore::InspectorTimelineAgent::didLoadXHR): + * inspector/InspectorTimelineAgent.h: + (WebCore::): + * inspector/TimelineRecordFactory.cpp: + (WebCore::TimelineRecordFactory::createXHRReadyStateChangeTimelineRecord): + (WebCore::TimelineRecordFactory::createXHRLoadTimelineRecord): + * inspector/TimelineRecordFactory.h: + * inspector/front-end/TimelineAgent.js: + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::callReadyStateChangeListener): + +2009-10-27 Enrica Casucci <enrica@apple.com> + + Reviewed by Adele Peterson. + + REGRESSION (Safari 4.0.3-ToT): After pressing Shift-PageDown, pressing Shift-Up + extends the top of the selection upwards (but should shrink the selection instead) + <rdar://problem/7269075> + https://bugs.webkit.org/show_bug.cgi?id=29981 + + * editing/SelectionController.cpp: + (WebCore::SelectionController::modify): Added setting m_lastChangeWasHorizontalExtension. + +2009-10-27 Brian Weinstein <bweinstein@apple.com> + + Rubber-stamped by Tim Hatcher. + + Removed an extra console.log from ElementsTreeOutline. + + * inspector/front-end/ElementsTreeOutline.js: + +2009-10-27 Keishi Hattori <casey.hattori@gmail.com> + + Reviewed by Timothy Hatcher. + + Rewrote JavaScriptSourceSyntaxHighlighter to be more accurate + https://bugs.webkit.org/show_bug.cgi?id=27147 + + Tests: LayoutTests/inspector/javascript-syntax-highlight.html + + * inspector/front-end/ElementsTreeOutline.js: + * inspector/front-end/SourceFrame.js: + (WebInspector.JavaScriptSourceSyntaxHighlighter.process): Added. Processes 100 tokens at a time. + (WebInspector.JavaScriptSourceSyntaxHighlighter.lex): Added. Scans for a token. + (WebInspector.JavaScriptSourceSyntaxHighlighter.appendNonToken): Added. Appends the non-token characters that lex ignored. + (WebInspector.JavaScriptSourceSyntaxHighlighter.syntaxHighlightNode): Added. To syntax highlight node in ElementsTreeOutline. + +2009-10-27 Mads Ager <ager@chromium.org> + + Reviewed by Adam Barth. + + [V8] Missing null check after string conversion in error reporting + https://bugs.webkit.org/show_bug.cgi?id=30774 + + Add null check after string conversion in error reporting code. + ToString conversion can fail for instance when an exception is + thrown during conversion. + + Test: fast/dom/error-to-string-stack-overflow.html + + * bindings/v8/V8Utilities.cpp: + (WebCore::reportException): + +2009-10-27 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + Use a pair of maps to store Geolocation watchers. + https://bugs.webkit.org/show_bug.cgi?id=29178 + + The pair of maps allows us to look up a watcher either by its ID or by its GeoNotifier object. + The ability to look up by a watcher by its GeoNotifier object will be required when implementing + Geolocation::fatalErrorOccurred. See https://bugs.webkit.org/show_bug.cgi?id=27944 + + * page/Geolocation.cpp: Modified. + (WebCore::Geolocation::Watchers::set): Added. Adds a watcher with the given ID. + (WebCore::Geolocation::Watchers::remove): Added. Removes a watcher by ID. + (WebCore::Geolocation::Watchers::remove): Added. Removes a watcher by GeoNotifier object. + (WebCore::Geolocation::Watchers::clear): Added. Removes all watchers. + (WebCore::Geolocation::Watchers::isEmpty): Added. Determines if there are no watchers. + (WebCore::Geolocation::Watchers::getNotifiersVector): Added. Gets a vector of the GeoNotifier objects. + (WebCore::Geolocation::watchPosition): Modified. Rename watcher identifier static variable. + (WebCore::Geolocation::stopTimersForWatchers): Modified. Use Watchers::getNotifiersVector. + (WebCore::Geolocation::handleError): Modified. Use Watchers::getNotifiersVector. + (WebCore::Geolocation::makeSuccessCallbacks): Modified. Use Watchers::getNotifiersVector. + * page/Geolocation.h: Modified. Adds Geolocation::Watchers class. + +2009-10-27 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Dimitri Glazkov. + + [V8] DOM Storage runtime flag should default to on + https://bugs.webkit.org/show_bug.cgi?id=30828 + + The DOM Storage runtime flag was supposed to default to on. I accidentally + changed the logic to default to false when I moved the flag. + + * bindings/v8/RuntimeEnabledFeatures.cpp: + +2009-10-27 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Dimitri Glazkov. + + Fix crash found in chromium test_shell. + https://bugs.webkit.org/show_bug.cgi?id=30808 + + When WebSocket is deleted without close, webkit would crash + when it handles didClose. + + Check scriptExecutionContext before post task for event. + Use WebSocketChannel::disconnect() instead of close() in WebSocket + destructor, so that WebSocketChannel should not call deleted WebSocket + back in didClose(). + To make sure WebSocketChannel alive while it is processing WebSocket + protocol over SocketStreamHandle, ref() in connect() and deref() in + didClose(). + + * websockets/WebSocket.cpp: + (WebCore::WebSocket::~WebSocket): + (WebCore::WebSocket::didConnect): + (WebCore::WebSocket::didReceiveMessage): + (WebCore::WebSocket::didClose): + * websockets/WebSocketChannel.cpp: + (WebCore::WebSocketChannel::connect): + (WebCore::WebSocketChannel::disconnect): + (WebCore::WebSocketChannel::didClose): + (WebCore::WebSocketChannel::didReceiveData): + * websockets/WebSocketChannel.h: + +2009-10-27 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + Updated Apple license + + * LICENSE-APPLE: + +2009-10-27 Brady Eidson <beidson@apple.com> + + Rubberstamped by Sam Weinig. + + Re-enable the check that disallows pages with unload handlers in the page cache. + + <rdar://problem/7196485> and http://webkit.org/b/29021 + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::canCachePageContainingThisFrame): + (WebCore::FrameLoader::logCanCacheFrameDecision): + +2009-10-27 Timothy Hatcher <timothy@apple.com> + + Remove more empty files that didn't get removed earlier. + + * inspector/DOMDispatchTimelineItem.cpp: Removed. + * inspector/DOMDispatchTimelineItem.h: Removed. + +2009-10-27 Andras Becsi <becsi.andras@stud.u-szeged.hu> + + Reviewed by Tor Arne Vestbø. + + [Qt] Fix assertion crashes introduced by changes made in r50110. + + * dom/XMLTokenizerQt.cpp: + (WebCore::XMLTokenizer::parseEndElement): only call popCurrentNode() if there are nodes left in the stack. + +2009-10-27 Timothy Hatcher <timothy@apple.com> + + Remove empty files that didn't get removed earlier. + + * inspector/TimelineItem.cpp: Removed. + * inspector/TimelineItem.h: Removed. + +2009-10-27 Joanmarie Diggs <joanmarie.diggs@gmail.com> + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=25534 + [GTK] Objects of ROLE_TABLE should implement the accessible table interface + + First part of the implementation of AtkTable. + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (getCell): + (getCellIndex): + (webkit_accessible_table_ref_at): + (webkit_accessible_table_get_index_at): + (webkit_accessible_table_get_n_columns): + (webkit_accessible_table_get_n_rows): + (webkit_accessible_table_get_column_extent_at): + (webkit_accessible_table_get_row_extent_at): + (webkit_accessible_table_get_row_header): + (atk_table_interface_init): + (AtkInterfacesInitFunctions): + (GetAtkInterfaceTypeFromWAIType): + +2009-10-27 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Lars Knoll. + + [Qt] Don't lose remainder when computing wheel event deltas + + * platform/qt/WheelEventQt.cpp: + +2009-10-27 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Antti Koivisto. + + Fix QtWebKit build for WIN_OS if Netscape plug-in support + is turned off and refactor some related code + https://bugs.webkit.org/show_bug.cgi?id=30786 + + No new tests as there is no new functionality introduced. + + * platform/FileSystem.h: Refactor to make sure that each different + type definition is only repeated once. + + * plugins/PluginPackage.cpp: + (WebCore::PluginPackage::compareFileVersion): Move it out from the + ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH guard and combine it with the + function body from PluginPackageWin. + + * plugins/win/PluginPackageWin.cpp: Remove compareFileVersion as + it is now in PluginPackage.cpp. + +2009-10-26 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + https://bugs.webkit.org/show_bug.cgi?id=27011 + [Gtk] Implement support for get_index_in_parent + + Implement atk_object_get_index_in_parent. + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (webkit_accessible_get_index_in_parent): + +2009-10-27 Eric Seidel <eric@webkit.org> + + No review, rolling out r50131. + http://trac.webkit.org/changeset/50131 + + * bridge/objc/objc_instance.h: + * bridge/objc/objc_instance.mm: + (ObjcInstance::ObjcInstance): + (ObjcInstance::virtualEnd): + +2009-10-26 Daniel Bates <dbates@webkit.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=30491 + + Fixes an issue where pressing return/enter on the keyboard + in <isindex> does not submit it if is not within a <form>. + + According to the HTML 2.0 thru HTML 4.01 spec + (http://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.5), the + <isindex> element does not need to be within a <form> element in + order to submit it. It can submitted on its own. Also, if present, + the href property of the <base> element will dictate where to submit + the value of the <isindex> element (this is analogous to the action + property of the <form> element). + + Tests: http/tests/misc/isindex-with-no-form-base-href.html + http/tests/misc/isindex-with-no-form.html + + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::defaultEventHandler): Calls createTemporaryFormForIsIndex() + to create a <form> if none is present and we are an <isindex> element. + (WebCore::HTMLInputElement::createTemporaryFormForIsIndex): Added. + * html/HTMLInputElement.h: + +2009-10-26 Oliver Hunt <oliver@apple.com> + + Reviewed by Maciej Stachowiak. + + Crash occurs after launching Newsfire 1.6 for the first time + https://bugs.webkit.org/show_bug.cgi?id=30807 + + Use a RetainPtr in ObjcBinding to ensure that we adequately + protect the autorelease pool from GC in GC'd applications. + + * bridge/objc/objc_instance.h: + * bridge/objc/objc_instance.mm: + (ObjcInstance::ObjcInstance): + (ObjcInstance::virtualEnd): + +2009-10-26 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed. + + [Qt] Build fix for QtWebKit after r50125. + + * WebCore.pro: Rename TimelineItem to TimelineRecord. + +2009-10-26 Matt Mueller <mattm@chromium.org> + + Reviewed by Darin Adler. + + Refactor synchronizable property handling to store one shouldSynchronize flag per set of properties rather than one per property. + + Fixes reading uninitialized memory in SynchronizableProperty hash function as well as simplifying the code. + + https://bugs.webkit.org/show_bug.cgi?id=30658 + + Covered by running various svg tests under valgrind, ex: + LayoutTests/svg/custom/js-late-mask-and-object-creation.svg + + * svg/SynchronizablePropertyController.cpp: + (WebCore::SynchronizableProperties::addProperty): + (WebCore::SynchronizableProperties::synchronize): + (WebCore::SynchronizableProperties::startAnimation): + (WebCore::SynchronizableProperties::stopAnimation): + (WebCore::SynchronizablePropertyController::registerProperty): + (WebCore::SynchronizablePropertyController::setPropertyNeedsSynchronization): + (WebCore::SynchronizablePropertyController::synchronizeProperty): + (WebCore::SynchronizablePropertyController::synchronizeAllProperties): + (WebCore::SynchronizablePropertyController::startAnimation): + (WebCore::SynchronizablePropertyController::stopAnimation): + * svg/SynchronizablePropertyController.h: + (WebCore::SynchronizableProperties::SynchronizableProperties): + (WebCore::SynchronizableProperties::setNeedsSynchronization): + +2009-10-26 Kelly Norton <knorton@google.com> + + Reviewed by Timothy Hatcher. + + Renames TimelineItem to TimelineRecord and updates all call sites. + https://bugs.webkit.org/show_bug.cgi?id=30785 + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::addRecordToTimeline): + * inspector/InspectorFrontend.h: + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent::willDispatchDOMEvent): + (WebCore::InspectorTimelineAgent::didDispatchDOMEvent): + (WebCore::InspectorTimelineAgent::willLayout): + (WebCore::InspectorTimelineAgent::didLayout): + (WebCore::InspectorTimelineAgent::willRecalculateStyle): + (WebCore::InspectorTimelineAgent::didRecalculateStyle): + (WebCore::InspectorTimelineAgent::willPaint): + (WebCore::InspectorTimelineAgent::didPaint): + (WebCore::InspectorTimelineAgent::willWriteHTML): + (WebCore::InspectorTimelineAgent::didWriteHTML): + (WebCore::InspectorTimelineAgent::didInstallTimer): + (WebCore::InspectorTimelineAgent::didRemoveTimer): + (WebCore::InspectorTimelineAgent::willFireTimer): + (WebCore::InspectorTimelineAgent::didFireTimer): + (WebCore::InspectorTimelineAgent::reset): + (WebCore::InspectorTimelineAgent::addRecordToTimeline): + (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord): + (WebCore::InspectorTimelineAgent::pushCurrentRecord): + * inspector/InspectorTimelineAgent.h: + (WebCore::): + (WebCore::InspectorTimelineAgent::RecordEntry::RecordEntry): + * inspector/TimelineItemFactory.cpp: Removed. + * inspector/TimelineItemFactory.h: Removed. + * inspector/TimelineRecordFactory.cpp: Added. + (WebCore::TimelineRecordFactory::createGenericRecord): + (WebCore::TimelineRecordFactory::createDOMDispatchRecord): + (WebCore::TimelineRecordFactory::createGenericTimerRecord): + (WebCore::TimelineRecordFactory::createTimerInstallRecord): + * inspector/TimelineRecordFactory.h: Added. + (WebCore::TimelineRecordFactory::TimelineRecordFactory): + * inspector/front-end/TimelineAgent.js: + (WebInspector.addRecordToTimeline): + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype.addRecordToTimeline): + (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline): + (WebInspector.TimelinePanel.prototype.getRecordTypeName): + (WebInspector.TimelineRecordTreeElement.prototype.onattach): + +2009-10-26 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Antti Koivisto. + + [Qt] Windowless Plugins : Print preview shows only part of flash when view is scrolled + + When printing, QPrinter's preview mode uses a QPicture to capture the output. The + QPicture holds a reference to the X Pixmap. As a result, the print preview would + update itself when the X Pixmap changes. To prevent the print preview from updating + whenever m_drawable is updated (i.e when the view updates), we create a copy. + + We require that a QPixmap::copy() result in a QPixmap backed by a XPixmap + regardless of the graphicssystem. This is taken care of by + commit d310f7c710ecb331a9689861f0551eabd38e946e in Qt (4.6) + + The beauty of this patch is that the newly created X Pixmap is managed by Qt and + it will free the Pixmap whenever the user closes the print preview dialog and + handles the case of displaying multiple preview dialogs nicely. + + All credit to Samuel Rødal for suggesting usage of QPixmap::copy(). + + https://bugs.webkit.org/show_bug.cgi?id=30714 + + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::paint): + +2009-10-26 Benjamin Otte <otte@gnome.org> + + Reviewed by Gustavo Noronha. + + Don't store properties in the MediaPlayerPrivate class + + Access them via the MediaPlayer class instead. + https://bugs.webkit.org/show_bug.cgi?id=30462 + + * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: + (WebCore::MediaPlayerPrivate::MediaPlayerPrivate): + (WebCore::MediaPlayerPrivate::seek): + (WebCore::MediaPlayerPrivate::setVolume): + (WebCore::MediaPlayerPrivate::setRate): + (WebCore::MediaPlayerPrivate::setVisible): + (WebCore::MediaPlayerPrivate::paint): + (WebCore::MediaPlayerPrivate::createGSTPlayBin): + * platform/graphics/gtk/MediaPlayerPrivateGStreamer.h: + +2009-10-26 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Timothy Hatcher. + + Fixes <http://webkit.org/b/30801>. + Web Inspector: Control + ]/[ on Windows doesn't change Panels. + + In my testing, Windows uses "U+00DB" and "U+00DD" to represent + [ and ], so we should honor those as well. + + * inspector/front-end/inspector.js: + (WebInspector.documentKeyDown): + +2009-10-26 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Darin Adler. + + Make .rc files compile on Windows without depending on MFC headers + https://bugs.webkit.org/show_bug.cgi?id=30750 + + * WebCore.vcproj/QTMovieWin.rc: Use winresrc.h because it exists + even when MFC is not installed, and is all that's needed here. + +2009-10-26 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Darin Adler. + + Build corrections for ENABLE_FILTERS in Windows. + https://bugs.webkit.org/show_bug.cgi?id=30797 + + Build correction for ENABLE_FILTERS feature. No new tests needed. + + * platform/graphics/filters/FEColorMatrix.cpp: Use MathExtras.h and + its piDouble constant. + * platform/graphics/filters/FEGaussianBlur.cpp: Use MathExtras.h and + its piDouble constant. Remove unnecessary call to floor used in + the division of an unsigned, converting to int. + * platform/graphics/win/SimpleFontDataCairoWin.cpp: Correct include + style for MathExtras.h. + +2009-10-26 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/7289467> and http://webkit.org/b/30798 - REGRESSION (r48687): www.myuhc.com doesn't load. + + Test: fast/loader/grandparent-completion-starts-redirect.html + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::completed): Notify all descendants that the load completed, not just direct children. + +2009-10-26 Dan Bernstein <mitz@apple.com> + + Reviewed by Beth Dakin. + + Re-add CSSPropertyWebkitBackgroundSize in one more place + + Fixes transitions/multiple-background-size-transitions.html, transitions/background-transitions.html + + * page/animation/AnimationBase.cpp: + (WebCore::FillLayersPropertyWrapper::FillLayersPropertyWrapper): + +2009-10-26 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Dimitri Glazkov. + + [V8] Tidy up the DOM Storage runtime flag stuff + https://bugs.webkit.org/show_bug.cgi?id=30794 + + Clean up the DOM Storage runtime flag stuff to match the new way of doing + things. No behavioral changes. + + * bindings/v8/RuntimeEnabledFeatures.cpp: + * bindings/v8/RuntimeEnabledFeatures.h: + (WebCore::RuntimeEnabledFeatures::setDatabaseEnabled): + (WebCore::RuntimeEnabledFeatures::databaseEnabled): + (WebCore::RuntimeEnabledFeatures::setLocalStorageEnabled): + (WebCore::RuntimeEnabledFeatures::localStorageEnabled): + (WebCore::RuntimeEnabledFeatures::setSessionStorageEnabled): + (WebCore::RuntimeEnabledFeatures::sessionStorageEnabled): + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::ACCESSOR_RUNTIME_ENABLER): + * storage/Storage.cpp: + * storage/Storage.h: + +2009-10-26 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/7308952> and http://webkit.org/b/30424 - REGRESSION (r48687): Pages on ucas.com appear blank. + + Test: fast/loader/history-forward-in-head.html + + * loader/RedirectScheduler.cpp: + (WebCore::RedirectScheduler::scheduleHistoryNavigation): Restore the moved canGoBackOrForward() check. + This restores the side effect of an invalid history navigation canceling previous scheduled redirects + and also fixes the bug of scheduling an invalid history navigation canceling parsing of the current document. + (WebCore::RedirectScheduler::timerFired): Removed the canGoBackOrForward() check as it is now made before + the redirect is scheduled. + +2009-10-26 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=30049 + <rdar://problem/7286002> Manipulating DOM from a script while parsing XHTML can cause a crash + + Tests: fast/parser/remove-current-node-parent-x-2.xhtml + fast/parser/remove-current-node-parent-x.xhtml + + * dom/XMLTokenizer.h: Store the whole stack of parent nodes - element.parentNode() is + unreliable after DOM manipulation. + + * dom/XMLTokenizer.cpp: + (WebCore::XMLTokenizer::pushCurrentNode): Push the new node onto stack. + (WebCore::XMLTokenizer::popCurrentNode): This is now called instead of setCurrentNode when + exiting a node. + (WebCore::XMLTokenizer::clearCurrentNodeStack): We're aborting; or just done parsing. This + replaces setCurrentNode(0). + (WebCore::XMLTokenizer::enterText): Call pushCurrentNode(). + (WebCore::XMLTokenizer::exitText): Call popCurrentNode(), removing a long-standing FIXME + (not sure if it was ever practical though - how can a parent become null while adding text?) + + * dom/XMLTokenizerLibxml2.cpp: + (WebCore::XMLTokenizer::~XMLTokenizer): Call clearCurrentNodeStack(). + (WebCore::XMLTokenizer::startElementNs): Call pushCurrentNode(). + (WebCore::XMLTokenizer::endElementNs): Call popCurrentNode() to safely get to a parent. Also + added a check fo script element still being in document - Firefox parses those that aren't, + but doesn't execute them. + + * dom/XMLTokenizerQt.cpp: + (WebCore::XMLTokenizer::~XMLTokenizer): + (WebCore::XMLTokenizer::parseStartElement): + (WebCore::XMLTokenizer::parseEndElement): + Match libxml2 version changes. + +2009-10-26 Dan Bernstein <mitz@apple.com> + + Reviewed by Beth Dakin. + + background-size: X treated as background-size: X X, not background-size: X auto + https://bugs.webkit.org/show_bug.cgi?id=28440 + + Updated fast/backgrounds/size/resources/parsing-background-size-values.js + and fast/backgrounds/size/resources/parsing-inherit.js + + Reinstated -webkit-background-size and kept its behavior of filling in + the second value with the first one; and changed background-size to have + the behavior of filling in the second value with 'auto'. + + * css/CSSComputedStyleDeclaration.cpp: + (computedProperties): Re-added CSSPropertyWebkitBackgroundSize. + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Ditto. + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): Ditto. + (WebCore::CSSParser::parseFillSize): Adapted for the new parsing rule. + (WebCore::CSSParser::parseFillProperty): Re-added + CSSPropertyWebkitBackgroundSize. + (WebCore::cssPropertyID): Removed mapping of -webkit-background-size to + background-size. + * css/CSSParser.h: + * css/CSSPropertyNames.in: Re-added -webkit-background-size. + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyProperty): Re-added + CSSPropertyWebkitBackgroundSize. + +2009-10-26 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Eric Seidel. + + [Qt] Use "%lli" to format "long long" on WIN_OS to fix HTML5 WebDB crash + https://bugs.webkit.org/show_bug.cgi?id=30777 + + No new tests as the crash can be reproduced by existing storage + LayoutTests (by hitting an assert in debug mode Webkit on WIN_OS). + + * platform/text/String.cpp: + (WebCore::String::number): Qt's QString::vsprintf does not + understand the "%I64u" format string. Always use the "%lli" + format string for Qt port. + +2009-10-26 Tony Chang <tony@chromium.org> + + Reviewed by Eric Seidel. + + Roll back r50073 because r50041-50043 were reverted. r50073 was + a chromium side fix for r50041. + https://bugs.webkit.org/show_bug.cgi?id=30789 + + * bindings/v8/V8Collection.h: + * bindings/v8/custom/V8CustomBinding.h: + * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp: + (WebCore::getNamedItems): + (WebCore::getItem): + (WebCore::NAMED_PROPERTY_GETTER): + (WebCore::CALLBACK_FUNC_DECL): + * bindings/v8/custom/V8HTMLCollectionCustom.cpp: + (WebCore::getNamedItems): + (WebCore::getItem): + (WebCore::NAMED_PROPERTY_GETTER): + (WebCore::CALLBACK_FUNC_DECL): + * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp: + +2009-10-26 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Dimitri Glazkov. + + Fixed https://bugs.webkit.org/show_bug.cgi?id=30765 + REGRESSION (r48701): Removing an event listener causes the one added just after it not to fire + + and related bugs. + + If the event listener being removed is prior to the current firing event + iterator, we need to decrement the current firing event iterator in + addition to the endpoint. (Otherwise, shrinking the event listener vector + by one implicity moves the current firing event iterator forward by one. + It's like relativity, only without the planets.) + + Also took the opportunity to change some pointers to references, since + they can't be null. + + * dom/EventTarget.cpp: + (WebCore::EventTarget::removeEventListener): + (WebCore::EventTarget::removeAllEventListeners): Update iterator in addition + to end, if need be. + (WebCore::EventTarget::fireEventListeners): Updated for interface changes. + Added a comment to explain a behavior that was implicit enough to be + confusing. + + * dom/EventTarget.h: + (WebCore::FiringEventIterator::FiringEventIterator): + (WebCore::EventTarget::isFiringEventListeners): Updated for interface changes. + +2009-10-26 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Timothy Hatcher. + + Fixes <http://webkit.org/b/30792>. + Web Inspector: When changing resource scope, resource graph can get in weird state. + + If the user was scrolled down while looking at All resources, and then just + selects Fonts, or something that doesn't have many resources, then the graph + will stay scrolled down, even when there is no content there. + + When the filter is updated, scroll to the top of the graph view, so this won't + happen. + + * inspector/front-end/AbstractTimelinePanel.js: + (WebInspector.AbstractTimelinePanel.prototype._updateFilter): + +2009-10-26 Sam Weinig <sam@webkit.org> + + Fix mac clean build. + + * html/HTMLOptionsCollection.idl: + +2009-10-26 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Extract AbstractTimelinePanel that will be a base + class for ResourcesPanel and TimelinePanel. + + https://bugs.webkit.org/show_bug.cgi?id=30776 + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/AbstractTimelinePanel.js: Added. + (WebInspector.AbstractTimelinePanel): + (WebInspector.AbstractTimelinePanel.prototype.get categories): + (WebInspector.AbstractTimelinePanel.prototype.showCategory): + (WebInspector.AbstractTimelinePanel.prototype.hideCategory): + (WebInspector.AbstractTimelinePanel.prototype.createTimelinePanels): + (WebInspector.AbstractTimelinePanel.prototype._createFilterPanel.createFilterElement): + (WebInspector.AbstractTimelinePanel.prototype._createFilterPanel): + (WebInspector.AbstractTimelinePanel.prototype.filter): + (WebInspector.AbstractTimelinePanel.prototype._updateFilter): + (WebInspector.AbstractTimelinePanel.prototype._createGraph): + (WebInspector.AbstractTimelinePanel.prototype.updateGraphDividersIfNeeded): + (WebInspector.AbstractTimelinePanel.prototype._updateSummaryGraph): + (WebInspector.AbstractTimelinePanel.prototype._updateDividersLabelBarPosition): + (WebInspector.AbstractTimelinePanel.prototype.get needsRefresh): + (WebInspector.AbstractTimelinePanel.prototype.set needsRefresh): + (WebInspector.AbstractTimelinePanel.prototype.refreshIfNeeded): + (WebInspector.AbstractTimelinePanel.prototype.show): + (WebInspector.AbstractTimelinePanel.prototype.resize): + (WebInspector.AbstractTimelinePanel.prototype.updateMainViewWidth): + (WebInspector.TimelineCalculator): + (WebInspector.TimelineCalculator.prototype.computeSummaryValues): + (WebInspector.TimelineCalculator.prototype.computeBarGraphPercentages): + (WebInspector.TimelineCalculator.prototype.computeBarGraphLabels): + (WebInspector.TimelineCalculator.prototype.get boundarySpan): + (WebInspector.TimelineCalculator.prototype.updateBoundaries): + (WebInspector.TimelineCalculator.prototype.reset): + (WebInspector.TimelineCalculator.prototype._value): + (WebInspector.TimelineCalculator.prototype.formatValue): + * inspector/front-end/ResourceCategory.js: + (WebInspector.ResourceCategory): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel): + (WebInspector.ResourcesPanel.prototype.toolbarItemClass.get toolbarItemLabel): + (WebInspector.ResourcesPanel.prototype.get statusBarItems): + (WebInspector.ResourcesPanel.prototype.get categories): + (WebInspector.ResourcesPanel.prototype.showCategory): + (WebInspector.ResourcesPanel.prototype.hideCategory): + (WebInspector.ResourcesPanel.prototype.isCategoryVisible): + (WebInspector.ResourcesPanel.prototype.populateSidebar): + (WebInspector.ResourcesPanel.prototype.createPanelEnabler): + (WebInspector.ResourcesPanel.prototype.createStatusbarButtons): + (WebInspector.ResourcesPanel.prototype.set mainResourceLoadTime): + (WebInspector.ResourcesPanel.prototype.set mainResourceDOMContentTime): + (WebInspector.ResourcesPanel.prototype.show): + (WebInspector.ResourcesPanel.prototype.resize): + (WebInspector.ResourcesPanel.prototype.reset): + (WebInspector.ResourcesPanel.prototype.updateGraphDividersIfNeeded): + (WebInspector.ResourcesPanel.prototype.updateMainViewWidth): + (WebInspector.ResourceTimeCalculator): + (WebInspector.ResourceTransferSizeCalculator): + (WebInspector.ResourceTransferSizeCalculator.prototype.computeBarGraphLabels): + * inspector/front-end/SummaryBar.js: + (WebInspector.SummaryBar.prototype.update): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + (WebInspector.loaded): + +2009-10-26 Avi Drissman <avi@google.com> + + Reviewed by Darin Adler. + + Use Helvetica in the Inspector as intended. + https://bugs.webkit.org/show_bug.cgi?id=30787 + + * inspector/front-end/inspector.css: + +2009-10-26 Nate Chapin <japhet@chromium.org> + + Reviewed by Alexey Proskuryakov. + + Don't set window.opener to 0 for the current FrameLoader if a noreferrer link was clicked, only suppress opener in a new frame. + https://bugs.webkit.org/show_bug.cgi?id=30781 + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::urlSelected): Don't suppress opener in the current frame for noreferrer navigations. + +2009-10-26 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Eric Seidel. + + Data loss occurs when unbolding nested bold tags. + https://bugs.webkit.org/show_bug.cgi?id=30083 + + Fixes the loop in swapInNodePreservingAttributesAndChildren by saving nextSibling() of child + to a temporary valuable. It was originally calling nextSibling() after appending the child + to new parent, in which case, nextSibling is always 0. + + Test: editing/style/unbolding-nested-b.html + + * editing/ReplaceNodeWithSpanCommand.cpp: + (WebCore::swapInNodePreservingAttributesAndChildren): + +2009-10-21 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Adler. + + Storage events should use Document::url() rather than documentURI() + https://bugs.webkit.org/show_bug.cgi?id=30535 + + Storage events should use Document::url() rather than Document::documentURI() + per http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-October/023703.html + + Test: storage/domstorage/documentURI.html + + * storage/StorageEventDispatcher.cpp: + (WebCore::StorageEventDispatcher::dispatch): + +2009-10-26 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Darin Adler. + + Rollout r50041-50043. The HTML5 spec changed to make HTMLOptionsCollection + inherit from HTMLCollection. + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSHTMLAllCollectionCustom.cpp: + (WebCore::getNamedItems): + (WebCore::callHTMLAllCollection): + (WebCore::JSHTMLAllCollection::nameGetter): + (WebCore::JSHTMLAllCollection::item): + (WebCore::JSHTMLAllCollection::namedItem): + * bindings/js/JSHTMLCollectionCustom.cpp: + (WebCore::getNamedItems): + (WebCore::callHTMLCollection): + (WebCore::JSHTMLCollection::nameGetter): + (WebCore::JSHTMLCollection::item): + (WebCore::JSHTMLCollection::namedItem): + (WebCore::toJS): + * bindings/js/JSHTMLCollectionFunctions.h: Removed. + * bindings/js/JSHTMLDocumentCustom.cpp: + * bindings/js/JSHTMLOptionsCollectionCustom.cpp: + (WebCore::JSHTMLOptionsCollection::length): + (WebCore::JSHTMLOptionsCollection::indexSetter): + * bindings/objc/DOMHTML.mm: + (kitClass): + * bindings/objc/DOMUtility.mm: + (JSC::createDOMWrapper): + * bindings/scripts/CodeGeneratorJS.pm: + * html/HTMLCollection.idl: + * html/HTMLOptionsCollection.idl: + +2009-10-26 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Adam Roben. + + Build fix for ENABLE_FILTERS under Windows. + https://bugs.webkit.org/show_bug.cgi?id=30762 + + Build correction for ENABLE_FILTERS feature. No new tests needed. + + * WebCore.vcproj/WebCore.vcproj: Make the following changes: + (1) Create a new 'filters' sub-folder of the platform/graphics + folder to properly show the sources held in this directory. + (2) Move the files that are currently shown in svn/graphics/filters + to platform/graphics/filters (where they actually live on disk). + (3) Add the missing SVGFilter, SVGFilterBuilder, and SVGFETile to + the project so they are built. + (4) Remove SVGFEFloodElement.cpp from the build, since it is already + being compiled by SVGAllInOne.cpp. Its presence as a separate + entity is causing a linker warning for duplicate symbols. + (5) Add ImageBuffer.cpp to the build to support color space + calculations for non-CG builds. + * WebCore.vcproj/WebCoreCommon.vsprops: Add the platform/graphics/filters + path to the search paths in the project. + +2009-10-26 Keishi Hattori <casey.hattori@gmail.com> + + Reviewed by Timothy Hatcher. + + console.assert should prefix messages with "Assertion failed: " + https://bugs.webkit.org/show_bug.cgi?id=19135 + + * English.lproj/localizedStrings.js: + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleMessage.prototype.toMessageElement): Append "Assertion failed: " for AssertMessageType. + (WebInspector.ConsoleMessage.prototype.toString): + * page/Console.cpp: + (WebCore::Console::assertCondition): Use AssertMessageType. + * page/Console.h: + (WebCore::MessageType): Added AssertMessageType. + +2009-10-26 Rahul Kuchhal <kuchhal@chromium.org> + + Reviewed by Eric Seidel. + + Prevent crash when optgroup element is empty by adding a NULL check. + + https://bugs.webkit.org/show_bug.cgi?id=30365 + + Test: fast/forms/select-empty-optgroup.html + + * dom/SelectElement.cpp: + (WebCore::SelectElement::appendFormData): + +2009-10-21 Steven Knight <sgk@chromium.org> + + Reviewed by David Levin. + + Refactor gyp for separate webcore_bindings{,_sources} targets. + + https://bugs.webkit.org/show_bug.cgi?id=30447 + + Handle long link lines by building .idl-generated bindings in a + separate webcore_bindings library target. Avoid Visual Studio + dependency issues by building additional generated .cpp and .h files + in a separate webcore_bindings_sources target. + + Chrome should still build and test successfully. + + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + +2009-10-26 Mike Belshe <mike@belshe.com> + + Reviewed by Darin Fisher. + + Make the number of connections for chromium controlled by + chromium rather than by ResourceRequestBase. + https://bugs.webkit.org/show_bug.cgi?id=30661 + + * platform/network/ResourceRequestBase.cpp: + * platform/network/chromium/ResourceRequest.cpp: + +2009-10-26 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Unreviewed. make distcheck build fixes. + + * GNUmakefile.am: + +2009-10-26 Anton Muhin <antonm@chromium.org> + + Reviewed by Dimitri Glazkov. + + Unbreak Chromium build: that requires adding custom implementations + for HTMLOptionsCollection's item and namedItem. Keep v8 binding + close to JSC bindings as well. + https://bugs.webkit.org/show_bug.cgi?id=30780 + + * bindings/v8/V8Collection.h: + (WebCore::getNamedItemsFromCollection): + (WebCore::getItemFromCollection): + * bindings/v8/custom/V8CustomBinding.h: + * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp: + (WebCore::NAMED_PROPERTY_GETTER): + (WebCore::CALLBACK_FUNC_DECL): + * bindings/v8/custom/V8HTMLCollectionCustom.cpp: + (WebCore::NAMED_PROPERTY_GETTER): + (WebCore::CALLBACK_FUNC_DECL): + * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp: + (WebCore::CALLBACK_FUNC_DECL): + +2009-10-23 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Adam Barth and Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=30723 + <rdar://problem/6189415> Input names added to multipart/form-data headers need to be escaped. + + Test: http/tests/security/escape-form-data-field-names.html + + * platform/network/FormDataBuilder.cpp: + (WebCore::appendQuotedString): + (WebCore::FormDataBuilder::beginMultiPartHeader): + (WebCore::FormDataBuilder::addFilenameToMultiPartHeader): + Percent-escape line breaks and quotation marks. + +2009-10-26 Kelly Norton <knorton@google.com> + + Reviewed by Pavel Feldman. + + Adds DOMTimer support to InspectorTimelineAgent. + https://bugs.webkit.org/show_bug.cgi?id=30467 + + * inspector/InspectorTimelineAgent.cpp: Added timer support and fixed some method names. + (WebCore::InspectorTimelineAgent::didDispatchDOMEvent): + (WebCore::InspectorTimelineAgent::didLayout): + (WebCore::InspectorTimelineAgent::didRecalculateStyle): + (WebCore::InspectorTimelineAgent::didPaint): + (WebCore::InspectorTimelineAgent::didWriteHTML): + (WebCore::InspectorTimelineAgent::didInstallTimer): Added. + (WebCore::InspectorTimelineAgent::didRemoveTimer): Added. + (WebCore::InspectorTimelineAgent::willFireTimer): Added. + (WebCore::InspectorTimelineAgent::didFireTimer): Added. + (WebCore::InspectorTimelineAgent::addItemToTimeline): Added. + (WebCore::InspectorTimelineAgent::didCompleteCurrentTimelineItem): Renamed. + * inspector/InspectorTimelineAgent.h: + (WebCore::): + * inspector/TimelineItemFactory.cpp: Add methods for timer-related ScriptObjects. + (WebCore::TimelineItemFactory::createGenericTimerTimelineItem): + (WebCore::TimelineItemFactory::createTimerInstallTimelineItem): + * inspector/TimelineItemFactory.h: + * page/DOMTimer.cpp: Added instrumentation points. + (WebCore::DOMTimer::install): + (WebCore::DOMTimer::removeById): + (WebCore::DOMTimer::fired): + +2009-10-26 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/6988966> Hardware layers do not show up in page snapshots + + Add a method that gets called when snapshotting Canvas3DLayers for page snapshots, + that allows the layer to return a CGImageRef of its contents. + + * platform/graphics/mac/Canvas3DLayer.h: + * platform/graphics/mac/Canvas3DLayer.mm: + (-[Canvas3DLayer copyImageSnapshotWithColorSpace:]): + +2009-10-26 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Pass "console" as object group when evaluating selection. + + https://bugs.webkit.org/show_bug.cgi?id=30738 + + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype._evalSelectionInCallFrame): + +2009-10-26 Keishi Hattori <casey.hattori@gmail.com> + + Reviewed by Pavel Feldman. + + Fix for Console not showing repeat count when repeatedly logging an Event + https://bugs.webkit.org/show_bug.cgi?id=30324 + + * inspector/ConsoleMessage.cpp: + (WebCore::ConsoleMessage::addToConsole): + (WebCore::ConsoleMessage::updateRepeatCountInConsole): Added. + * inspector/ConsoleMessage.h: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::addConsoleMessage): Calls updateRepeatCountInConsole if it is a repeating message. + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::addConsoleMessage): Renamed WebCore::InspectorFrontend::addMessageToConsole + (WebCore::InspectorFrontend::updateConsoleMessageRepeatCount): Added. Called when repeatCount is incremented. + * inspector/InspectorFrontend.h: + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.addMessage): Removed calls to msg.isEqual. + (WebInspector.ConsoleView.prototype.updateMessageRepeatCount): Added. + (WebInspector.ConsoleView.prototype._incrementErrorWarningCount): Added. Updates the error/warning count. + (WebInspector.ConsoleView.prototype.clearMessages): + (WebInspector.ConsoleMessage): + (WebInspector.ConsoleMessage.prototype.toMessageElement): Use ConsoleMessage._updateRepeatCount + (WebInspector.ConsoleMessage.prototype._updateRepeatCount): + * inspector/front-end/inspector.js: + (WebInspector.addConsoleMessage): Renamed WebInspector.addMessageToConsole. + (WebInspector.updateConsoleMessageRepeatCount): Added. + +2009-10-26 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + crash with AX on when an image map contains an anchor tag + https://bugs.webkit.org/show_bug.cgi?id=30739 + + Tests: accessibility/crashing-a-tag-in-map.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::addChildren): + +2009-10-26 Steve Block <steveblock@google.com> + + Reviewed by Eric Seidel. + + Adds feature ENABLE guards to V8 bindings. + https://bugs.webkit.org/show_bug.cgi?id=30697 + + This adds guards for the following features to the V8 bindings, + to allow builds with V8 to succeed when these features are not enabled. + - DATABASE + - WORKERS + - SHARED_WORKERS + - SVG + - XPATH + - XSLT + - INSPECTOR + + This is a build fix only, no new tests required. + + * bindings/v8/DOMObjectsInclude.h: Modified. + * bindings/v8/DerivedSourcesAllInOne.cpp: Modified. + * bindings/v8/V8Index.cpp: Modified. + * bindings/v8/V8Index.h: Modified. + +2009-10-26 Joanmarie Diggs <joanmarie.diggs@gmail.com> + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=25679 + [Gtk] Improve accessibility of focusable lists + + Fixes the issues with the Atk states exposed for ListBoxOption + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (setAtkStateSetFromCoreObject): + +2009-10-26 Joanmarie Diggs <joanmarie.diggs@gmail.com> + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=27085 + [Gtk] Incorrect rendering of list + + Adds a way for platforms to indicate that a particular object + should not be ignored. + + * accessibility/AccessibilityObject.h: + * accessibility/chromium/AccessibilityObjectChromium.cpp: + * accessibility/gtk/AccessibilityObjectAtk.cpp: + * accessibility/mac/AccessibilityObjectMac.mm: + * accessibility/qt/AccessibilityObjectQt.cpp: + * accessibility/win/AccessibilityObjectWin.cpp: + * accessibility/wx/AccessibilityObjectWx.cpp: + (AccessibilityObject::accessibilityPlatformIncludesObject): + * accessibility/AccessibilityRenderObject.cpp: + (AccessibilityRenderObject::accessibilityIsIgnored): + +2009-10-26 Kinuko Yasuda <kinuko@google.com> + + Reviewed by Jan Alonzo. + + Bug 30619: [Linux] Menu key doesn't work + https://bugs.webkit.org/show_bug.cgi?id=30619 + + Test: manual-tests/keyboard-menukey-event.html + No new layout tests: testing this will require changes in the test + controller in a platform-specific way. + + * platform/chromium/KeyCodeConversionGtk.cpp: + (WebCore::windowsKeyCodeForKeyEvent): changed switch-case code for + GDK_Menu to return VKEY_APPS instead of VKEY_MENU. + * platform/gtk/KeyEventGtk.cpp: + (WebCore::windowsKeyCodeForKeyEvent): changed switch-case code for + GDK_Menu to return V_APPS instead of VK_MENU. + +2009-10-25 Anton Muhin <antonm@chromium.org> + + Reviewed by Adam Barth. + + Reuse already fetched proxy. + https://bugs.webkit.org/show_bug.cgi?id=30747 + + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::convertNewNodeToV8Object): + +2009-10-25 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed build fix. + + Build fix for WIN_OS if Netscape plugin support is turned off + https://bugs.webkit.org/show_bug.cgi?id=30753 + + * plugins/PluginDatabase.cpp: + +2009-10-25 Hironori Bono <hbono@chromium.org> + + Reviewed by Darin Adler. + + A quick fix for Bug 29103. + Since String::startsWith() cannot fold non-ASCII characters, this change folds the prefix string + and the option string before calling String::startsWith(). + https://bugs.webkit.org/show_bug.cgi?id=29103 + + Tests: fast/forms/listbox-typeahead-cyrillic.html + fast/forms/listbox-typeahead-greek.html + + * dom/SelectElement.cpp: + (WebCore::SelectElement::typeAheadFind): + +2009-10-25 Keishi Hattori <casey.hattori@gmail.com> + + Reviewed by Timothy Hatcher. + + Web Inspector: Expanding a node in the Console should not show the element in Elements panel + https://bugs.webkit.org/show_bug.cgi?id=30749 + + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype.onmousedown): Check if inside disclosure triangle. + +2009-10-25 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=30751 + HTMLOptionsCollection should not inherit from HTMLCollection + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + Added JSHTMLCollectionFunctions.h + + * bindings/js/JSHTMLAllCollectionCustom.cpp: + (WebCore::callHTMLAllCollection): + (WebCore::JSHTMLAllCollection::nameGetter): + (WebCore::JSHTMLAllCollection::item): + (WebCore::JSHTMLAllCollection::namedItem): + * bindings/js/JSHTMLCollectionCustom.cpp: + (WebCore::callHTMLCollection): + (WebCore::JSHTMLCollection::nameGetter): + (WebCore::JSHTMLCollection::item): + (WebCore::JSHTMLCollection::namedItem): + * bindings/js/JSHTMLOptionsCollectionCustom.cpp: + (WebCore::callHTMLCollection): + (WebCore::JSHTMLOptionsCollection::getCallData): + (WebCore::JSHTMLOptionsCollection::canGetItemsForName): + (WebCore::JSHTMLOptionsCollection::nameGetter): + (WebCore::JSHTMLOptionsCollection::indexSetter): + (WebCore::JSHTMLOptionsCollection::item): + (WebCore::JSHTMLOptionsCollection::namedItem): + Refactor to use generic implementation of HTMLCollection bindings functions + from JSHTMLCollectionFunctions.h + + * bindings/js/JSHTMLCollectionFunctions.h: Added. + (WebCore::getCollectionNamedItems): + (WebCore::getCollectionItems): + (WebCore::callHTMLCollectionGeneric): + Added generic functions that JSHTMLCollection, JSHTMLAllCollection and + JSHTMLOptionsCollection can all use. + + * bindings/js/JSHTMLDocumentCustom.cpp: Add include of JSHTMLAllCollection.h + for toJS on document.all. + + * bindings/objc/DOMHTML.mm: + * bindings/objc/DOMUtility.mm: + (JSC::createDOMWrapper): + Remove special cases for HTMLOptionsCollection. + + * bindings/scripts/CodeGeneratorJS.pm: + * html/HTMLAllCollection.idl: + * html/HTMLCollection.idl: + * html/HTMLOptionsCollection.idl: + +2009-10-24 Keishi Hattori <casey.hattori@gmail.com> + + Reviewed by Timothy Hatcher. + + WebInspector: Fixed issue with IME inside console + https://bugs.webkit.org/show_bug.cgi?id=30660 + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype._promptKeyDown): + * inspector/front-end/DatabaseQueryView.js: + (WebInspector.DatabaseQueryView.prototype._promptKeyDown): + * inspector/front-end/inspector.js: + (WebInspector.loaded): + (WebInspector.searchKeyDown): Moved performSearch here from WebInspector.searchKeyUp. + (WebInspector.startEditing.element.handleKeyEvent): + (WebInspector.startEditing): + * inspector/front-end/utilities.js: + (isEnterKey): Added. Check if in IME. + +2009-10-24 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Timothy Hatcher. + + Fixes <https://bugs.webkit.org/show_bug.cgi?id=30752>. + Web Inspector: Multiple Selection on Scope Bars by default Conflicts with other behavior on OSX. + + Have the scope bars select one scope by default, but if the multiple selection key + is pressed, allow for multiple selection. + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView): + (WebInspector.ConsoleView.prototype._updateFilter): + (WebInspector.ConsoleView.prototype.filter): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel): + (WebInspector.ResourcesPanel.prototype.filter): + (WebInspector.ResourcesPanel.prototype._updateFilter): + +2009-10-24 Timothy Hatcher <timothy@apple.com> + + Make the scope bars in the Web Inspector match other scope bars in Mac OS X. + Also cleans up the CSS to use classes instead of ID selectors. + + https://bugs.webkit.org/show_bug.cgi?id=28186 + + Reviewed by Dan Bernstein. + + * inspector/front-end/ResourcesPanel.js: Add the scope-bar class. + * inspector/front-end/inspector.css: Lots of changes to make it look right. + * inspector/front-end/inspector.html: Add the scope-bar class. + +2009-10-24 Timothy Hatcher <timothy@apple.com> + + Fix selecting Resources in the Web Inspector's Resources panel. + + https://bugs.webkit.org/show_bug.cgi?id=30743 + + Reviewed by Pavel Feldman. + + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.isCategoryVisible): Added. + (WebInspector.ResourceSidebarTreeElement.prototype.get selectable): Call + isCategoryVisible on the ResourcesPanel. + +2009-10-24 Timothy Hatcher <timothy@apple.com> + + Fix the Scope Bar in the Web Inspector's Resource panel, so that selecting + All will deselect the other filters. + + https://bugs.webkit.org/show_bug.cgi?id=30744 + + Reviewed by Pavel Feldman. + + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.createFilterElement): Better syntax. + (WebInspector.ResourcesPanel): + (WebInspector.ResourcesPanel.prototype.filter): Use a normal for loop, + and the child variable instead of target in the loop. Other clean up. + +2009-10-24 Timothy Hatcher <timothy@apple.com> + + Make resizing the Web Inspector's Elements panel sidebar work again. + Also makes Resources panel use the sidebar code in Panel. + + https://bugs.webkit.org/show_bug.cgi?id=30742 + + Reviewed by Pavel Feldman. + + * inspector/front-end/Panel.js: + (WebInspector.Panel): Don't create the sidebar with an argument. + (WebInspector.Panel.prototype.show): Call updateSidebarWidth. + (WebInspector.Panel.prototype.handleKeyEvent): Call handleSidebarKeyEvent. + (WebInspector.Panel.prototype.handleSidebarKeyEvent): Added. + (WebInspector.Panel.prototype.createSidebar): Renamed from _createSidebar. + (WebInspector.Panel.prototype._sidebarDragging): Call updateSidebarWidth. + (WebInspector.Panel.prototype.updateSidebarWidth): Renamed from _updateSidebarWidth. + (WebInspector.Panel.prototype.setSidebarWidth): Added. Called by updateSidebarWidth. + (WebInspector.Panel.prototype.updateMainViewWidth): Renamed from setMainViewWidth. + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel): Call createSidebar. + (WebInspector.ProfilesPanel.prototype.updateMainViewWidth): Renamed from setMainViewWidth. + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.show): Remove call to _updateSidebarWidth. + (WebInspector.ResourcesPanel.prototype.showResource): Call updateSidebarWidth + (WebInspector.ResourcesPanel.prototype.closeVisibleResource): Ditto. + (WebInspector.ResourcesPanel.prototype.setSidebarWidth): Added. + (WebInspector.ResourcesPanel.prototype.updateMainViewWidth): Added. + * inspector/front-end/StoragePanel.js: + (WebInspector.StoragePanel): Call createSidebar. + (WebInspector.StoragePanel.prototype.updateMainViewWidth): Renamed from setMainViewWidth. + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel): Call createSidebar. + (WebInspector.TimelinePanel.prototype.updateMainViewWidth): Renamed from setMainViewWidth. + +2009-10-24 Timothy Hatcher <timothy@apple.com> + + Call updateSelection() in a few places so hovering in the Web Inspector's + Elements panel always has the correct row selection height. + + https://bugs.webkit.org/show_bug.cgi?id=30735 + + Reviewed by Pavel Feldman. + + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype.toggleNewAttributeButton): Call updateSelection(). + (WebInspector.ElementsTreeElement.prototype._insertInLastAttributePosition): Ditto. + * inspector/front-end/inspector.css: Prevent text wrapping in the middle of the add attribute text. + +2009-10-24 Timothy Hatcher <timothy@apple.com> + + Remove the re-root tree feature from the Web Inspector's + Elements panel. This feature wasn't super useful and gets + in the way of double-click to edit. + + https://bugs.webkit.org/show_bug.cgi?id=30736 + + Reviewed by Pavel Feldman. + + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype.ondblclick): + +2009-10-24 Anton Muhin <antonm@chromium.org> + + Reviewed by Adam Barth. + + Implements ReturnsNew hint for V8 bindings generation code. + https://bugs.webkit.org/show_bug.cgi?id=30745 + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/V8DOMWrapper.h: + (WebCore::V8DOMWrapper::convertNewNodeToV8Object): + +2009-10-24 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + Missing images at 350.org due to wrong URLs + https://bugs.webkit.org/show_bug.cgi?id=30748 + + Test: fast/dom/HTMLImageElement/parse-src.html + + * dom/Element.cpp: + (WebCore::Element::getURLAttribute): Pass the attribute value through deprecateParseURL(). + This matches what the Objective-C bindings do, as well as what HTMLImageLoader::sourceURI() + and SVGImageLoader::sourceURI() do. + +2009-10-24 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed. + + [Qt] Build fix for QtWebKit after r50013. + + * WebCore.pro: + +2009-10-24 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, build fix. + + [V8] Fix up to accommodate for HTMLAllCollection changes in + http://trac.webkit.org/changeset/49998. + + * WebCore.gypi: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/custom/V8CustomBinding.h: + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + +2009-10-23 Dan Bernstein <mitz@apple.com> + + Reviewed by Alexey Proskuryakov. + + <rdar://problem/7294131> Assertion failure in AuthenticationMac at + mac(const Credential&) after authenticating to MobileMe Gallery movie + + * platform/network/Credential.cpp: + (WebCore::Credential::Credential): Initialize m_persistence. + (WebCore::Credential::isEmpty): Made this method const. + * platform/network/Credential.h: + * platform/network/mac/AuthenticationMac.mm: + (WebCore::mac): Return nil if the Credential is empty. + +2009-10-23 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Timothy Hatcher. + + Fixes <https://bugs.webkit.org/show_bug.cgi?id=30617>. + Web Inspector: Resources Scope Bar Should Allow Combinations. + + Refactor the filtering in ResourcePanel to make it match ConsoleView, + and add a divider between All, and the other choices of Resource types. + + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel): + (WebInspector.ResourcesPanel.prototype.filter): + (WebInspector.ResourcesPanel.prototype._updateFilter): + * inspector/front-end/inspector.css: + +2009-10-23 Chris Evans <cevans@chromium.org> + + Reviewed by Adam Barth. + + Ignore the Refresh header if we're in view source mode. + + https://bugs.webkit.org/show_bug.cgi?id=27239 + + Test: http/tests/security/view-source-no-refresh.html + + * loader/FrameLoader.cpp: ignore Refresh in view-source mode. + +2009-10-23 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=30734 + Remove XMLTokenizer::m_currentNodeIsReferenced + + No change in behavior, no tests. + + * dom/XMLTokenizer.cpp: + (WebCore::XMLTokenizer::setCurrentNode): + * dom/XMLTokenizer.h: + Don't store a boolean for the current node being the document - we can always check for that. + + * dom/XMLTokenizerLibxml2.cpp: + (WebCore::XMLTokenizer::XMLTokenizer): + * dom/XMLTokenizerQt.cpp: + (WebCore::XMLTokenizer::XMLTokenizer): + A fragment passed to XMLTokenizer is never null - in fact, the first thing we do is dereference + it unconditionally, and then begin checking it for null, as if it could help. + +2009-10-23 Beth Dakin <bdakin@apple.com> + + No review since this is a build fix. + + Build fix for the Mac. (Build is only broken when SVG filters are + enabled.) + + Labelled these function static. + * platform/graphics/filters/FEComponentTransfer.cpp: + (WebCore::identity): + (WebCore::table): + (WebCore::discrete): + (WebCore::linear): + (WebCore::gamma): + * platform/graphics/filters/FEGaussianBlur.cpp: + (WebCore::boxBlur): + +2009-10-23 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Implement a Timeline panel. + + https://bugs.webkit.org/show_bug.cgi?id=30725 + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/Images/timelineIcon.png: Added. + * inspector/front-end/TimelineAgent.js: + (WebInspector.addItemToTimeline): + (WebInspector.timelineProfilerWasStarted): + (WebInspector.timelineProfilerWasStopped): + * inspector/front-end/TimelinePanel.js: Added. + (WebInspector.TimelinePanel): + (WebInspector.TimelinePanel.prototype.toolbarItemClass.get toolbarItemLabel): + (WebInspector.TimelinePanel.prototype.get statusBarItems): + (WebInspector.TimelinePanel.prototype.handleKeyEvent): + (WebInspector.TimelinePanel.prototype.timelineWasStarted): + (WebInspector.TimelinePanel.prototype.timelineWasStopped): + (WebInspector.TimelinePanel.prototype.addItemToTimeline): + (WebInspector.TimelinePanel.prototype._innerAddItemToTimeline): + (WebInspector.TimelinePanel.prototype._toggleTimelineButton): + (WebInspector.TimelinePanel.prototype.setMainViewWidth): + (WebInspector.TimelinePanel.prototype.getItemTypeName): + (WebInspector.TimelineRecordTreeElement): + (WebInspector.TimelineRecordTreeElement.prototype.onattach): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.css: + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + (WebInspector._createPanels): + +2009-10-23 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Clash Between Search's onkeyup and incremental search events + https://bugs.webkit.org/show_bug.cgi?id=30731 + + * inspector/front-end/inspector.js: + (WebInspector.performSearch): prevent incremental search event from clobbering a forced search + +2009-10-23 Kelly Norton <knorton@google.com> + + Reviewed by Pavel Feldman. + + Removes the need for C++ Timeline types in InspectorTimelineAgent in favor + of ScriptObjects. + https://bugs.webkit.org/show_bug.cgi?id=30707 + + * GNUmakefile.am: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * inspector/DOMDispatchTimelineItem.cpp: Removed. + * inspector/DOMDispatchTimelineItem.h: Removed. + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent::InspectorTimelineAgent): + (WebCore::InspectorTimelineAgent::willDispatchDOMEvent): + (WebCore::InspectorTimelineAgent::didDispatchDOMEvent): + (WebCore::InspectorTimelineAgent::willLayout): + (WebCore::InspectorTimelineAgent::didLayout): + (WebCore::InspectorTimelineAgent::willRecalculateStyle): + (WebCore::InspectorTimelineAgent::didRecalculateStyle): + (WebCore::InspectorTimelineAgent::willPaint): + (WebCore::InspectorTimelineAgent::didPaint): + (WebCore::InspectorTimelineAgent::willWriteHTML): + (WebCore::InspectorTimelineAgent::didWriteHTML): + (WebCore::InspectorTimelineAgent::reset): + (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord): + (WebCore::InspectorTimelineAgent::pushCurrentTimelineItem): + * inspector/InspectorTimelineAgent.h: + (WebCore::InspectorTimelineAgent::TimelineItemEntry::TimelineItemEntry): + * inspector/TimelineItem.cpp: Removed. + * inspector/TimelineItem.h: Removed. + * inspector/TimelineItemFactory.cpp: Added. + (WebCore::TimelineItemFactory::createGenericTimelineItem): + (WebCore::TimelineItemFactory::createDOMDispatchTimelineItem): + * inspector/TimelineItemFactory.h: Added. + (WebCore::): + (WebCore::TimelineItemFactory::TimelineItemFactory): + +2009-10-23 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Geoff Garen. + + https://bugs.webkit.org/show_bug.cgi?id=30729 + Provide private API to request the global context for a specific world. + Used to initialize parameters on the global object. + + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::globalObject): + * bindings/js/ScriptController.h: + +2009-10-23 Steve Block <steveblock@google.com> + + Reviewed by Eric Seidel. + + Fixes style problems in Android-specific files. + https://bugs.webkit.org/show_bug.cgi?id=30717 + + Style changes only, no new tests possible. + + * page/android/EventHandlerAndroid.cpp: Modified. + (WebCore::EventHandler::passMouseDownEventToWidget): Fixes whitespace in method signature. + (WebCore::EventHandler::passSubframeEventToSubframe): Fixes whitespace in method signature. + (WebCore::EventHandler::passWheelEventToWidget): Fixes whitespace in method signature. + (WebCore::EventHandler::passMouseMoveEventToSubframe): Fixes whitespace in method signature. + * platform/android/ClipboardAndroid.h: Modified. Fixes header include order and indenting. + * platform/android/CursorAndroid.cpp: Modified. + (WebCore::grabCursor): Fixes function braces. + (WebCore::grabbingCursor): Fixes function braces. + * platform/android/FileChooserAndroid.cpp: Modified. + (WebCore::FileChooser::basenameForWidth): Fixes braces on while statement, and updates String::copy to String::threadsafeCopy. + * platform/android/FileSystemAndroid.cpp: Modified. Fixes header include order. + (WebCore::unloadModule): Fixes zero test. + (WebCore::writeToFile): Fixes if statement structure. + * platform/android/KeyEventAndroid.cpp: Modified. + (WebCore::windowsKeyCodeForKeyEvent): Fixes switch statement indenting. + (WebCore::keyIdentifierForAndroidKeyCode): Fixes switch statement indenting. + * platform/android/ScreenAndroid.cpp: Modified. Fixes header include order and switch statement indenting. + * platform/android/TemporaryLinkStubs.cpp: Modified. Fixes header include order. + +2009-10-23 Sam Weinig <sam@webkit.org> + + Another shot at a fixed build. + + * DerivedSources.cpp: + +2009-10-23 Sam Weinig <sam@webkit.org> + + Another shot at a fixed build. + + * html/HTMLOptionsCollection.idl: + +2009-10-23 Brady Eidson <beidson@apple.com> + + 50,000! + + * ChangeLog: Point out revision 50,000. + +2009-10-23 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=30695 + Drop .tags() support from HTMLCollection + + - Make .tags() only work for HTMLAllCollections in JS. .tags() is still + available for all HTMLCollection like objects in Objective-C since that + is API. + - Auto-generate HTMLAllCollection. + + Test: fast/dom/HTMLDocument/document-all.html + + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSHTMLAllCollection.cpp: Removed. + * bindings/js/JSHTMLAllCollection.h: Removed. + * bindings/js/JSHTMLAllCollectionCustom.cpp: Added. + (WebCore::getNamedItems): + (WebCore::callHTMLAllCollection): + (WebCore::JSHTMLAllCollection::getCallData): + (WebCore::JSHTMLAllCollection::canGetItemsForName): + (WebCore::JSHTMLAllCollection::nameGetter): + (WebCore::JSHTMLAllCollection::item): + (WebCore::JSHTMLAllCollection::namedItem): + * bindings/js/JSHTMLCollectionCustom.cpp: + (WebCore::toJS): + * bindings/js/JSHTMLDocumentCustom.cpp: + * bindings/scripts/CodeGeneratorJS.pm: + * dom/Document.cpp: + (WebCore::Document::all): + * dom/Document.h: + * dom/HTMLAllCollection.idl: Removed. + * html/HTMLAllCollection.cpp: Added. + (WebCore::HTMLAllCollection::create): + (WebCore::HTMLAllCollection::HTMLAllCollection): + (WebCore::HTMLAllCollection::~HTMLAllCollection): + * html/HTMLAllCollection.h: Added. + * html/HTMLAllCollection.idl: Added. + * html/HTMLCollection.h: + * html/HTMLCollection.idl: + * html/HTMLDocument.idl: + * page/DOMWindow.idl: + +2009-10-23 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: pull basic sidebar implementation into the Panel. + + https://bugs.webkit.org/show_bug.cgi?id=30720 + + * inspector/front-end/Panel.js: + (WebInspector.Panel): + (WebInspector.Panel.prototype.jumpToPreviousSearchResult): + (WebInspector.Panel.prototype.handleKeyEvent): + (WebInspector.Panel.prototype._createSidebar): + (WebInspector.Panel.prototype._startSidebarDragging): + (WebInspector.Panel.prototype._sidebarDragging): + (WebInspector.Panel.prototype._endSidebarDragging): + (WebInspector.Panel.prototype._updateSidebarWidth): + (WebInspector.Panel.prototype.setCenterViewWidth): + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel): + (WebInspector.ProfilesPanel.prototype.setCenterViewWidth): + * inspector/front-end/StoragePanel.js: + (WebInspector.StoragePanel): + (WebInspector.StoragePanel.prototype.setCenterViewWidth): + +2009-10-23 Jens Alfke <snej@chromium.org> + + Reviewed by Dimitri Glazkov. + + Slight optimizations to object returning and exception handling in generated V8 bindings. + https://bugs.webkit.org/show_bug.cgi?id=30599 + + * bindings/scripts/CodeGeneratorV8.pm: Generate better code + * bindings/v8/V8DOMWrapper.h: + (WebCore::V8DOMWrapper::convertToV8Object): Added overload that takes a Ref<> + * bindings/v8/custom/V8InspectorBackendCustom.cpp: + (WebCore::CALLBACK_FUNC_DECL): Remove unnecessary template param to prevent compile error + +2009-10-23 Alpha Lam <hclam@chromium.org> + + Reviewed by Eric Carlson. + + Volume slider always starts at half volume + https://bugs.webkit.org/show_bug.cgi?id=28322 + + Sets the value attribute of volume slider to the volume attribute + of the media element. Also update the value attribute of the + input element for the volume slider when the volume attribute + of the media element is updated. + + Test: media/video-volume-slider.html + + * rendering/MediaControlElements.cpp: + (WebCore::MediaControlVolumeSliderElement::update): + Set the value attribute of the input element for the volume slider + using the current volume of the media element. + * rendering/MediaControlElements.h: + Add method definition of update(). + * rendering/RenderMedia.cpp: + (WebCore::RenderMedia::createVolumeSlider): + Creates a volume slider with value attribute equals to the current + volume attribute of the media element. + +2009-10-23 Evan Martin <evan@chromium.org> + + Reviewed by Eric Seidel. + + Chrome Linux: fix caret positioning in LTR complex languages + The caret is positioned off by one in languages like Thai. + + https://bugs.webkit.org/show_bug.cgi?id=28284 + + A group of us spent a while trying various approaches to write a test + for this; however, since it is only that the blinking cursor is + displayed incorrectly, we concluded it can not be tested. + + (Patch by Hironori Bono.) + + * platform/graphics/chromium/FontLinux.cpp: + (WebCore::Font::selectionRectForComplexText): + +2009-10-23 Tony Chang <tony@chromium.org> + + Reviewed by David Levin. + + Fix Chromium build after IsoldatedWorld change (r49963). + https://bugs.webkit.org/show_bug.cgi?id=30719 + + * bindings/ScriptControllerBase.cpp: + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::executeScriptInIsolatedWorld): + * bindings/v8/ScriptController.cpp: + (WebCore::mainThreadNormalWorld): + * bindings/v8/ScriptController.h: + (WebCore::ScriptController::windowShell): + (WebCore::ScriptController::existingWindowShell): + * dom/Document.cpp: + (WebCore::Document::createWrapperCache): + * dom/ScriptExecutionContext.cpp: + * dom/ScriptExecutionContext.h: + * xml/XMLHttpRequest.cpp: + * xml/XMLHttpRequest.h: + +2009-10-23 Xiaomei Ji <xji@chromium.org> + + Reviewed by Sam Weinig. + + Fix caretRangeFromPoint()/elementFromPoint() returns wrong result + for a zoomed and scrolled page. + https://bugs.webkit.org/show_bug.cgi?id=30689. + + The real cause is the wrong calculation of event.clientX/Y when + page is zoomed and scolled. + After Sam fixed the event.clientX/Y in r49551, the hit test point + should be recalculated (revert r49490). + + Test: fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll.html + + * dom/Document.cpp: + (WebCore::Document::elementFromPoint): calculate the correct point + relative to document when page is zoomed and scrolled. + (WebCore::Document::caretRangeFromPoint): calculate the correct point + relative to document when page is zoomed and scrolled. + +2009-10-22 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Dmitry Titov. + + Adding a class that allows us to enable/disable features at + runtime. Adding a flag to enable database support. + + https://bugs.webkit.org/show_bug.cgi?id=30653 + + * WebCore.gypi: + * bindings/v8/RuntimeEnabledFeatures.cpp: Added. + * bindings/v8/RuntimeEnabledFeatures.h: Added. + (WebCore::RuntimeEnabledFeatures::setDatabaseEnabled): + (WebCore::RuntimeEnabledFeatures::databaseEnabled): + (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures): + * bindings/v8/custom/V8CustomBinding.h: + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::ACCESSOR_RUNTIME_ENABLER): + * page/DOMWindow.idl: + +2009-10-23 Keishi Hattori <casey.hattori@gmail.com> + + Reviewed by Timothy Hatcher. + + Inspector injects _inspectorCommandLineAPI into global object when opened + https://bugs.webkit.org/show_bug.cgi?id=30675 + + * inspector/front-end/InjectedScript.js: + (InjectedScript.getCompletions): + (InjectedScript._evaluateOn): + (InjectedScript.addInspectedNode): + (InjectedScript._ensureCommandLineAPIInstalled): Moved _inspectorCommandLineAPI from window to console. + +2009-10-23 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] don't undef NULL in Symbian emulator + + npapi.h way of defining mwerks compiler,__intel__ + and win32 are all true for Symbian emulator. + Changed the definions so that NULL won't be undefined + when compiling for Symbian emulator nor target HW. + + * bridge/npapi.h: + +2009-10-23 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Correct linking of sqlite3 for Symbian + https://bugs.webkit.org/show_bug.cgi?id=30569 + + ".lib" will try to include library as static library + causing the library to be searched from wrong directory and if found + will be statically linked instead of the inteded dynamic linking. + + * WebCore.pro: + +2009-10-23 Enrica Casucci <enrica@apple.com> + + Reviewed by Adele Peterson. + + REGRESSION: Copy is copying incorrect background-color + <rdar://problem/7248529> + https://bugs.webkit.org/show_bug.cgi?id=29697 + + Test: editing/execCommand/indent-paragraphs.html + + This change removes the BackgroundColor from the list + of inheritable CSS properties and changes significantly + the way we perform indentation. + The new implementation of IndentOutdentCommand uses a new method + defined in CompositeEditCommand called moveParagraphWithClones. + This is an improved version of the original moveParagraph that + is aimed at preserving the original markup of the paragraph being + moved. + + * editing/ApplyStyleCommand.cpp: + (WebCore::): removed CSSPropertyBackgroundColor from editingStyleProperties. + * editing/CompositeEditCommand.cpp: + (WebCore::CompositeEditCommand::CompositeEditCommand): Removed trailing blanks. + (WebCore::CompositeEditCommand::rebalanceWhitespaceAt): Removed trailing blanks. + (WebCore::CompositeEditCommand::cloneParagraphUnderNewElement): Added. + (WebCore::CompositeEditCommand::cleanupAfterDeletion): Added. + (WebCore::CompositeEditCommand::moveParagraphWithClones): Added. + (WebCore::CompositeEditCommand::moveParagraphs): Modified to use cleanupAfterDeletion. + (WebCore::CompositeEditCommand::breakOutOfEmptyListItem): Removed trailing blanks. + (WebCore::CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph): Removed trailing blanks. + (WebCore::CompositeEditCommand::positionAvoidingSpecialElementBoundary): Removed trailing blanks. + * editing/CompositeEditCommand.h: Added three new methods. + * editing/IndentOutdentCommand.cpp: + (WebCore::IndentOutdentCommand::tryIndentingAsListItem): Changed to use moveParagraphWithClones. + (WebCore::IndentOutdentCommand::indentIntoBlockquote): Changed to use moveParagraphWithClones. + (WebCore::IndentOutdentCommand::indentRegion): Removed comment. + * editing/IndentOutdentCommand.h: Removed prepareBlockquoteLevelForInsertion method. + +2009-10-23 Steve Block <steveblock@google.com> + + Reviewed by Eric Seidel. + + Adds missing UnusedParam.h includes, required when INSPECTOR is not enabled. + https://bugs.webkit.org/show_bug.cgi?id=30677 + + Build fix, no new tests required. + + * page/Console.cpp: Modified. Added UnusedParam.h include. + * workers/WorkerContext.cpp: Modified. Added UnusedParam.h include. + +2009-10-23 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Holger Freyther. + + [Qt] Plugins : Use window's winId() instead of the widget's. + + As per, https://developer.mozilla.org/en/NPN_GetValue + NPNVnetscapeWindow on Unix/X11: "Gets the browser toplevel window in which the + plug-in is displayed; returns Window". + + The issue was found because NPNVNetscapeWindow winId() ends up creating + a native window resulting in flicker. + + https://bugs.webkit.org/show_bug.cgi?id=30706 + + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::getValue): + +2009-10-23 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Holger Freyther. + + [Qt] Windowless Plugins : Don't use m_clipRect when painting. + + Though it works, it is not correct to use m_clipRect for painting + in Windowless mode. Instead, the rect paramater that is passed + as a part of PluginView::paint() must be used. This change will + also result in some speedup since previously we used to paint all + the visible parts of a windowless plugin (even if those parts were + not dirty). + + Also, fix invalidateRect() to compute the correct width and height. + + https://bugs.webkit.org/show_bug.cgi?id=30711 + + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::paint): + (WebCore::PluginView::invalidateRect): + +2009-10-21 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Holger Freyther. + + Plugins : Use test.swf in the plugins manual tests. + + They previously referenced youtube videos which among other things are + cumbersome to use without internet connection. The old youtube link is + just commented out so that testing with youtube can be done with + little effort. + + https://bugs.webkit.org/show_bug.cgi?id=30662 + + * manual-tests/plugins/test.swf: Copied from LayoutTests/fast/replaced/resources/test.swf. + * manual-tests/plugins/windowed.html: + * manual-tests/plugins/windowless.html: + * manual-tests/qt/plugin-sibling-frame-include.html: + +2009-10-23 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Jon Honeycutt. + + Fix the Windows Release build by moving Accessibility files + into all-in-one file and excluding them from the build. + + * WebCore.vcproj/WebCore.vcproj: + * accessibility/AccessibilityAllInOne.cpp: Added. + +2009-10-16 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig & Geoff Garen. + + https://bugs.webkit.org/show_bug.cgi?id=30696 + Add support for IsolatedWorlds to JSC bindings. + + An IsolatedWorld is basically a parallel, separate copy of the window shells and DOM wrapper objects for + a given document. To support isolation this patch: + + * Adds support to the ScriptController to track multiple window shells, one per world. + * Adds support to Document to support multiple separate wrapper-maps, one per world. + * Replaces the single global DOM wrapper map (on the WebCoreJSClientData) with separate maps, + stored on the (new) IsolatedWorld objects. + + In addition to supporting separate copies of these objects, two other features are supported: + + * It is necessary to track the current world on entry into JSC, so that within callbacks out to WebCore + we can determine which world (and as such, set of DOM bindings) we should be operating on. + * EventListeners & Callbacks are run in the world they were registered in. + This requires the handler to retain a reference to the world. + + No new tests. (Enabled existing isolated world layout tests.) + + * WebCore.base.exp: + * bindings/js/JSAbstractWorkerCustom.cpp: + (WebCore::JSAbstractWorker::addEventListener): + (WebCore::JSAbstractWorker::removeEventListener): + * bindings/js/JSCallbackData.cpp: + (WebCore::JSCallbackData::invokeCallback): + * bindings/js/JSCallbackData.h: + (WebCore::JSCallbackData::JSCallbackData): + * bindings/js/JSCustomXPathNSResolver.cpp: + (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): + * bindings/js/JSDOMApplicationCacheCustom.cpp: + (WebCore::JSDOMApplicationCache::addEventListener): + (WebCore::JSDOMApplicationCache::removeEventListener): + * bindings/js/JSDOMBinding.cpp: + (WebCore::removeWrappers): + (WebCore::DOMObjectWrapperMap::get): + (WebCore::DOMObjectWrapperMap::set): + (WebCore::DOMObjectWrapperMap::remove): + (WebCore::DOMObjectWrapperMap::take): + (WebCore::IsolatedWorld::IsolatedWorld): + (WebCore::IsolatedWorld::~IsolatedWorld): + (WebCore::EnterIsolatedWorld::EnterIsolatedWorld): + (WebCore::EnterIsolatedWorld::~EnterIsolatedWorld): + (WebCore::JSGlobalDataWorldIterator::JSGlobalDataWorldIterator): + (WebCore::JSGlobalDataWorldIterator::operator bool): + (WebCore::JSGlobalDataWorldIterator::operator*): + (WebCore::JSGlobalDataWorldIterator::operator->): + (WebCore::JSGlobalDataWorldIterator::operator++): + (WebCore::getCurrentWorld): + (WebCore::getNormalWorld): + (WebCore::commonNormalWorld): + (WebCore::commonCurrentWorld): + (WebCore::DOMObjectHashTableMap::mapFor): + (WebCore::DOMObjectWrapperMap::mapFor): + (WebCore::forgetDOMObject): + (WebCore::getCachedDOMNodeWrapper): + (WebCore::forgetDOMNode): + (WebCore::cacheDOMNodeWrapper): + (WebCore::forgetAllDOMNodesForDocument): + (WebCore::forgetWorldOfDOMNodesForDocument): + (WebCore::isObservableThroughDOM): + (WebCore::markDOMNodesForDocument): + (WebCore::markActiveObjectsForContext): + (WebCore::takeWrappers): + (WebCore::updateDOMNodeDocument): + (WebCore::markDOMObjectWrapper): + (WebCore::allowsAccessFromFrame): + (WebCore::printErrorMessageForFrame): + (WebCore::JSC_DebuggerCallFrame_evaluateInWorld): + (WebCore::JSC_callInWorld): + (WebCore::JSC_constructInWorld): + (WebCore::JSC_evaluateInWorld): + * bindings/js/JSDOMBinding.h: + (WebCore::IsolatedWorld::rememberDocument): + (WebCore::IsolatedWorld::forgetDocument): + (WebCore::IsolatedWorld::rememberScriptController): + (WebCore::IsolatedWorld::forgetScriptController): + (WebCore::DOMObjectHashTableMap::~DOMObjectHashTableMap): + (WebCore::DOMObjectHashTableMap::get): + (WebCore::WebCoreJSClientData::WebCoreJSClientData): + (WebCore::WebCoreJSClientData::currentWorld): + (WebCore::WebCoreJSClientData::normalWorld): + (WebCore::WebCoreJSClientData::rememberWorld): + (WebCore::WebCoreJSClientData::forgetWorld): + (WebCore::debuggerWorld): + (WebCore::pluginWorld): + * bindings/js/JSDOMGlobalObject.cpp: + (WebCore::JSDOMGlobalObject::createJSAttributeEventListener): + (WebCore::toJSDOMGlobalObject): + * bindings/js/JSDOMGlobalObject.h: + * bindings/js/JSDOMWindowBase.cpp: + (WebCore::JSDOMWindowBase::printErrorMessage): + (WebCore::JSDOMWindowBase::commonJSGlobalData): + (WebCore::toJS): + (WebCore::toJSDOMWindow): + * bindings/js/JSDOMWindowBase.h: + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::createWindow): + (WebCore::JSDOMWindow::open): + (WebCore::JSDOMWindow::showModalDialog): + (WebCore::JSDOMWindow::setTimeout): + (WebCore::JSDOMWindow::setInterval): + (WebCore::JSDOMWindow::addEventListener): + (WebCore::JSDOMWindow::removeEventListener): + * bindings/js/JSDOMWindowShell.cpp: + (WebCore::toJS): + (WebCore::toJSDOMWindowShell): + * bindings/js/JSDOMWindowShell.h: + * bindings/js/JSDesktopNotificationsCustom.cpp: + (WebCore::JSNotification::addEventListener): + (WebCore::): + * bindings/js/JSEventListener.cpp: + (WebCore::JSEventListener::JSEventListener): + (WebCore::JSEventListener::handleEvent): + (WebCore::JSEventListener::reportError): + * bindings/js/JSEventListener.h: + (WebCore::JSEventListener::create): + * bindings/js/JSEventSourceCustom.cpp: + (WebCore::JSEventSource::addEventListener): + (WebCore::JSEventSource::removeEventListener): + * bindings/js/JSEventTarget.cpp: + (WebCore::toJS): + * bindings/js/JSHTMLDocumentCustom.cpp: + (WebCore::JSHTMLDocument::open): + * bindings/js/JSHTMLFrameSetElementCustom.cpp: + (WebCore::JSHTMLFrameSetElement::nameGetter): + * bindings/js/JSInspectorBackendCustom.cpp: + (WebCore::JSInspectorBackend::databaseForId): + (WebCore::JSInspectorBackend::inspectedWindow): + (WebCore::JSInspectorBackend::nodeForId): + * bindings/js/JSLazyEventListener.cpp: + (WebCore::JSLazyEventListener::JSLazyEventListener): + (WebCore::JSLazyEventListener::parseCode): + * bindings/js/JSLazyEventListener.h: + (WebCore::JSLazyEventListener::create): + * bindings/js/JSMessageChannelCustom.cpp: + (WebCore::JSMessageChannel::markChildren): + * bindings/js/JSMessagePortCustom.cpp: + (WebCore::JSMessagePort::markChildren): + (WebCore::JSMessagePort::addEventListener): + (WebCore::JSMessagePort::removeEventListener): + * bindings/js/JSNodeCustom.cpp: + (WebCore::JSNode::addEventListener): + (WebCore::JSNode::removeEventListener): + (WebCore::JSNode::markChildren): + * bindings/js/JSNodeFilterCondition.cpp: + (WebCore::JSNodeFilterCondition::acceptNode): + * bindings/js/JSQuarantinedObjectWrapper.cpp: + (WebCore::JSQuarantinedObjectWrapper::construct): + (WebCore::JSQuarantinedObjectWrapper::call): + * bindings/js/JSSVGElementInstanceCustom.cpp: + (WebCore::JSSVGElementInstance::addEventListener): + (WebCore::JSSVGElementInstance::removeEventListener): + * bindings/js/JSSharedWorkerCustom.cpp: + (WebCore::JSSharedWorker::markChildren): + * bindings/js/JSWebSocketCustom.cpp: + (WebCore::JSWebSocket::addEventListener): + (WebCore::JSWebSocket::removeEventListener): + * bindings/js/JSWorkerContextCustom.cpp: + (WebCore::JSWorkerContext::addEventListener): + (WebCore::JSWorkerContext::removeEventListener): + (WebCore::JSWorkerContext::setTimeout): + (WebCore::JSWorkerContext::setInterval): + * bindings/js/JSXMLHttpRequestConstructor.cpp: + (WebCore::constructXMLHttpRequest): + * bindings/js/JSXMLHttpRequestCustom.cpp: + (WebCore::JSXMLHttpRequest::markChildren): + (WebCore::JSXMLHttpRequest::addEventListener): + (WebCore::JSXMLHttpRequest::removeEventListener): + * bindings/js/JSXMLHttpRequestUploadCustom.cpp: + (WebCore::JSXMLHttpRequestUpload::markChildren): + (WebCore::JSXMLHttpRequestUpload::addEventListener): + (WebCore::JSXMLHttpRequestUpload::removeEventListener): + * bindings/js/ScheduledAction.cpp: + (WebCore::ScheduledAction::create): + (WebCore::ScheduledAction::ScheduledAction): + (WebCore::ScheduledAction::executeFunctionInContext): + (WebCore::ScheduledAction::execute): + * bindings/js/ScheduledAction.h: + (WebCore::ScheduledAction::ScheduledAction): + * bindings/js/ScriptCachedFrameData.cpp: + (WebCore::ScriptCachedFrameData::ScriptCachedFrameData): + (WebCore::ScriptCachedFrameData::restore): + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::~ScriptController): + (WebCore::ScriptController::evaluateInWorld): + (WebCore::ScriptController::evaluate): + (WebCore::ScriptController::evaluateInIsolatedWorld): + (WebCore::ScriptController::clearWindowShell): + (WebCore::ScriptController::initScript): + (WebCore::ScriptController::processingUserGestureEvent): + (WebCore::ScriptController::attachDebugger): + (WebCore::ScriptController::updateDocument): + (WebCore::ScriptController::bindingRootObject): + (WebCore::ScriptController::createRootObject): + (WebCore::ScriptController::windowScriptNPObject): + (WebCore::ScriptController::jsObjectForPluginElement): + * bindings/js/ScriptController.h: + (WebCore::ScriptController::windowShell): + (WebCore::ScriptController::existingWindowShell): + (WebCore::ScriptController::globalObject): + (WebCore::ScriptController::forgetWorld): + * bindings/js/ScriptControllerMac.mm: + (WebCore::ScriptController::windowScriptObject): + * bindings/js/ScriptEventListener.cpp: + (WebCore::createAttributeEventListener): + * bindings/js/ScriptFunctionCall.cpp: + (WebCore::ScriptFunctionCall::call): + (WebCore::ScriptFunctionCall::construct): + * bindings/js/ScriptObjectQuarantine.cpp: + (WebCore::getQuarantinedScriptObject): + * bindings/js/ScriptState.cpp: + (WebCore::scriptStateFromNode): + (WebCore::scriptStateFromPage): + * bindings/js/ScriptState.h: + * bindings/js/WorkerScriptController.cpp: + (WebCore::WorkerScriptController::WorkerScriptController): + (WebCore::WorkerScriptController::evaluate): + * bindings/objc/DOMInternal.mm: + (-[WebScriptObject _initializeScriptDOMNodeImp]): + * bindings/objc/WebScriptObject.mm: + (-[WebScriptObject callWebScriptMethod:withArguments:]): + (-[WebScriptObject evaluateWebScript:]): + * bindings/scripts/CodeGeneratorJS.pm: + * bridge/NP_jsobject.cpp: + (_NPN_InvokeDefault): + (_NPN_Invoke): + (_NPN_Evaluate): + (_NPN_Construct): + * bridge/jni/jni_jsobject.mm: + (JavaJSObject::call): + (JavaJSObject::eval): + * dom/Document.cpp: + (WebCore::Document::createWrapperCache): + * dom/Document.h: + (WebCore::Document::wrapperCacheMap): + (WebCore::Document::getWrapperCache): + * inspector/InspectorController.cpp: + (WebCore::InspectorController::startUserInitiatedProfiling): + (WebCore::InspectorController::stopUserInitiatedProfiling): + * inspector/JavaScriptCallFrame.cpp: + (WebCore::JavaScriptCallFrame::evaluate): + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::dispatchWindowObjectAvailable): + * platform/network/mac/AuthenticationMac.mm: + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::XMLHttpRequest): + (WebCore::XMLHttpRequest::dropProtection): + * xml/XMLHttpRequest.h: + (WebCore::XMLHttpRequest::create): + +2009-10-22 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: EventListenersSidebarPane TODO No Longer Needed + https://bugs.webkit.org/show_bug.cgi?id=30705 + + * inspector/front-end/EventListenersSidebarPane.js: + +2009-10-22 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Tim Hatcher. + + https://bugs.webkit.org/show_bug.cgi?id=30506 + <rdar://problem/7319845> Resources that the server sent as 304 not modified are not shown + in the inspectors resource pane + + I don't know how to make a test for this. + + The issue here was that preloaded resources weren't added to DocLoader document resource set, + but Web Inspector asked DocLoader to fetch data from CachedResource. Even when (if) document + parser eventually requested the same resource for real and it got added to resource set, it + was too late - the Inspector wasn't updated. + + * inspector/InspectorResource.cpp: + (WebCore::InspectorResource::cachedResource): + (WebCore::InspectorResource::type): + (WebCore::InspectorResource::resourceData): + * inspector/InspectorResource.h: + Fix the issue by trying to fetch corresponding CachedResource harder - also look in global + cache. This seems safe, and easier than updating the Inspector on transitions between + resource states (revalidate vs. revalidate done and preload vs. non-preload). + +2009-10-22 Beth Dakin <bdakin@apple.com> + + Reviewed by Dan Bernstein. + + Fix for <rdar://problem/6942706> ER: Add a CSS property that allows + shadows to work for SVG content + -and corresponding- + https://bugs.webkit.org/show_bug.cgi?id=30479 + + This patch adds a new SVG-specific CSS property called -webkit- + shadow that has the same syntax as -webkit-box-shadow + + Add CSSPropertyWebkitShadow to the list of SVG CSS properties, and + make valueForShadow a member function rather than a static function + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::): + (WebCore::CSSComputedStyleDeclaration::valueForShadow): + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): + * css/CSSComputedStyleDeclaration.h: + + Call valueForShadow for CSSPropertyWebkitShadow + * css/SVGCSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue): + + Do standard CSS stuff for CSSPropertyWebkitShadow + * css/SVGCSSParser.cpp: + (WebCore::CSSParser::parseSVGValue): + * css/SVGCSSPropertyNames.in: + * css/SVGCSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applySVGProperty): + + Set the appropriate shadow on the paint context if we have one. + This seems to be all we have to do to have an SVG-shaped shadow. + * rendering/SVGRenderSupport.cpp: + (WebCore::SVGRenderBase::prepareToRenderSVGContent): + + Add shadow to SVGRenderStyle. I added a new macro that I don't like + just because that's the way things are done here right now. + * rendering/style/SVGRenderStyle.cpp: + (WebCore::SVGRenderStyle::SVGRenderStyle): + (WebCore::SVGRenderStyle::operator==): + * rendering/style/SVGRenderStyle.h: + * rendering/style/SVGRenderStyleDefs.cpp: + (StyleShadowSVGData::StyleShadowSVGData): + (StyleShadowSVGData::operator==): + * rendering/style/SVGRenderStyleDefs.h: + (WebCore::StyleShadowSVGData::create): + (WebCore::StyleShadowSVGData::copy): + (WebCore::StyleShadowSVGData::operator!=): + +2009-10-22 Joanmarie Diggs <joanmarie.diggs@gmail.com> + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=25530 + [Gtk] Implement LABEL_FOR/LABELLED_BY relationship pair for labels + + Implements atk_object_ref_relation_set and LABEL_FOR/LABELLED_BY. + Also causes the accessible name for labeled controls to be based on + the label as expected, rather than based on the contents. + + * accessibility/AccessibilityRenderObject.h: + * accessibility/AccessibilityRenderObject.cpp: + (correspondingLabelForControlElement): + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (setAtkRelationSetFromCoreObject): + (webkit_accessible_ref_relation_set): + (webkit_accessible_class_init): + (webkit_accessible_get_name): + +2009-10-22 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: windowFocused and windowBlured Fail to Clear/Mark Inspector as "inactive" + https://bugs.webkit.org/show_bug.cgi?id=30663 + + Correctly handle focusing/blurring on inner <iframe>'s such as Source Frames. + + * inspector/front-end/inspector.js: + (WebInspector.windowFocused): fix for inner iframes + (WebInspector.windowBlurred): fix for inner iframes + (WebInspector.addMainEventListeners): change useCapture to false + +2009-10-22 Jaime Yap <jaimeyap@google.com> + + Reviewed by Timothy Hatcher. + + Makes a page reload optional when activating resource monitoring in + InspectorController. It leaves the default behavior as performing the reload. + Reload is an optional param so callsites do not have to change. + + https://bugs.webkit.org/show_bug.cgi?id=30684 + + No new tests added. + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::enableResourceTracking): + * inspector/InspectorController.h: + +2009-10-22 Shu Chang <Chang.Shu@nokia.com> + + Reviewed by Eric Seidel. + + [Qt] Fix memory leak in QNetworkReplyHandler::abort(). + In QNetworkReplyHandler::release(), m_reply should no longer point to its parent + after being released. + https://bugs.webkit.org/show_bug.cgi?id=30167 + + No layout test available as a non-functional fix. + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::abort): + (WebCore::QNetworkReplyHandler::release): + +2009-10-22 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Fix DOMAgent leak. + + https://bugs.webkit.org/show_bug.cgi?id=30615 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::~InspectorController): + (WebCore::InspectorController::setFrontendProxyObject): + (WebCore::InspectorController::close): + (WebCore::InspectorController::releaseDOMAgent): + * inspector/InspectorController.h: + * inspector/InspectorDOMAgent.h: + (WebCore::InspectorDOMAgent::create): + +2009-10-22 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Adam Barth. + + [V8] Rework event listeners to not hold references to frame or V8 context. + + https://bugs.webkit.org/show_bug.cgi?id=30648 + + Covered by existing layout tests: fast/events/attribute-listener* + + * bindings/scripts/CodeGeneratorV8.pm: Added passing ScriptExecutionContext* + to event listener handling code. + * bindings/v8/DateExtension.cpp: + (WebCore::DateExtension::setAllowSleep): Changed to use currentContext(). + * bindings/v8/ScriptEventListener.cpp: + (WebCore::createAttributeEventListener): Reworked to match JSC logic. + (WebCore::getEventListenerHandlerBody): Added ScriptExecutionContext* param. + * bindings/v8/V8AbstractEventListener.cpp: + (WebCore::V8AbstractEventListener::V8AbstractEventListener): Removed Frame* param + and usage. + (WebCore::V8AbstractEventListener::handleEvent): Chaged to use ScriptExecutionContext*. + (WebCore::V8AbstractEventListener::invokeEventHandler): Ditto. + * bindings/v8/V8AbstractEventListener.h: + (WebCore::V8AbstractEventListener::getListenerObject): Ditto. + (WebCore::V8AbstractEventListener::prepareListenerObject): Ditto. + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::convertEventListenerToV8Object): Added ScriptExecutionContext* param. + (WebCore::V8DOMWrapper::getEventListener): Ditto. + * bindings/v8/V8DOMWrapper.h: + (WebCore::V8DOMWrapper::convertEventListenerToV8Object): Ditto. + * bindings/v8/V8EventListenerList.h: + (WebCore::V8EventListenerList::findOrCreateWrapper): Removed ContextType* template param, + because it's no longer needed. + * bindings/v8/V8IsolatedWorld.h: + (WebCore::V8IsolatedWorld::sharedContext): Renamed from shared_context. + * bindings/v8/V8LazyEventListener.cpp: + (WebCore::V8LazyEventListener::V8LazyEventListener): Removed Frame* param and usage. + (WebCore::V8LazyEventListener::callListenerFunction): Added ScriptExecutionContext* param. + (WebCore::V8LazyEventListener::prepareListenerObject): Ditto. + * bindings/v8/V8LazyEventListener.h: + (WebCore::V8LazyEventListener::create): Reordered params to match JSC impl. + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::V8Proxy): Adjusted formatting to match WebKit style. + (WebCore::V8Proxy::evaluateInNewContext): Changed to use m_context directly. + (WebCore::V8Proxy::setInjectedScriptContextDebugId): Ditto. + (WebCore::V8Proxy::createWrapperFromCacheSlowCase): Ditto. + (WebCore::V8Proxy::isContextInitialized): Ditto. + (WebCore::V8Proxy::updateDocumentWrapperCache): Ditto. + (WebCore::V8Proxy::clearDocumentWrapperCache): Ditto. + (WebCore::V8Proxy::disposeContextHandles): Added explicit disposing of m_context. + (WebCore::V8Proxy::clearForClose): Changed to use m_context directly. + (WebCore::V8Proxy::clearForNavigation): Ditto. + (WebCore::V8Proxy::setSecurityToken): Ditto. + (WebCore::V8Proxy::updateDocument): Ditto. + (WebCore::V8Proxy::initContextIfNeeded): Ditto. + (WebCore::V8Proxy::context): Changed to use v8::Local. + (WebCore::V8Proxy::mainWorldContext): Changed to use m_context directly. + (WebCore::V8Proxy::setContextDebugId): Ditto. + (WebCore::toV8Context): + * bindings/v8/V8Proxy.h: Removed shared_context decl, changed to use straight + v8::Persistent for m_context. + * bindings/v8/V8WorkerContextEventListener.cpp: + (WebCore::workerProxy): Added. + (WebCore::V8WorkerContextEventListener::V8WorkerContextEventListener): Removed + WorkerContextExecutionProxy* param. + (WebCore::V8WorkerContextEventListener::handleEvent): Started using ScriptExecutionContext*. + (WebCore::V8WorkerContextEventListener::reportError): Ditto. + (WebCore::V8WorkerContextEventListener::callListenerFunction): Ditto. + (WebCore::V8WorkerContextEventListener::getReceiverObject): Ditto. + * bindings/v8/V8WorkerContextEventListener.h: + (WebCore::V8WorkerContextEventListener::create): Removed + WorkerContextExecutionProxy* param. + * bindings/v8/WorkerContextExecutionProxy.cpp: + (WebCore::WorkerContextExecutionProxy::findOrCreateEventListener): Removed ContextType* + template param. + * bindings/v8/custom/V8CustomEventListener.cpp: + (WebCore::V8EventListener::V8EventListener): Removed Frame* param. + (WebCore::V8EventListener::getListenerFunction): Started using ScriptExecutionContext*. + (WebCore::V8EventListener::callListenerFunction): Ditto. + * bindings/v8/custom/V8CustomEventListener.h: + (WebCore::V8EventListener::create): Removed Frame* param. + +2009-10-14 Gaurav Shah <gauravsh@google.com> + + Reviewed by Darin Fisher. + + Replaces temporary link stub for <keygen> tag handler for the Chromium + browser with a call via the Chromium Bridge. + + https://bugs.webkit.org/show_bug.cgi?id=30360 + + * platform/SSLKeyGenerator.h: + * platform/chromium/ChromiumBridge.h: + * platform/chromium/SSLKeyGeneratorChromium.cpp: + (WebCore::getSupportedKeySizes): + (WebCore::signedPublicKeyAndChallengeString): + * platform/chromium/TemporaryLinkStubs.cpp: + (WebCore::KURL::fileSystemPath): + (WebCore::SharedBuffer::createWithContentsOfFile): + +2009-10-22 Avi Drissman <avi@chromium.org> + + Reviewed by Eric Seidel. + + Fixes Chromium Mac pasteboard handling to flow through the same code paths as other platforms. + + https://bugs.webkit.org/show_bug.cgi?id=30591 + + * platform/chromium/ChromiumBridge.h: + * platform/chromium/PasteboardChromium.cpp: + (WebCore::Pasteboard::writeImage): + +2009-10-20 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler. + + Make accelerated compositing debug indicators work in release builds + https://bugs.webkit.org/show_bug.cgi?id=30588 + + Allow some debug indicators, that show which page elements go into compositing layers, + to work in release builds, when the runtime prefs are set. + + * platform/graphics/GraphicsLayer.cpp: + (WebCore::GraphicsLayer::GraphicsLayer): + (WebCore::GraphicsLayer::setZPosition): + * platform/graphics/GraphicsLayer.h: + * platform/graphics/mac/GraphicsLayerCA.h: + * platform/graphics/mac/GraphicsLayerCA.mm: + (WebCore::clearBorderColor): + (WebCore::GraphicsLayer::showRepaintCounter): + (WebCore::GraphicsLayerCA::GraphicsLayerCA): + (WebCore::GraphicsLayerCA::updateMasksToBounds): + (WebCore::GraphicsLayerCA::updateLayerDrawsContent): + (WebCore::GraphicsLayerCA::setDebugBorder): + (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer): + (WebCore::GraphicsLayerCA::setupContentsLayer): + * platform/graphics/mac/WebLayer.mm: + +2009-10-22 Keishi Hattori <casey.hattori@gmail.com> + + Reviewed by Pavel Feldman. + + Inspector should support monitorEvents/un monitorEvents() in the command line + https://bugs.webkit.org/show_bug.cgi?id=19879 + + * inspector/front-end/EventListenersSidebarPane.js: + (WebInspector.EventListenersSidebarPane.prototype.update.callback): Ignores event listeners generated by monitorEvent + * inspector/front-end/InjectedScript.js: + (InjectedScript._ensureCommandLineAPIInstalled): Added _inspectorCommandLineAPI._logEvent, _allEventTypes, + _normalizeEventTypes, monitorEvent, unmonitorEvent. + +2009-10-21 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Pavel Feldman. + + Web Inspector: windowFocused and windowBlurred Fail to Clear/Mark Inspector as "inactive" + https://bugs.webkit.org/show_bug.cgi?id=30663 + + * inspector/front-end/inspector.js: + (WebInspector.windowFocused): + (WebInspector.windowBlurred): + +2009-10-22 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Error - requestContentType [undefined] is not an object + https://bugs.webkit.org/show_bug.cgi?id=30666 + + * inspector/front-end/ResourceView.js: + (WebInspector.ResourceView.prototype._refreshFormData): + +2009-10-22 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Holger Freyther. + + [Haiku] Correction of the accented letter width (they were 2 characters long). + https://bugs.webkit.org/show_bug.cgi?id=30629 + + * platform/graphics/haiku/SimpleFontDataHaiku.cpp: + (WebCore::SimpleFontData::platformWidthForGlyph): + +2009-10-21 Jon Honeycutt <jhoneycutt@apple.com> + + <rdar://problem/7270320> Screenshots of off-screen plug-ins are blank + <rdar://problem/7270314> After halting a transparent PluginView on + Windows, the transparency is applied twice + + Replace use of Frame::nodeImage() with a function that takes a snapshot + of a PluginView. + + Reviewed by Dan Bernstein. + + * plugins/PluginView.h: + Made paintWindowedPluginIntoContext() non-const, as it now calls + paintIntoTransformedContext(). Declare paintIntoTransformedContext() + and snapshot() for Windows platforms. + + * plugins/win/PluginViewWin.cpp: + (WebCore::PluginView::paintIntoTransformedContext): + Paints into the passed HDC without applying any coordinate translations. + Code moved from paintWindowedPluginIntoContext() and paint(). Removed + the memset() of windowpos in lieu of assignment. + (WebCore::PluginView::paintWindowedPluginIntoContext): + Code moved to paintIntoTransformedContext(). + (WebCore::PluginView::paint): + Ditto. + (WebCore::PluginView::snapshot): + Create a context, and if the plug-in is windowless, translate it so the + plug-in will draw at the correct location. Create a bitmap, and select + it into the context. Paint the plug-in, and create a BitmapImage from + the bitmap. + (WebCore::PluginView::halt): + Use snapshot(). + +2009-10-22 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Alexey Proskuryakov. + + Fix calculation of length in WebSocketChannel.cpp + https://bugs.webkit.org/show_bug.cgi?id=30656 + + * websockets/WebSocketChannel.cpp: + (WebCore::WebSocketChannel::didReceiveData): + +2009-10-21 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Dimitri Glazkov. + + Adding the ability to enable/disable functions in V8 at runtime. + + https://bugs.webkit.org/show_bug.cgi?id=30650 + + * bindings/scripts/CodeGeneratorV8.pm: + +2009-10-21 Darin Adler <darin@apple.com> + + Swedish search (and other languages as well) is broken while fixing Japanese search + https://bugs.webkit.org/show_bug.cgi?id=30646 + + Rolled Japanese tailoring out that was done to fix + https://bugs.webkit.org/show_bug.cgi?id=30437 earlier. + It was overriding the locale-specific tailoring. + We'll land a fix once we figure out how to add the + Japanese tailoring without removing anything. + + * editing/TextIterator.cpp: Rolled out r49924. + +2009-10-21 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: chromium build fix - add missing image to gypi. + + * WebCore.gypi: + +2009-10-21 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Eric Seidel. + + Fixes part of <http://webkit.org/b/30522>. + Web Inspector: DOM Exceptions throughout the Inspector should be more human readable. + + Expose the description attribute that is now a member of + ExceptionBase as of r49723, so when a user logs an exception, they + can see the description in the Web Inspector. + + Test: fast/dom/dom-exception-description.html + + * dom/DOMCoreException.idl: + * dom/EventException.idl: + * dom/RangeException.idl: + * svg/SVGException.idl: + * xml/XMLHttpRequestException.idl: + * xml/XPathException.idl: + +2009-10-21 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Timothy Hatcher. + + Fixes <https://bugs.webkit.org/show_bug.cgi?id=30616>. + REGRESSION (r49036): Web Inspector: Summary graph no longer switching to size summary. + + Add a check to make sure a function we need to calculate percentages is + defined before we use it. + + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype._updateGraphDividersIfNeeded): + +2009-10-21 Keishi Hattori <casey.hattori@gmail.com> + + Reviewed by Timothy Hatcher. + + REGRESSION: Clicking on nodes in the console should take you to the element in the DOM + https://bugs.webkit.org/show_bug.cgi?id=27231 + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype._formatnode): Turns on ElementsTreeOutline.showInElementsPanelEnabled + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeOutline): Added ElementsTreeOutline.showInElementsPanelEnabled + (WebInspector.ElementsTreeElement.prototype.onmousedown): Reveals the node in the Elements panel if + treeOutline.showInElementsPanelEnabled is true. + +2009-10-21 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=30637 + Fix a compiler warning in windows. + + * loader/ResourceLoadNotifier.h: + +2009-10-21 Dmitry Titov <dimich@chromium.org> + + Reviewed by Darin Adler. + + Fix the crash when a node not in a document receives dispatchEvent. + https://bugs.webkit.org/show_bug.cgi?id=30611 + + Test: fast/events/dispatch-event-no-document.html + + * dom/EventTarget.cpp: Check for scriptExecutionContext() at the moment of dispatchEvent; do nothing if no context. + (WebCore::EventTarget::dispatchEvent): + +2009-10-21 Adam Langley <agl@google.com> + + Reviewed by Eric Seidel. + + Chromium Linux: disable subpixel text on layers. + + https://bugs.webkit.org/show_bug.cgi?id=30635 + http://code.google.com/p/chromium/issues/detail?id=25365 + + With the addition of layers for drawing rounded corners in r49641, + subpixel text on rounded rectangles broke. This is because the layer + only contains a single alpha channel and this is insufficient to + compose subpixel text correctly. + + On Windows, a large body of code in TransparencyWin.cpp exists to try + to deal with this. Even then, in some cases, it downgrades to + anti-aliased text. We need a fix for the grevious effects quickly thus + this patch disables subpixel text when rendering into a layer. + + This would be covered by existing tests except that subpixel text is + disabled for pixel tests on Chromium Linux. + + * platform/graphics/chromium/FontLinux.cpp: + (WebCore::isCanvasMultiLayered): + (WebCore::adjustTextRenderMode): + (WebCore::Font::drawGlyphs): + (WebCore::Font::drawComplexText): + +2009-10-21 Kevin Ollivier <kevino@theolliviers.com> + + wxMac 10.4 build fix, make sure we specify the Sqlite3 dependency correctly as otherwise + it will use the sqlite3 system library rather than WebCoreSQLite3. + + * wscript: + +2009-10-21 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + Fixed background-clip parsing regressions introduced in r46240. + + Test: fast/css/background-clip-text.html + + * css/CSSParser.cpp: + (WebCore::parseBackgroundClip): Added this helper method. + (WebCore::CSSParser::parseFillShorthand): Use parseBackgroundClip() to + reparse the value. The old code called parseFillProperty() again, which + didn’t work, because parseFillProperty() advances the value list. + (WebCore::CSSParser::parseFillProperty): Changed to use + parseBackgroundClip(). + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::operator EFillBox): Added a case for + CSSValueWebkitText. + +2009-10-21 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Timothy Hatcher. + + Enable creation of custom SidebarTreeElements for different ProfileTypes + + ProfileTypes can now create sidebar tree elements of custom types. + https://bugs.webkit.org/show_bug.cgi?id=30520 + + * inspector/front-end/ProfileView.js: + (WebInspector.CPUProfileType.prototype.setRecordingProfile): + (WebInspector.CPUProfileType.prototype.createSidebarTreeElementForProfile): + (WebInspector.CPUProfileType.prototype.createView): + (WebInspector.CPUProfile.prototype.get head): + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfileType.prototype.buttonClicked): + (WebInspector.ProfileType.prototype.viewForProfile): + (WebInspector.ProfileType.prototype.createView): + (WebInspector.ProfileType.prototype.createSidebarTreeElementForProfile): + (WebInspector.ProfilesPanel.prototype.addProfileHeader): + (WebInspector.ProfilesPanel.prototype.showProfile): + +2009-10-20 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Selectors in the Styles pane should trigger a search for that selector when clicked + https://bugs.webkit.org/show_bug.cgi?id=17126 + + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype.addNodesToSearchResult): only change focusedDOMNode on a manual search + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertiesSection.prototype._clickSelector): trigger a search + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype._startEditing): correctly start editing attribute value instead of name + +2009-10-20 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Fix DOM Agent leak. + + https://bugs.webkit.org/show_bug.cgi?id=30615 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::~InspectorController): + +2009-10-21 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Holger Freyther. + + Plugins: Create manual tests for testing plugins + + Create two test files: + 1. windowed.html - Test plugin in windowed mode. + 2. windowless.html - Test plugin in windowless mode. + + https://bugs.webkit.org/show_bug.cgi?id=30503 + + * manual-tests/plugins/windowed.html: Added. + * manual-tests/plugins/windowless.html: Added. + +2009-10-21 Satoshi Nakagawa <psychs@limechat.net> + + Reviewed by Darin Adler. + + Fixed Japanese text search problems. + Treat small kana letters and kana letters as different characters in search. + Do not ignore diacritic marks in search for Japanese texts. + + https://bugs.webkit.org/show_bug.cgi?id=30437 + + Test: fast/text/international/japanese-kana-letters.html + + * editing/TextIterator.cpp: + (WebCore::createCollator): + (WebCore::collator): + (WebCore::createSearcher): + +2009-10-20 Eric Z. Ayers <zundel@google.com> + + Reviewed by Timothy Hatcher. + + Changes TimelineItems to be created with raw timestamps as opposed + to a time relative to a start of session. Normalized timestamps cause + problems when monitoring a browsing session across multiple page + transitions. + + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent::InspectorTimelineAgent): + (WebCore::InspectorTimelineAgent::willDispatchDOMEvent): + (WebCore::InspectorTimelineAgent::willLayout): + (WebCore::InspectorTimelineAgent::willRecalculateStyle): + (WebCore::InspectorTimelineAgent::willPaint): + (WebCore::InspectorTimelineAgent::willWriteHTML): + (WebCore::InspectorTimelineAgent::reset): + (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord): + * inspector/InspectorTimelineAgent.h: + +2009-10-20 Mark Rowe <mrowe@apple.com> + + Reviewed by Oliver Hunt. + + Fix leak of WebSocketChannel by adopting the newly-created reference. + + * websockets/WebSocketChannel.h: + (WebCore::WebSocketChannel::create): + +2009-10-20 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Adam Barth. + + DOM Storage runtime flag changes + https://bugs.webkit.org/show_bug.cgi?id=30602 + + Part 1/2. Removing sessionStorageEnabled in next patch after the + Chromium side of the changes lands. + + Revert my changes to Settings and instead implement DOM Storage enabling via + the methods agreed upon in https://bugs.webkit.org/show_bug.cgi?id=30240 + + This stuff was (intentionally) never exposed to web pages or DRT, so there's no + LayoutTest visible changes and thus no tests. + + * bindings/v8/custom/V8CustomBinding.h: + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::ACCESSOR_RUNTIME_ENABLER): + * page/DOMWindow.idl: + * storage/Storage.cpp: + (WebCore::Storage::setLocalStorageAvailable): + (WebCore::Storage::localStorageAvailable): + (WebCore::Storage::setSessionStorageAvailable): + (WebCore::Storage::sessionStorageAvailable): + * storage/Storage.h: + +2009-10-20 John Gregg <johnnyg@google.com> + + Reviewed by David Levin. + + Need to turn off notifications properly at runtime + https://bugs.webkit.org/show_bug.cgi?id=30409 + + This code only affects chromium, and is all behind a compile time + flag current turned off, so no new tests. + + * bindings/v8/custom/V8CustomBinding.h: + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::ACCESSOR_RUNTIME_ENABLER): + * bindings/v8/custom/V8WorkerContextCustom.cpp: + (WebCore::ACCESSOR_RUNTIME_ENABLER): + * notifications/NotificationCenter.cpp: + (WebCore::NotificationCenter::setIsAvailable): + (WebCore::NotificationCenter::isAvailable): + * notifications/NotificationCenter.h: + * page/DOMWindow.idl: + * workers/WorkerContext.idl: + +2009-10-20 James Robinson <jamesr@chromium.org> + + Reviewed by Adam Barth. + + Fixes RefPtr initialization in the V8 implementation of WebCore::ScriptString to use the ::create() idiom and + use adoptRef() properly. I failed to read the RefPtr docs the first time through :( + + No new tests, error was caught by valgrind on the Chromium builders. + + * bindings/v8/ScriptString.h: + (WebCore::ScriptString::ScriptString): + (WebCore::ScriptString::operator=): + * bindings/v8/ScriptStringImpl.h: + (WebCore::ScriptStringImpl::create): + +2009-10-20 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: populate child nodes before sorting them. + + https://bugs.webkit.org/show_bug.cgi?id=29673 + + * inspector/front-end/BottomUpProfileDataGridTree.js: + (WebInspector.BottomUpProfileDataGridNode): Swapped with BottomUpProfileDataGridTree to be consistent with TopDownProfileDataGridNode. + (WebInspector.BottomUpProfileDataGridNode.prototype._takePropertiesFromProfileDataGridNode): + (WebInspector.BottomUpProfileDataGridNode.prototype._keepOnlyChild): + (WebInspector.BottomUpProfileDataGridNode.prototype._exclude): + (WebInspector.BottomUpProfileDataGridNode.prototype._merge): + (WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate): + (WebInspector.BottomUpProfileDataGridTree.prototype.exclude): + * inspector/front-end/ProfileDataGridTree.js: + (WebInspector.ProfileDataGridNode.prototype.sort): Added missing parentheses. + (WebInspector.ProfileDataGridNode.prototype.get _parent): + (WebInspector.ProfileDataGridNode.prototype._populate): + * inspector/front-end/TopDownProfileDataGridTree.js: + (WebInspector.TopDownProfileDataGridNode.prototype._sharedPopulate): + +2009-10-20 Jens Alfke <snej@chromium.org> + + Reviewed by Eric Seidel. + + Remove redundant String ref/deref calls in generated V8 bindings. + https://bugs.webkit.org/show_bug.cgi?id=30579 + + * bindings/v8/V8Binding.h: + (WebCore::toString): Fix return type of 'toString' to make it truly a no-op + instead of constructing/destructing a String. + +2009-10-20 Joanmarie Diggs <joanmarie.diggs@gmail.com> + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=25411 + [GTK] ATK accessible ancestry broken + + Work around for the problem of bogus additional objects in the ancestry. + We now set the parent when we ref the child, then ask the Atk child if + it knows its parent. This solves the bulk of the cases. For those it + doesn't, fall back to the existing logic. + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (webkit_accessible_get_parent): + (webkit_accessible_ref_child): + +2009-10-20 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Alice Liu. + + Fixes <http://webkit.org/b/30421>. + Web Inpsector: Local Files can show up on Cookies List with Cookies from other Domain. + + When a page like Google generates an about:blank, it shows up as a local file on + the list of Cookie domains, but has all of the cookies of Google. When we are adding + cookie domains to the inspector, we should only add the domain is the URL of the resource + is in the HTTP protocol family or a file URL. + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::populateScriptObjects): + (WebCore::InspectorController::didFinishLoading): + +2009-10-20 Mark Mentovai <mark@chromium.org> + + Reviewed by Darin Fisher. + + Use a version of libWebKitSystemInterface with global symbols marked + private_extern for Chromium Mac. + + https://bugs.webkit.org/show_bug.cgi?id=30590 + + * WebCore.gyp/WebCore.gyp: + * WebCore.gyp/mac: Added. + * WebCore.gyp/mac/Empty.cpp: Added. + * WebCore.gyp/mac/adjust_visibility.sh: Added. + +2009-10-20 Zoltan Horvath <zoltan@webkit.org> + + Reviewed by Eric Seidel. + + Allow custom memory allocation control for WebCore's CSSProperty + https://bugs.webkit.org/show_bug.cgi?id=30564 + + Inherits CSSProperty class from FastAllocBase because it has been + instantiated by 'new' in WebCore/css/CSSParser.cpp:367. + + * css/CSSProperty.h: + +2009-10-20 Andrew Scherkus <scherkus@chromium.org> + + Reviewed by Eric Seidel. + + Hide Chromium's media slider thumb if no source has been loaded. + + https://bugs.webkit.org/show_bug.cgi?id=30529 + + Covered by existing layout tests, notably: + LayoutTests/media/controls-rendering.html + LayoutTests/media/unsupported-tracks.html + LayoutTests/media/video-src-none.html + + * rendering/RenderMediaControlsChromium.cpp: + (WebCore::hasSource): Returns true if an HTMLMediaElement has a valid source set. + (WebCore::paintMediaMuteButton): Refactored to use hasSource(). + (WebCore::paintMediaPlayButton): Ditto. + (WebCore::paintMediaSliderThumb): Add call to hasSource() to determine if we should paint the thumb. + +2009-10-20 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Added getter for FrameLoader:m_suppressOpenerInNewFrame. + This will allow Chromium to more intelligently detect + noreferrer links and therefore open them in a new process. + + https://bugs.webkit.org/show_bug.cgi?id=30581 + + * loader/FrameLoader.h: + (WebCore::FrameLoader::suppressOpenerInNewFrame): Added. + +2009-10-20 Zoltan Horvath <zoltan@webkit.org> + + Reviewed by Darin Adler. + + Allow custom memory allocation control for WebCore's CSSParserFunction + https://bugs.webkit.org/show_bug.cgi?id=30563 + + Inherits CSSParserFunction struct from FastAllocBase because it has been + instantiated by 'new' in WebCore/css/CSSParser.cpp:4827. + + * css/CSSProperty.h: + +2009-10-20 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Watched Expressions Buttons Do Not Match Inspector Styles + https://bugs.webkit.org/show_bug.cgi?id=30554 + + * inspector/front-end/inspector.css: added style to pane buttons + +2009-10-20 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Set debug id for contexts of isolated worlds to distinguish them in debugger. + + https://bugs.webkit.org/show_bug.cgi?id=30559 + + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::evaluateInIsolatedWorld): + (WebCore::V8Proxy::evaluateInNewContext): + (WebCore::V8Proxy::setInjectedScriptContextDebugId): + * bindings/v8/V8Proxy.h: + +2009-10-20 Andras Becsi <becsi.andras@stud.u-szeged.hu> + + Unreviewed buildfix. + [Qt] Add FEGaussianBlur.h and FEGaussianBlur.cpp which were refactored in r49778 to WebCore.pro. + + * WebCore.pro: + 2009-10-20 Fumitoshi Ukai <ukai@chromium.org> Reviewed by David Levin. @@ -2704,7 +6961,6 @@ (InjectedScript.CallFrameProxy.prototype._wrapScopeChain): don't send call frame properties until they're needed. * inspector/front-end/ScriptsPanel.js: ->>>>>>> .r49765 2009-10-13 Yongjun Zhang <yongjun.zhang@nokia.com> Reviewed by Ariya Hidayat. diff --git a/src/3rdparty/webkit/WebCore/DerivedSources.cpp b/src/3rdparty/webkit/WebCore/DerivedSources.cpp index be83136..1edbf7d 100644 --- a/src/3rdparty/webkit/WebCore/DerivedSources.cpp +++ b/src/3rdparty/webkit/WebCore/DerivedSources.cpp @@ -82,6 +82,7 @@ #include "JSFile.cpp" #include "JSFileList.cpp" #include "JSHistory.cpp" +#include "JSHTMLAllCollection.cpp" #include "JSHTMLAnchorElement.cpp" #include "JSHTMLAppletElement.cpp" #include "JSHTMLAreaElement.cpp" diff --git a/src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/DateInstanceCache.h b/src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/DateInstanceCache.h new file mode 100644 index 0000000..f39bdee --- /dev/null +++ b/src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/DateInstanceCache.h @@ -0,0 +1,4 @@ +#ifndef WebCore_FWD_DateInstanceCache_h +#define WebCore_FWD_DateInstanceCache_h +#include <JavaScriptCore/DateInstanceCache.h> +#endif diff --git a/src/3rdparty/webkit/WebCore/LICENSE-APPLE b/src/3rdparty/webkit/WebCore/LICENSE-APPLE index 92514e2..f29b41c 100644 --- a/src/3rdparty/webkit/WebCore/LICENSE-APPLE +++ b/src/3rdparty/webkit/WebCore/LICENSE-APPLE @@ -1,22 +1,21 @@ -Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. +Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/3rdparty/webkit/WebCore/WebCore.gypi b/src/3rdparty/webkit/WebCore/WebCore.gypi index c0da0ec..c0baaf4 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.gypi +++ b/src/3rdparty/webkit/WebCore/WebCore.gypi @@ -1,6 +1,6 @@ { 'variables': { - 'webcore_files': [ + 'webcore_bindings_idl_files': [ #IDL files 'css/CSSCharsetRule.idl', @@ -51,7 +51,6 @@ 'dom/EventException.idl', 'dom/EventListener.idl', 'dom/EventTarget.idl', - 'dom/HTMLAllCollection.idl', 'dom/KeyboardEvent.idl', 'dom/MessageChannel.idl', 'dom/MessageEvent.idl', @@ -103,6 +102,7 @@ 'html/DataGridColumnList.idl', 'html/File.idl', 'html/FileList.idl', + 'html/HTMLAllCollection.idl', 'html/HTMLAnchorElement.idl', 'html/HTMLAppletElement.idl', 'html/HTMLAreaElement.idl', @@ -374,6 +374,8 @@ 'xml/XPathNSResolver.idl', 'xml/XPathResult.idl', 'xml/XSLTProcessor.idl', + ], + 'webcore_files': [ # Source/Header Files 'accessibility/AXObjectCache.cpp', @@ -491,8 +493,7 @@ 'bindings/js/JSGeolocationCustom.cpp', 'bindings/js/JSHistoryCustom.cpp', 'bindings/js/JSHistoryCustom.h', - 'bindings/js/JSHTMLAllCollection.cpp', - 'bindings/js/JSHTMLAllCollection.h', + 'bindings/js/JSHTMLAllCollectionCustom.cpp', 'bindings/js/JSHTMLAppletElementCustom.cpp', 'bindings/js/JSHTMLAppletElementCustom.h', 'bindings/js/JSHTMLCanvasElementCustom.cpp', @@ -677,6 +678,7 @@ 'bindings/v8/custom/V8FileListCustom.cpp', 'bindings/v8/custom/V8HTMLAudioElementConstructor.cpp', 'bindings/v8/custom/V8HTMLAudioElementConstructor.h', + 'bindings/v8/custom/V8HTMLAllCollectionCustom.cpp', 'bindings/v8/custom/V8HTMLCanvasElementCustom.cpp', 'bindings/v8/custom/V8HTMLCollectionCustom.cpp', 'bindings/v8/custom/V8HTMLDataGridElementCustom.cpp', @@ -742,6 +744,8 @@ 'bindings/v8/NPV8Object.cpp', 'bindings/v8/NPV8Object.h', 'bindings/v8/OwnHandle.h', + 'bindings/v8/RuntimeEnabledFeatures.cpp', + 'bindings/v8/RuntimeEnabledFeatures.h', 'bindings/v8/ScheduledAction.cpp', 'bindings/v8/ScheduledAction.h', 'bindings/v8/ScopedDOMDataStore.cpp', @@ -1325,6 +1329,8 @@ 'html/FileList.h', 'html/FormDataList.cpp', 'html/FormDataList.h', + 'html/HTMLAllCollection.cpp', + 'html/HTMLAllCollection.h', 'html/HTMLAnchorElement.cpp', 'html/HTMLAnchorElement.h', 'html/HTMLAppletElement.cpp', @@ -1507,8 +1513,6 @@ 'inspector/InspectorClient.h', 'inspector/ConsoleMessage.cpp', 'inspector/ConsoleMessage.h', - 'inspector/DOMDispatchTimelineItem.cpp', - 'inspector/DOMDispatchTimelineItem.h', 'inspector/InspectorBackend.cpp', 'inspector/InspectorBackend.h', 'inspector/InspectorController.cpp', @@ -1534,8 +1538,8 @@ 'inspector/JavaScriptProfile.h', 'inspector/JavaScriptProfileNode.cpp', 'inspector/JavaScriptProfileNode.h', - 'inspector/TimelineItem.cpp', - 'inspector/TimelineItem.h', + 'inspector/TimelineRecordFactory.cpp', + 'inspector/TimelineRecordFactory.h', 'loader/appcache/ApplicationCache.cpp', 'loader/appcache/ApplicationCache.h', 'loader/appcache/ApplicationCacheGroup.cpp', @@ -2376,6 +2380,7 @@ 'platform/network/chromium/NetworkStateNotifierChromium.cpp', 'platform/network/chromium/NetworkStateNotifierPrivate.h', 'platform/network/chromium/ResourceError.h', + 'platform/network/chromium/ResourceRequest.cpp', 'platform/network/chromium/ResourceRequest.h', 'platform/network/chromium/ResourceResponse.h', 'platform/network/chromium/SocketStreamError.h', @@ -3582,6 +3587,7 @@ 'webinspector_files': [ 'inspector/front-end/inspector.html', + 'inspector/front-end/AbstractTimelinePanel.js', 'inspector/front-end/BottomUpProfileDataGridTree.js', 'inspector/front-end/Breakpoint.js', 'inspector/front-end/BreakpointsSidebarPane.js', @@ -3605,6 +3611,7 @@ 'inspector/front-end/EventListenersSidebarPane.js', 'inspector/front-end/FontView.js', 'inspector/front-end/ImageView.js', + 'inspector/front-end/InspectorControllerStub.js', 'inspector/front-end/InjectedScript.js', 'inspector/front-end/InjectedScriptAccess.js', 'inspector/front-end/inspector.js', @@ -3641,6 +3648,7 @@ 'inspector/front-end/TestController.js', 'inspector/front-end/TextPrompt.js', 'inspector/front-end/TimelineAgent.js', + 'inspector/front-end/TimelinePanel.js', 'inspector/front-end/TopDownProfileDataGridTree.js', 'inspector/front-end/treeoutline.js', 'inspector/front-end/utilities.js', @@ -3696,6 +3704,7 @@ 'inspector/front-end/Images/paneBottomGrow.png', 'inspector/front-end/Images/paneBottomGrowActive.png', 'inspector/front-end/Images/paneGrowHandleLine.png', + 'inspector/front-end/Images/paneSettingsButtons.png', 'inspector/front-end/Images/pauseOnExceptionButtonGlyph.png', 'inspector/front-end/Images/percentButtonGlyph.png', 'inspector/front-end/Images/profileGroupIcon.png', @@ -3747,6 +3756,16 @@ 'inspector/front-end/Images/timelineHollowPillPurple.png', 'inspector/front-end/Images/timelineHollowPillRed.png', 'inspector/front-end/Images/timelineHollowPillYellow.png', + 'inspector/front-end/Images/timelineIcon.png', + 'inspector/front-end/Images/timelineBarBlue.png', + 'inspector/front-end/Images/timelineBarGray.png', + 'inspector/front-end/Images/timelineBarGreen.png', + 'inspector/front-end/Images/timelineBarOrange.png', + 'inspector/front-end/Images/timelineBarPurple.png', + 'inspector/front-end/Images/timelineBarRed.png', + 'inspector/front-end/Images/timelineBarYellow.png', + 'inspector/front-end/Images/timelineCheckmarks.png', + 'inspector/front-end/Images/timelineDots.png', 'inspector/front-end/Images/timelinePillBlue.png', 'inspector/front-end/Images/timelinePillGray.png', 'inspector/front-end/Images/timelinePillGreen.png', diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index d633a7a..1379fdd 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -394,6 +394,7 @@ IDL_BINDINGS += \ html/DataGridColumnList.idl \ html/File.idl \ html/FileList.idl \ + html/HTMLAllCollection.idl \ html/HTMLAudioElement.idl \ html/HTMLAnchorElement.idl \ html/HTMLAppletElement.idl \ @@ -703,10 +704,10 @@ SOURCES += \ bindings/js/JSEventTarget.cpp \ bindings/js/JSExceptionBase.cpp \ bindings/js/JSGeolocationCustom.cpp \ - bindings/js/JSHTMLAllCollection.cpp \ bindings/js/JSHistoryCustom.cpp \ bindings/js/JSHTMLAppletElementCustom.cpp \ bindings/js/JSHTMLCanvasElementCustom.cpp \ + bindings/js/JSHTMLAllCollectionCustom.cpp \ bindings/js/JSHTMLCollectionCustom.cpp \ bindings/js/JSHTMLDataGridElementCustom.cpp \ bindings/js/JSHTMLDocumentCustom.cpp \ @@ -990,6 +991,7 @@ SOURCES += \ html/File.cpp \ html/FileList.cpp \ html/FormDataList.cpp \ + html/HTMLAllCollection.cpp \ html/HTMLAnchorElement.cpp \ html/HTMLAppletElement.cpp \ html/HTMLAreaElement.cpp \ @@ -1075,7 +1077,6 @@ SOURCES += \ html/PreloadScanner.cpp \ html/ValidityState.cpp \ inspector/ConsoleMessage.cpp \ - inspector/DOMDispatchTimelineItem.cpp \ inspector/InspectorBackend.cpp \ inspector/InspectorController.cpp \ inspector/InspectorDatabaseResource.cpp \ @@ -1084,7 +1085,7 @@ SOURCES += \ inspector/InspectorFrontend.cpp \ inspector/InspectorResource.cpp \ inspector/InspectorTimelineAgent.cpp \ - inspector/TimelineItem.cpp \ + inspector/TimelineRecordFactory.cpp \ loader/archive/ArchiveFactory.cpp \ loader/archive/ArchiveResource.cpp \ loader/archive/ArchiveResourceCollection.cpp \ @@ -1187,6 +1188,7 @@ SOURCES += \ platform/FileChooser.cpp \ platform/GeolocationService.cpp \ platform/image-decoders/qt/RGBA32BufferQt.cpp \ + platform/graphics/filters/FEGaussianBlur.cpp \ platform/graphics/FontDescription.cpp \ platform/graphics/FontFamily.cpp \ platform/graphics/BitmapImage.cpp \ @@ -1402,7 +1404,6 @@ HEADERS += \ bindings/js/JSEventSourceConstructor.h \ bindings/js/JSEventTarget.h \ bindings/js/JSHistoryCustom.h \ - bindings/js/JSHTMLAllCollection.h \ bindings/js/JSHTMLAppletElementCustom.h \ bindings/js/JSHTMLEmbedElementCustom.h \ bindings/js/JSHTMLInputElementCustom.h \ @@ -1663,6 +1664,7 @@ HEADERS += \ html/File.h \ html/FileList.h \ html/FormDataList.h \ + html/HTMLAllCollection.h \ html/HTMLAnchorElement.h \ html/HTMLAppletElement.h \ html/HTMLAreaElement.h \ @@ -1752,7 +1754,6 @@ HEADERS += \ html/TimeRanges.h \ html/ValidityState.h \ inspector/ConsoleMessage.h \ - inspector/DOMDispatchTimelineItem.h \ inspector/InspectorBackend.h \ inspector/InspectorController.h \ inspector/InspectorDatabaseResource.h \ @@ -1764,7 +1765,7 @@ HEADERS += \ inspector/JavaScriptDebugServer.h \ inspector/JavaScriptProfile.h \ inspector/JavaScriptProfileNode.h \ - inspector/TimelineItem.h \ + inspector/TimelineRecordFactory.h \ loader/appcache/ApplicationCacheGroup.h \ loader/appcache/ApplicationCacheHost.h \ loader/appcache/ApplicationCache.h \ @@ -1873,6 +1874,7 @@ HEADERS += \ platform/graphics/filters/FEColorMatrix.h \ platform/graphics/filters/FEComponentTransfer.h \ platform/graphics/filters/FEComposite.h \ + platform/graphics/filters/FEGaussianBlur.h \ platform/graphics/filters/FilterEffect.h \ platform/graphics/filters/SourceAlpha.h \ platform/graphics/filters/SourceGraphic.h \ @@ -2498,13 +2500,15 @@ contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) { } win32-* { - INCLUDEPATH += $$PWD/plugins/win + INCLUDEPATH += $$PWD/plugins/win \ + $$PWD/platform/win SOURCES += page/win/PageWin.cpp \ plugins/win/PluginDatabaseWin.cpp \ plugins/win/PluginPackageWin.cpp \ plugins/win/PluginMessageThrottlerWin.cpp \ - plugins/win/PluginViewWin.cpp + plugins/win/PluginViewWin.cpp \ + platform/win/BitmapInfo.cpp LIBS += \ -ladvapi32 \ diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp new file mode 100755 index 0000000..04124bd --- /dev/null +++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp @@ -0,0 +1,44 @@ +/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build.
+
+#include <AccessibilityARIAGrid.cpp>
+#include <AccessibilityARIAGridCell.cpp>
+#include <AccessibilityARIAGridRow.cpp>
+#include <AccessibilityImageMapLink.cpp>
+#include <AccessibilityList.cpp>
+#include <AccessibilityListBox.cpp>
+#include <AccessibilityListBoxOption.cpp>
+#include <AccessibilityMediaControls.cpp>
+#include <AccessibilityObject.cpp>
+#include <AccessibilityRenderObject.cpp>
+#include <AccessibilitySlider.cpp>
+#include <AccessibilityTable.cpp>
+#include <AccessibilityTableCell.cpp>
+#include <AccessibilityTableColumn.cpp>
+#include <AccessibilityTableHeaderContainer.cpp>
+#include <AccessibilityTableRow.cpp>
+#include <AXObjectCache.cpp>
diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityListBoxOption.h b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityListBoxOption.h index 1b588cd..933cdeb 100644 --- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityListBoxOption.h +++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityListBoxOption.h @@ -68,6 +68,7 @@ public: private: HTMLElement* m_optionElement; + virtual bool canHaveChildren() const { return false; } HTMLSelectElement* listBoxOptionParentNode() const; int listBoxOptionIndex() const; IntRect listBoxOptionRect() const; diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h index c5ba1ed..8fc40e8 100644 --- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h +++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityObject.h @@ -160,6 +160,7 @@ enum AccessibilityRole { DefinitionListDefinitionRole, AnnotationRole, SliderThumbRole, + IgnoredRole, // ARIA Grouping roles LandmarkApplicationRole, @@ -188,6 +189,12 @@ enum AccessibilityOrientation { AccessibilityOrientationHorizontal, }; +enum AccessibilityObjectPlatformInclusion { + IncludeObject, + IgnoreObject, + DefaultBehavior, +}; + struct VisiblePositionRange { VisiblePosition start; @@ -459,6 +466,13 @@ public: bool accessibilityIgnoreAttachment() const { return true; } #endif + // gives platforms the opportunity to indicate if and how an object should be included +#if HAVE(ACCESSIBILITY) + AccessibilityObjectPlatformInclusion accessibilityPlatformIncludesObject() const; +#else + AccessibilityObjectPlatformInclusion accessibilityPlatformIncludesObject() const { return DefaultBehavior; } +#endif + // allows for an AccessibilityObject to update its render tree or perform // other operations update type operations virtual void updateBackingStore() { } diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp index 834e931..4c50b9a 100644 --- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -1258,6 +1258,14 @@ bool AccessibilityRenderObject::ariaIsHidden() const bool AccessibilityRenderObject::accessibilityIsIgnored() const { + // is the platform is interested in this object? + AccessibilityObjectPlatformInclusion decision = accessibilityPlatformIncludesObject(); + if (decision == IncludeObject) + return false; + if (decision == IgnoreObject) + return true; + // the decision must, therefore, be DefaultBehavior. + // ignore invisible element if (!m_renderer || m_renderer->style()->visibility() != VISIBLE) return true; @@ -1268,6 +1276,9 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const if (isPresentationalChildOfAriaRole()) return true; + if (roleValue() == IgnoredRole) + return true; + // ignore popup menu items because AppKit does for (RenderObject* parent = m_renderer->parent(); parent; parent = parent->parent()) { if (parent->isMenuList()) @@ -2212,6 +2223,21 @@ AccessibilityObject* AccessibilityRenderObject::correspondingControlForLabelElem return axObjectCache()->getOrCreate(correspondingControl->renderer()); } +AccessibilityObject* AccessibilityRenderObject::correspondingLabelForControlElement() const +{ + if (!m_renderer) + return 0; + + Node* node = m_renderer->node(); + if (node && node->isHTMLElement()) { + HTMLLabelElement* label = labelForElement(static_cast<Element*>(node)); + if (label) + return axObjectCache()->getOrCreate(label->renderer()); + } + + return 0; +} + AccessibilityObject* AccessibilityRenderObject::observableObject() const { for (RenderObject* renderer = m_renderer; renderer && renderer->node(); renderer = renderer->parent()) { @@ -2224,13 +2250,13 @@ AccessibilityObject* AccessibilityRenderObject::observableObject() const typedef HashMap<String, AccessibilityRole, CaseFoldingHash> ARIARoleMap; +struct RoleEntry { + String ariaRole; + AccessibilityRole webcoreRole; +}; + static const ARIARoleMap& createARIARoleMap() { - struct RoleEntry { - String ariaRole; - AccessibilityRole webcoreRole; - }; - const RoleEntry roles[] = { { "application", LandmarkApplicationRole }, { "article", DocumentArticleRole }, @@ -2263,6 +2289,8 @@ static const ARIARoleMap& createARIARoleMap() { "menuitemradio", MenuItemRole }, { "note", DocumentNoteRole }, { "navigation", LandmarkNavigationRole }, + { "option", ListBoxOptionRole }, + { "presentation", IgnoredRole }, { "progressbar", ProgressIndicatorRole }, { "radio", RadioButtonRole }, { "radiogroup", RadioGroupRole }, @@ -2508,6 +2536,8 @@ bool AccessibilityRenderObject::canHaveChildren() const case PopUpButtonRole: case CheckBoxRole: case RadioButtonRole: + case StaticTextRole: + case ListBoxOptionRole: return false; default: return true; @@ -2561,7 +2591,7 @@ void AccessibilityRenderObject::addChildren() for (Node* current = map->firstChild(); current; current = current->traverseNextNode(map)) { // add an <area> element for this child if it has a link - if (current->isLink()) { + if (current->hasTagName(areaTag) && current->isLink()) { AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(m_renderer->document()->axObjectCache()->getOrCreate(ImageMapLinkRole)); areaObject->setHTMLAreaElement(static_cast<HTMLAreaElement*>(current)); areaObject->setHTMLMapElement(map); diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h index d82ca71..c6fd748 100644 --- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h +++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityRenderObject.h @@ -134,6 +134,7 @@ public: virtual bool exposesTitleUIElement() const; virtual AccessibilityObject* titleUIElement() const; virtual AccessibilityObject* correspondingControlForLabelElement() const; + virtual AccessibilityObject* correspondingLabelForControlElement() const; virtual AccessibilityRole ariaRoleAttribute() const; virtual bool isPresentationalChildOfAriaRole() const; diff --git a/src/3rdparty/webkit/WebCore/accessibility/qt/AccessibilityObjectQt.cpp b/src/3rdparty/webkit/WebCore/accessibility/qt/AccessibilityObjectQt.cpp index 1710027..07f13d4 100644 --- a/src/3rdparty/webkit/WebCore/accessibility/qt/AccessibilityObjectQt.cpp +++ b/src/3rdparty/webkit/WebCore/accessibility/qt/AccessibilityObjectQt.cpp @@ -29,6 +29,11 @@ bool AccessibilityObject::accessibilityIgnoreAttachment() const return false; } +AccessibilityObjectPlatformInclusion AccessibilityObject::accessibilityPlatformIncludesObject() const +{ + return DefaultBehavior; +} + } // namespace WebCore #endif // HAVE(ACCESSIBILITY) diff --git a/src/3rdparty/webkit/WebCore/bindings/ScriptControllerBase.cpp b/src/3rdparty/webkit/WebCore/bindings/ScriptControllerBase.cpp index 4d73d83..7dc68ef 100644 --- a/src/3rdparty/webkit/WebCore/bindings/ScriptControllerBase.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/ScriptControllerBase.cpp @@ -53,6 +53,7 @@ ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode) return result; } + bool ScriptController::executeIfJavaScriptURL(const KURL& url, bool userGesture, bool replaceDocument) { if (!protocolIsJavaScript(url)) @@ -61,6 +62,9 @@ bool ScriptController::executeIfJavaScriptURL(const KURL& url, bool userGesture, if (m_frame->page() && !m_frame->page()->javaScriptURLsAreAllowed()) return true; + if (m_frame->inViewSourceMode()) + return true; + const int javascriptSchemeLength = sizeof("javascript:") - 1; String script = decodeURLEscapeSequences(url.string().substring(javascriptSchemeLength)); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp index a6cbd91..6eca7bd 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp @@ -50,7 +50,7 @@ JSValue JSAbstractWorker::addEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec)); + impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -60,7 +60,7 @@ JSValue JSAbstractWorker::removeEventListener(ExecState* exec, const ArgList& ar if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSBindingsAllInOne.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSBindingsAllInOne.cpp new file mode 100644 index 0000000..f08303a --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSBindingsAllInOne.cpp @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build. + +#include "GCController.cpp" +#include "JSAbstractWorkerCustom.cpp" +#include "JSAttrCustom.cpp" +#include "JSAudioConstructor.cpp" +#include "JSCDATASectionCustom.cpp" +#include "JSCSSRuleCustom.cpp" +#include "JSCSSRuleListCustom.cpp" +#include "JSCSSStyleDeclarationCustom.cpp" +#include "JSCSSValueCustom.cpp" +#include "JSCallbackData.cpp" +#include "JSCanvasRenderingContext2DCustom.cpp" +#include "JSCanvasRenderingContextCustom.cpp" +#include "JSClipboardCustom.cpp" +#include "JSConsoleCustom.cpp" +#include "JSCoordinatesCustom.cpp" +#include "JSCustomSQLStatementCallback.cpp" +#include "JSCustomSQLStatementErrorCallback.cpp" +#include "JSCustomSQLTransactionCallback.cpp" +#include "JSCustomSQLTransactionErrorCallback.cpp" +#include "JSCustomVoidCallback.cpp" +#include "JSCustomXPathNSResolver.cpp" +#include "JSDOMApplicationCacheCustom.cpp" +#include "JSDOMBinding.cpp" +#include "JSDOMGlobalObject.cpp" +#include "JSDOMWindowBase.cpp" +#include "JSDOMWindowCustom.cpp" +#include "JSDOMWindowShell.cpp" +#include "JSDataGridColumnListCustom.cpp" +#include "JSDataGridDataSource.cpp" +#include "JSDatabaseCustom.cpp" +#include "JSDedicatedWorkerContextCustom.cpp" +#include "JSDesktopNotificationsCustom.cpp" +#include "JSDocumentCustom.cpp" +#include "JSDocumentFragmentCustom.cpp" +#include "JSElementCustom.cpp" +#include "JSEventCustom.cpp" +#include "JSEventListener.cpp" +#include "JSEventSourceConstructor.cpp" +#include "JSEventSourceCustom.cpp" +#include "JSEventTarget.cpp" +#include "JSExceptionBase.cpp" +#include "JSHTMLAllCollectionCustom.cpp" +#include "JSHTMLAppletElementCustom.cpp" +#include "JSHTMLCanvasElementCustom.cpp" +#include "JSHTMLCollectionCustom.cpp" +#include "JSHTMLDataGridElementCustom.cpp" +#include "JSHTMLDocumentCustom.cpp" +#include "JSHTMLElementCustom.cpp" +#include "JSHTMLEmbedElementCustom.cpp" +#include "JSHTMLFormElementCustom.cpp" +#include "JSHTMLFrameElementCustom.cpp" +#include "JSHTMLFrameSetElementCustom.cpp" +#include "JSHTMLIFrameElementCustom.cpp" +#include "JSHTMLInputElementCustom.cpp" +#include "JSHTMLObjectElementCustom.cpp" +#include "JSHTMLOptionsCollectionCustom.cpp" +#include "JSHTMLSelectElementCustom.cpp" +#include "JSHistoryCustom.cpp" +#include "JSImageConstructor.cpp" +#include "JSImageDataCustom.cpp" +#include "JSInspectedObjectWrapper.cpp" +#include "JSInspectorBackendCustom.cpp" +#include "JSJavaScriptCallFrameCustom.cpp" +#include "JSLazyEventListener.cpp" +#include "JSLocationCustom.cpp" +#include "JSMessageChannelConstructor.cpp" +#include "JSMessageChannelCustom.cpp" +#include "JSMessageEventCustom.cpp" +#include "JSMessagePortCustom.cpp" +#include "JSMimeTypeArrayCustom.cpp" +#include "JSNamedNodeMapCustom.cpp" +#include "JSNavigatorCustom.cpp" +#include "JSNodeCustom.cpp" +#include "JSNodeFilterCondition.cpp" +#include "JSNodeFilterCustom.cpp" +#include "JSNodeIteratorCustom.cpp" +#include "JSNodeListCustom.cpp" +#include "JSOptionConstructor.cpp" +#include "JSPluginArrayCustom.cpp" +#include "JSPluginCustom.cpp" +#include "JSPluginElementFunctions.cpp" +#include "JSQuarantinedObjectWrapper.cpp" +#include "JSSQLResultSetRowListCustom.cpp" +#include "JSSQLTransactionCustom.cpp" +#include "JSSVGElementInstanceCustom.cpp" +#include "JSSVGLengthCustom.cpp" +#include "JSSVGMatrixCustom.cpp" +#include "JSSVGPathSegCustom.cpp" +#include "JSSVGPathSegListCustom.cpp" +#include "JSSVGPointListCustom.cpp" +#include "JSSharedWorkerConstructor.cpp" +#include "JSSharedWorkerCustom.cpp" +#include "JSStorageCustom.cpp" +#include "JSStyleSheetCustom.cpp" +#include "JSStyleSheetListCustom.cpp" +#include "JSTextCustom.cpp" +#include "JSTreeWalkerCustom.cpp" +#include "JSWebKitCSSMatrixConstructor.cpp" +#include "JSWebKitPointConstructor.cpp" +#include "JSWebSocketConstructor.cpp" +#include "JSWebSocketCustom.cpp" +#include "JSWorkerConstructor.cpp" +#include "JSWorkerContextBase.cpp" +#include "JSWorkerContextCustom.cpp" +#include "JSWorkerCustom.cpp" +#include "JSXMLHttpRequestConstructor.cpp" +#include "JSXMLHttpRequestCustom.cpp" +#include "JSXMLHttpRequestUploadCustom.cpp" +#include "JSXSLTProcessorConstructor.cpp" +#include "JSXSLTProcessorCustom.cpp" +#include "ScheduledAction.cpp" +#include "ScriptArray.cpp" +#include "ScriptCachedFrameData.cpp" +#include "ScriptCallFrame.cpp" +#include "ScriptCallStack.cpp" +#include "ScriptController.cpp" +#include "ScriptControllerWin.cpp" +#include "ScriptEventListener.cpp" +#include "ScriptFunctionCall.cpp" +#include "ScriptObjectQuarantine.cpp" +#include "ScriptState.cpp" +#include "SerializedScriptValue.cpp" +#include "WorkerScriptController.cpp" diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSCallbackData.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSCallbackData.cpp index d08f760..38292c7 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSCallbackData.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSCallbackData.cpp @@ -48,7 +48,12 @@ JSValue JSCallbackData::invokeCallback(MarkedArgumentBuffer& args, bool* raisedE ExecState* exec = globalObject()->globalExec(); - JSValue function = callback()->get(exec, Identifier(exec, "handleEvent")); + JSValue function; + { + // Switch worlds, just in case handleEvent is a getter and causes JS execution! + EnterDOMWrapperWorld worldEntry(exec, m_isolatedWorld.get()); + function = callback()->get(exec, Identifier(exec, "handleEvent")); + } CallData callData; CallType callType = function.getCallData(callData); if (callType == CallTypeNone) { @@ -59,7 +64,7 @@ JSValue JSCallbackData::invokeCallback(MarkedArgumentBuffer& args, bool* raisedE } globalObject()->globalData()->timeoutChecker.start(); - JSValue result = call(exec, function, callType, callData, callback(), args); + JSValue result = callInWorld(exec, function, callType, callData, callback(), args, m_isolatedWorld.get()); globalObject()->globalData()->timeoutChecker.stop(); Document::updateStyleForAllDocuments(); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSCallbackData.h b/src/3rdparty/webkit/WebCore/bindings/js/JSCallbackData.h index 4fc9f84..5c86701 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSCallbackData.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSCallbackData.h @@ -29,6 +29,7 @@ #ifndef JSCallbackData_h #define JSCallbackData_h +#include "JSDOMBinding.h" #include "JSDOMGlobalObject.h" #include <runtime/JSObject.h> #include <runtime/Protect.h> @@ -47,6 +48,7 @@ public: JSCallbackData(JSC::JSObject* callback, JSDOMGlobalObject* globalObject) : m_callback(callback) , m_globalObject(globalObject) + , m_isolatedWorld(currentWorld(globalObject->globalExec())) { } @@ -63,6 +65,7 @@ public: private: JSC::ProtectedPtr<JSC::JSObject> m_callback; JSC::ProtectedPtr<JSDOMGlobalObject> m_globalObject; + RefPtr<DOMWrapperWorld> m_isolatedWorld; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp index da4a53a..c2884d7 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSCustomXPathNSResolver.cpp @@ -90,7 +90,7 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix) args.append(jsString(exec, prefix)); m_globalObject->globalData()->timeoutChecker.start(); - JSValue retval = call(exec, function, callType, callData, m_customResolver, args); + JSValue retval = callInWorld(exec, function, callType, callData, m_customResolver, args, currentWorld(m_globalObject->globalExec())); m_globalObject->globalData()->timeoutChecker.stop(); String result; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp index 8634589..91ee51a 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp @@ -91,7 +91,7 @@ JSValue JSDOMApplicationCache::addEventListener(ExecState* exec, const ArgList& if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec)); + impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -101,7 +101,7 @@ JSValue JSDOMApplicationCache::removeEventListener(ExecState* exec, const ArgLis if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp index 8168323..ef69c7b 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp @@ -21,6 +21,8 @@ #include "config.h" #include "JSDOMBinding.h" +#include "debugger/DebuggerCallFrame.h" + #include "ActiveDOMObject.h" #include "DOMCoreException.h" #include "Document.h" @@ -44,6 +46,7 @@ #include "MessagePort.h" #include "RangeException.h" #include "ScriptController.h" +#include "Settings.h" #include "XMLHttpRequestException.h" #include <runtime/Error.h> #include <runtime/JSFunction.h> @@ -72,6 +75,7 @@ namespace WebCore { using namespace HTMLNames; typedef Document::JSWrapperCache JSWrapperCache; +typedef Document::JSWrapperCacheMap JSWrapperCacheMap; // For debugging, keep a set of wrappers currently registered, and check that // all are unregistered before they are destroyed. This has helped us fix at @@ -80,6 +84,7 @@ typedef Document::JSWrapperCache JSWrapperCache; static void addWrapper(DOMObject* wrapper); static void removeWrapper(DOMObject* wrapper); static void removeWrappers(const JSWrapperCache& wrappers); +static void removeWrappers(const DOMObjectWrapperMap& wrappers); #ifdef NDEBUG @@ -95,6 +100,10 @@ static inline void removeWrappers(const JSWrapperCache&) { } +static inline void removeWrappers(const DOMObjectWrapperMap&) +{ +} + #else static HashSet<DOMObject*>& wrapperSet() @@ -124,7 +133,15 @@ static void removeWrapper(DOMObject* wrapper) static void removeWrappers(const JSWrapperCache& wrappers) { - for (JSWrapperCache::const_iterator it = wrappers.begin(); it != wrappers.end(); ++it) + JSWrapperCache::const_iterator wrappersEnd = wrappers.end(); + for (JSWrapperCache::const_iterator it = wrappers.begin(); it != wrappersEnd; ++it) + removeWrapper(it->second); +} + +static inline void removeWrappers(const DOMObjectWrapperMap& wrappers) +{ + DOMObjectWrapperMap::const_iterator wrappersEnd = wrappers.end(); + for (DOMObjectWrapperMap::const_iterator it = wrappers.begin(); it != wrappersEnd; ++it) removeWrapper(it->second); } @@ -135,67 +152,120 @@ DOMObject::~DOMObject() #endif -class DOMObjectWrapperMap { -public: - static DOMObjectWrapperMap& mapFor(JSGlobalData&); +DOMWrapperWorld::DOMWrapperWorld(JSC::JSGlobalData* globalData) + : m_globalData(globalData) +{ +} + +DOMWrapperWorld::~DOMWrapperWorld() +{ + JSGlobalData::ClientData* clientData = m_globalData->clientData; + ASSERT(clientData); + static_cast<WebCoreJSClientData*>(clientData)->forgetWorld(this); + + removeWrappers(m_wrappers); - DOMObject* get(void* objectHandle) + for (HashSet<Document*>::iterator iter = documentsWithWrappers.begin(); iter != documentsWithWrappers.end(); ++iter) + forgetWorldOfDOMNodesForDocument(*iter, this); + for (HashSet<ScriptController*>::iterator iter = scriptControllersWithShells.begin(); iter != scriptControllersWithShells.end(); ++iter) + (*iter)->forgetWorld(this); +} + +EnterDOMWrapperWorld::EnterDOMWrapperWorld(JSC::JSGlobalData& globalData, DOMWrapperWorld* isolatedWorld) +{ + JSGlobalData::ClientData* clientData = globalData.clientData; + ASSERT(clientData); + m_clientData = static_cast<WebCoreJSClientData*>(clientData); + m_clientData->m_worldStack.append(isolatedWorld); +} + +EnterDOMWrapperWorld::EnterDOMWrapperWorld(JSC::ExecState* exec, DOMWrapperWorld* isolatedWorld) +{ + JSGlobalData::ClientData* clientData = exec->globalData().clientData; + ASSERT(clientData); + m_clientData = static_cast<WebCoreJSClientData*>(clientData); + m_clientData->m_worldStack.append(isolatedWorld); +} + +EnterDOMWrapperWorld::~EnterDOMWrapperWorld() +{ + m_clientData->m_worldStack.removeLast(); +} + +class JSGlobalDataWorldIterator { +public: + JSGlobalDataWorldIterator(JSGlobalData* globalData) + : m_pos(static_cast<WebCoreJSClientData*>(globalData->clientData)->m_worldSet.begin()) + , m_end(static_cast<WebCoreJSClientData*>(globalData->clientData)->m_worldSet.end()) { - return m_map.get(objectHandle); } - void set(void* objectHandle, DOMObject* wrapper) + operator bool() { - addWrapper(wrapper); - m_map.set(objectHandle, wrapper); + return m_pos != m_end; } - void remove(void* objectHandle) + DOMWrapperWorld* operator*() { - removeWrapper(m_map.take(objectHandle)); + ASSERT(m_pos != m_end); + return *m_pos; } -private: - HashMap<void*, DOMObject*> m_map; -}; - -// Map from static HashTable instances to per-GlobalData ones. -class DOMObjectHashTableMap { -public: - static DOMObjectHashTableMap& mapFor(JSGlobalData&); - - ~DOMObjectHashTableMap() + DOMWrapperWorld* operator->() { - HashMap<const JSC::HashTable*, JSC::HashTable>::iterator mapEnd = m_map.end(); - for (HashMap<const JSC::HashTable*, JSC::HashTable>::iterator iter = m_map.begin(); iter != m_map.end(); ++iter) - iter->second.deleteTable(); + ASSERT(m_pos != m_end); + return *m_pos; } - const JSC::HashTable* get(const JSC::HashTable* staticTable) + JSGlobalDataWorldIterator& operator++() { - HashMap<const JSC::HashTable*, JSC::HashTable>::iterator iter = m_map.find(staticTable); - if (iter != m_map.end()) - return &iter->second; - return &m_map.set(staticTable, JSC::HashTable(*staticTable)).first->second; + ++m_pos; + return *this; } private: - HashMap<const JSC::HashTable*, JSC::HashTable> m_map; + HashSet<DOMWrapperWorld*>::iterator m_pos; + HashSet<DOMWrapperWorld*>::iterator m_end; }; -class WebCoreJSClientData : public JSGlobalData::ClientData { -public: - DOMObjectHashTableMap hashTableMap; - DOMObjectWrapperMap wrapperMap; -}; +static inline DOMWrapperWorld* currentWorld(JSC::JSGlobalData& globalData) +{ + JSGlobalData::ClientData* clientData = globalData.clientData; + ASSERT(clientData); + return static_cast<WebCoreJSClientData*>(clientData)->currentWorld(); +} + +DOMWrapperWorld* currentWorld(JSC::ExecState* exec) +{ + return currentWorld(exec->globalData()); +} + +DOMWrapperWorld* normalWorld(JSC::JSGlobalData& globalData) +{ + JSGlobalData::ClientData* clientData = globalData.clientData; + ASSERT(clientData); + return static_cast<WebCoreJSClientData*>(clientData)->normalWorld(); +} + +DOMWrapperWorld* mainThreadNormalWorld() +{ + ASSERT(isMainThread()); + return normalWorld(*JSDOMWindow::commonJSGlobalData()); +} + +DOMWrapperWorld* mainThreadCurrentWorld() +{ + ASSERT(isMainThread()); + + JSGlobalData::ClientData* clientData = JSDOMWindowBase::commonJSGlobalData()->clientData; + ASSERT(clientData); + return static_cast<WebCoreJSClientData*>(clientData)->currentWorld(); +} DOMObjectHashTableMap& DOMObjectHashTableMap::mapFor(JSGlobalData& globalData) { JSGlobalData::ClientData* clientData = globalData.clientData; - if (!clientData) { - clientData = new WebCoreJSClientData; - globalData.clientData = clientData; - } + ASSERT(clientData); return static_cast<WebCoreJSClientData*>(clientData)->hashTableMap; } @@ -204,64 +274,102 @@ const JSC::HashTable* getHashTableForGlobalData(JSGlobalData& globalData, const return DOMObjectHashTableMap::mapFor(globalData).get(staticTable); } -inline DOMObjectWrapperMap& DOMObjectWrapperMap::mapFor(JSGlobalData& globalData) +//inline DOMObjectWrapperMap& DOMObjectWrapperMap::mapFor(JSGlobalData& globalData) +inline DOMObjectWrapperMap& DOMObjectWrapperMapFor(JSGlobalData& globalData) { - JSGlobalData::ClientData* clientData = globalData.clientData; - if (!clientData) { - clientData = new WebCoreJSClientData; - globalData.clientData = clientData; - } - return static_cast<WebCoreJSClientData*>(clientData)->wrapperMap; + return currentWorld(globalData)->m_wrappers; } DOMObject* getCachedDOMObjectWrapper(JSGlobalData& globalData, void* objectHandle) { - return DOMObjectWrapperMap::mapFor(globalData).get(objectHandle); + return DOMObjectWrapperMapFor(globalData).get(objectHandle); } void cacheDOMObjectWrapper(JSGlobalData& globalData, void* objectHandle, DOMObject* wrapper) { - DOMObjectWrapperMap::mapFor(globalData).set(objectHandle, wrapper); + addWrapper(wrapper); + DOMObjectWrapperMapFor(globalData).set(objectHandle, wrapper); } -void forgetDOMObject(JSGlobalData& globalData, void* objectHandle) +JSNode* getCachedDOMNodeWrapper(Document* document, Node* node) { - DOMObjectWrapperMap::mapFor(globalData).remove(objectHandle); + if (document) + return document->getWrapperCache(mainThreadCurrentWorld())->get(node); + return static_cast<JSNode*>(DOMObjectWrapperMapFor(*JSDOMWindow::commonJSGlobalData()).get(node)); } -JSNode* getCachedDOMNodeWrapper(Document* document, Node* node) +void forgetDOMObject(DOMObject* wrapper, void* objectHandle) { - if (!document) - return static_cast<JSNode*>(DOMObjectWrapperMap::mapFor(*JSDOMWindow::commonJSGlobalData()).get(node)); - return document->wrapperCache().get(node); + JSC::JSGlobalData* globalData = Heap::heap(wrapper)->globalData(); + for (JSGlobalDataWorldIterator worldIter(globalData); worldIter; ++worldIter) { + DOMObjectWrapperMap& wrappers = worldIter->m_wrappers; + DOMObjectWrapperMap::iterator iter = wrappers.find(objectHandle); + if ((iter != wrappers.end()) && (iter->second == wrapper)) { + removeWrapper(wrapper); + wrappers.remove(iter); + return; + } + } + + // If the world went away, it should have removed this wrapper from the set. + ASSERT(!wrapperSet().contains(wrapper)); } -void forgetDOMNode(Document* document, Node* node) +void forgetDOMNode(DOMObject* wrapper, Node* node, Document* document) { if (!document) { - DOMObjectWrapperMap::mapFor(*JSDOMWindow::commonJSGlobalData()).remove(node); + forgetDOMObject(wrapper, node); return; } - removeWrapper(document->wrapperCache().take(node)); + + JSWrapperCacheMap& wrapperCacheMap = document->wrapperCacheMap(); + for (JSWrapperCacheMap::iterator wrappersIter = wrapperCacheMap.begin(); wrappersIter != wrapperCacheMap.end(); ++wrappersIter) { + JSWrapperCache* wrappers = wrappersIter->second; + JSWrapperCache::iterator iter = wrappers->find(node); + if ((iter != wrappers->end()) && (iter->second == wrapper)) { + wrappers->remove(iter); + removeWrapper(wrapper); + return; + } + } + + // If the world went away, it should have removed this wrapper from the set. + ASSERT(!wrapperSet().contains(wrapper)); } void cacheDOMNodeWrapper(Document* document, Node* node, JSNode* wrapper) { if (!document) { - DOMObjectWrapperMap::mapFor(*JSDOMWindow::commonJSGlobalData()).set(node, wrapper); + addWrapper(wrapper); + DOMObjectWrapperMapFor(*JSDOMWindow::commonJSGlobalData()).set(node, wrapper); return; } addWrapper(wrapper); - document->wrapperCache().set(node, wrapper); + document->getWrapperCache(mainThreadCurrentWorld())->set(node, wrapper); } void forgetAllDOMNodesForDocument(Document* document) { ASSERT(document); - removeWrappers(document->wrapperCache()); + JSWrapperCacheMap& wrapperCacheMap = document->wrapperCacheMap(); + JSWrapperCacheMap::const_iterator wrappersMapEnd = wrapperCacheMap.end(); + for (JSWrapperCacheMap::const_iterator wrappersMapIter = wrapperCacheMap.begin(); wrappersMapIter != wrappersMapEnd; ++wrappersMapIter) { + JSWrapperCache* wrappers = wrappersMapIter->second; + removeWrappers(*wrappers); + delete wrappers; + wrappersMapIter->first->forgetDocument(document); + } +} + +void forgetWorldOfDOMNodesForDocument(Document* document, DOMWrapperWorld* world) +{ + JSWrapperCache* wrappers = document->wrapperCacheMap().take(world); + ASSERT(wrappers); // 'world' should only know about 'document' if 'document' knows about 'world'! + removeWrappers(*wrappers); + delete wrappers; } -static inline bool isObservableThroughDOM(JSNode* jsNode) +static inline bool isObservableThroughDOM(JSNode* jsNode, DOMWrapperWorld* world) { // Certain conditions implicitly make a JS DOM node wrapper observable // through the DOM, even if no explicit reference to it remains. @@ -287,14 +395,14 @@ static inline bool isObservableThroughDOM(JSNode* jsNode) // the custom markChildren functions rather than here. if (node->isElementNode()) { if (NamedNodeMap* attributes = static_cast<Element*>(node)->attributeMap()) { - if (DOMObject* wrapper = getCachedDOMObjectWrapper(*jsNode->globalObject()->globalData(), attributes)) { + if (DOMObject* wrapper = world->m_wrappers.get(attributes)) { if (wrapper->hasCustomProperties()) return true; } } if (node->isStyledElement()) { if (CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(node)->inlineStyleDecl()) { - if (DOMObject* wrapper = getCachedDOMObjectWrapper(*jsNode->globalObject()->globalData(), style)) { + if (DOMObject* wrapper = world->m_wrappers.get(style)) { if (wrapper->hasCustomProperties()) return true; } @@ -302,7 +410,7 @@ static inline bool isObservableThroughDOM(JSNode* jsNode) } if (static_cast<Element*>(node)->hasTagName(canvasTag)) { if (CanvasRenderingContext* context = static_cast<HTMLCanvasElement*>(node)->renderingContext()) { - if (DOMObject* wrapper = getCachedDOMObjectWrapper(*jsNode->globalObject()->globalData(), context)) { + if (DOMObject* wrapper = world->m_wrappers.get(context)) { if (wrapper->hasCustomProperties()) return true; } @@ -333,14 +441,19 @@ static inline bool isObservableThroughDOM(JSNode* jsNode) return false; } -void markDOMNodesForDocument(MarkStack& markStack, Document* doc) +void markDOMNodesForDocument(MarkStack& markStack, Document* document) { - JSWrapperCache& nodeDict = doc->wrapperCache(); - JSWrapperCache::iterator nodeEnd = nodeDict.end(); - for (JSWrapperCache::iterator nodeIt = nodeDict.begin(); nodeIt != nodeEnd; ++nodeIt) { - JSNode* jsNode = nodeIt->second; - if (isObservableThroughDOM(jsNode)) - markStack.append(jsNode); + JSWrapperCacheMap& wrapperCacheMap = document->wrapperCacheMap(); + for (JSWrapperCacheMap::iterator wrappersIter = wrapperCacheMap.begin(); wrappersIter != wrapperCacheMap.end(); ++wrappersIter) { + DOMWrapperWorld* world = wrappersIter->first; + JSWrapperCache* nodeDict = wrappersIter->second; + + JSWrapperCache::iterator nodeEnd = nodeDict->end(); + for (JSWrapperCache::iterator nodeIt = nodeDict->begin(); nodeIt != nodeEnd; ++nodeIt) { + JSNode* jsNode = nodeIt->second; + if (isObservableThroughDOM(jsNode, world)) + markStack.append(jsNode); + } } } @@ -353,12 +466,10 @@ void markActiveObjectsForContext(MarkStack& markStack, JSGlobalData& globalData, HashMap<ActiveDOMObject*, void*>::const_iterator activeObjectsEnd = activeObjects.end(); for (HashMap<ActiveDOMObject*, void*>::const_iterator iter = activeObjects.begin(); iter != activeObjectsEnd; ++iter) { if (iter->first->hasPendingActivity()) { - DOMObject* wrapper = getCachedDOMObjectWrapper(globalData, iter->second); // Generally, an active object with pending activity must have a wrapper to mark its listeners. // However, some ActiveDOMObjects don't have JS wrappers (timers created by setTimeout is one example). // FIXME: perhaps need to make sure even timers have a markable 'wrapper'. - if (wrapper) - markStack.append(wrapper); + markDOMObjectWrapper(markStack, globalData, iter->second); } } @@ -366,10 +477,31 @@ void markActiveObjectsForContext(MarkStack& markStack, JSGlobalData& globalData, HashSet<MessagePort*>::const_iterator portsEnd = messagePorts.end(); for (HashSet<MessagePort*>::const_iterator iter = messagePorts.begin(); iter != portsEnd; ++iter) { // If the message port is remotely entangled, then always mark it as in-use because we can't determine reachability across threads. - if (!(*iter)->locallyEntangledPort() || (*iter)->hasPendingActivity()) { - DOMObject* wrapper = getCachedDOMObjectWrapper(globalData, *iter); - if (wrapper) - markStack.append(wrapper); + if (!(*iter)->locallyEntangledPort() || (*iter)->hasPendingActivity()) + markDOMObjectWrapper(markStack, globalData, *iter); + } +} + +typedef std::pair<JSNode*, DOMWrapperWorld*> WrapperAndWorld; +typedef WTF::Vector<WrapperAndWorld, 8> WrapperSet; + +static inline void takeWrappers(Node* node, Document* document, WrapperSet& wrapperSet) +{ + if (document) { + JSWrapperCacheMap& wrapperCacheMap = document->wrapperCacheMap(); + for (JSWrapperCacheMap::iterator iter = wrapperCacheMap.begin(); iter != wrapperCacheMap.end(); ++iter) { + if (JSNode* wrapper = iter->second->take(node)) { + removeWrapper(wrapper); + wrapperSet.append(WrapperAndWorld(wrapper, iter->first)); + } + } + } else { + for (JSGlobalDataWorldIterator worldIter(JSDOMWindow::commonJSGlobalData()); worldIter; ++worldIter) { + DOMWrapperWorld* world = *worldIter; + if (JSNode* wrapper = static_cast<JSNode*>(world->m_wrappers.take(node))) { + removeWrapper(wrapper); + wrapperSet.append(WrapperAndWorld(wrapper, world)); + } } } } @@ -377,13 +509,18 @@ void markActiveObjectsForContext(MarkStack& markStack, JSGlobalData& globalData, void updateDOMNodeDocument(Node* node, Document* oldDocument, Document* newDocument) { ASSERT(oldDocument != newDocument); - JSNode* wrapper = getCachedDOMNodeWrapper(oldDocument, node); - if (!wrapper) - return; - removeWrapper(wrapper); - cacheDOMNodeWrapper(newDocument, node, wrapper); - forgetDOMNode(oldDocument, node); - addWrapper(wrapper); + + WrapperSet wrapperSet; + takeWrappers(node, oldDocument, wrapperSet); + + for (unsigned i = 0; i < wrapperSet.size(); ++i) { + JSNode* wrapper = wrapperSet[i].first; + if (newDocument) + newDocument->getWrapperCache(wrapperSet[i].second)->set(node, wrapper); + else + wrapperSet[i].second->m_wrappers.set(node, wrapper); + addWrapper(wrapper); + } } void markDOMObjectWrapper(MarkStack& markStack, JSGlobalData& globalData, void* object) @@ -393,10 +530,11 @@ void markDOMObjectWrapper(MarkStack& markStack, JSGlobalData& globalData, void* // but doing this correctly would be challenging. if (!object) return; - DOMObject* wrapper = getCachedDOMObjectWrapper(globalData, object); - if (!wrapper) - return; - markStack.append(wrapper); + + for (JSGlobalDataWorldIterator worldIter(&globalData); worldIter; ++worldIter) { + if (DOMObject* wrapper = worldIter->m_wrappers.get(object)) + markStack.append(wrapper); + } } JSValue jsStringOrNull(ExecState* exec, const String& s) @@ -543,7 +681,7 @@ bool allowsAccessFromFrame(ExecState* exec, Frame* frame) { if (!frame) return false; - JSDOMWindow* window = toJSDOMWindow(frame); + JSDOMWindow* window = toJSDOMWindow(frame, currentWorld(exec)); return window && window->allowsAccessFrom(exec); } @@ -551,7 +689,7 @@ bool allowsAccessFromFrame(ExecState* exec, Frame* frame, String& message) { if (!frame) return false; - JSDOMWindow* window = toJSDOMWindow(frame); + JSDOMWindow* window = toJSDOMWindow(frame, currentWorld(exec)); return window && window->allowsAccessFrom(exec, message); } @@ -565,8 +703,16 @@ void printErrorMessageForFrame(Frame* frame, const String& message) { if (!frame) return; - if (JSDOMWindow* window = toJSDOMWindow(frame)) - window->printErrorMessage(message); + if (message.isEmpty()) + return; + + Settings* settings = frame->settings(); + if (!settings) + return; + if (settings->privateBrowsingEnabled()) + return; + + frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String()); // FIXME: provide a real line number and source URL. } Frame* toLexicalFrame(ExecState* exec) @@ -664,4 +810,28 @@ bool DOMObject::defineOwnProperty(ExecState* exec, const Identifier&, PropertyDe return false; } +JSValue DebuggerCallFrame_evaluateInWorld(const JSC::DebuggerCallFrame& debuggerCallFrame, const UString& script, JSValue& exception) +{ + EnterDOMWrapperWorld worldEntry(debuggerCallFrame.dynamicGlobalObject()->globalExec(), debuggerWorld()); + return debuggerCallFrame.evaluate(script, exception); +} + +JSValue callInWorld(ExecState* exec, JSValue function, CallType callType, const CallData& callData, JSValue thisValue, const ArgList& args, DOMWrapperWorld* isolatedWorld) +{ + EnterDOMWrapperWorld worldEntry(exec, isolatedWorld); + return JSC::call(exec, function, callType, callData, thisValue, args); +} + +JSObject* constructInWorld(ExecState* exec, JSValue object, ConstructType constructType, const ConstructData& constructData, const ArgList& args, DOMWrapperWorld* isolatedWorld) +{ + EnterDOMWrapperWorld worldEntry(exec, isolatedWorld); + return JSC::construct(exec, object, constructType, constructData, args); +} + +Completion evaluateInWorld(ExecState* exec, ScopeChain& scopeChain, const SourceCode& sourceCode, JSValue thisValue, DOMWrapperWorld* isolatedWorld) +{ + EnterDOMWrapperWorld worldEntry(exec, isolatedWorld); + return JSC::evaluate(exec, scopeChain, sourceCode, thisValue); +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h index 9af45d7..ba41d85 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h @@ -30,16 +30,18 @@ namespace JSC { class JSGlobalData; + class DebuggerCallFrame; } namespace WebCore { class Document; class Frame; + class JSNode; class KURL; class Node; class String; - class JSNode; + class ScriptController; typedef int ExceptionCode; @@ -136,14 +138,104 @@ namespace WebCore { } }; + typedef HashMap<void*, DOMObject*> DOMObjectWrapperMap; + + class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> { + public: + DOMWrapperWorld(JSC::JSGlobalData*); + ~DOMWrapperWorld(); + + void rememberDocument(Document* document) { documentsWithWrappers.add(document); } + void forgetDocument(Document* document) { documentsWithWrappers.remove(document); } + void rememberScriptController(ScriptController* scriptController) { scriptControllersWithShells.add(scriptController); } + void forgetScriptController(ScriptController* scriptController) { scriptControllersWithShells.remove(scriptController); } + + // FIXME: can we make this private? + DOMObjectWrapperMap m_wrappers; + + private: + JSC::JSGlobalData* m_globalData; + HashSet<Document*> documentsWithWrappers; + HashSet<ScriptController*> scriptControllersWithShells; + }; + + // Map from static HashTable instances to per-GlobalData ones. + class DOMObjectHashTableMap { + public: + static DOMObjectHashTableMap& mapFor(JSC::JSGlobalData&); + + ~DOMObjectHashTableMap() + { + HashMap<const JSC::HashTable*, JSC::HashTable>::iterator mapEnd = m_map.end(); + for (HashMap<const JSC::HashTable*, JSC::HashTable>::iterator iter = m_map.begin(); iter != m_map.end(); ++iter) + iter->second.deleteTable(); + } + + const JSC::HashTable* get(const JSC::HashTable* staticTable) + { + HashMap<const JSC::HashTable*, JSC::HashTable>::iterator iter = m_map.find(staticTable); + if (iter != m_map.end()) + return &iter->second; + return &m_map.set(staticTable, JSC::HashTable(*staticTable)).first->second; + } + + private: + HashMap<const JSC::HashTable*, JSC::HashTable> m_map; + }; + + class WebCoreJSClientData : public JSC::JSGlobalData::ClientData { + friend class EnterDOMWrapperWorld; + friend class JSGlobalDataWorldIterator; + + public: + WebCoreJSClientData(JSC::JSGlobalData* globalData) + : m_normalWorld(globalData) + { + m_worldStack.append(&m_normalWorld); + m_worldSet.add(&m_normalWorld); + } + // FIXME: add a destructor to assert m_worldSet only contains m_normalWorld? + + DOMWrapperWorld* currentWorld() { return m_worldStack.last(); } + DOMWrapperWorld* normalWorld() { return &m_normalWorld; } + + void rememberWorld(DOMWrapperWorld* world) + { + ASSERT(!m_worldSet.contains(world)); + m_worldSet.add(world); + } + void forgetWorld(DOMWrapperWorld* world) + { + ASSERT(m_worldSet.contains(world)); + m_worldSet.remove(world); + } + + DOMObjectHashTableMap hashTableMap; + private: + Vector<DOMWrapperWorld*> m_worldStack; + HashSet<DOMWrapperWorld*> m_worldSet; + DOMWrapperWorld m_normalWorld; + }; + + class EnterDOMWrapperWorld { + public: + EnterDOMWrapperWorld(JSC::JSGlobalData&, DOMWrapperWorld*); + EnterDOMWrapperWorld(JSC::ExecState*, DOMWrapperWorld*); + ~EnterDOMWrapperWorld(); + + private: + WebCoreJSClientData* m_clientData; + }; + DOMObject* getCachedDOMObjectWrapper(JSC::JSGlobalData&, void* objectHandle); void cacheDOMObjectWrapper(JSC::JSGlobalData&, void* objectHandle, DOMObject* wrapper); - void forgetDOMObject(JSC::JSGlobalData&, void* objectHandle); + void forgetDOMNode(DOMObject* wrapper, Node* node, Document* document); + void forgetDOMObject(DOMObject* wrapper, void* objectHandle); JSNode* getCachedDOMNodeWrapper(Document*, Node*); void cacheDOMNodeWrapper(Document*, Node*, JSNode* wrapper); - void forgetDOMNode(Document*, Node*); void forgetAllDOMNodesForDocument(Document*); + void forgetWorldOfDOMNodesForDocument(Document*, DOMWrapperWorld*); void updateDOMNodeDocument(Node*, Document* oldDocument, Document* newDocument); void markDOMNodesForDocument(JSC::MarkStack&, Document*); void markActiveObjectsForContext(JSC::MarkStack&, JSC::JSGlobalData&, ScriptExecutionContext*); @@ -154,6 +246,13 @@ namespace WebCore { JSC::Structure* getCachedDOMStructure(JSC::ExecState*, const JSC::ClassInfo*); JSC::Structure* cacheDOMStructure(JSC::ExecState*, NonNullPassRefPtr<JSC::Structure>, const JSC::ClassInfo*); + DOMWrapperWorld* currentWorld(JSC::ExecState*); + DOMWrapperWorld* normalWorld(JSC::JSGlobalData&); + DOMWrapperWorld* mainThreadCurrentWorld(); + DOMWrapperWorld* mainThreadNormalWorld(); + inline DOMWrapperWorld* debuggerWorld() { return mainThreadNormalWorld(); } + inline DOMWrapperWorld* pluginWorld() { return mainThreadNormalWorld(); } + JSC::JSObject* getCachedDOMConstructor(JSC::ExecState*, const JSC::ClassInfo*); void cacheDOMConstructor(JSC::ExecState*, const JSC::ClassInfo*, JSC::JSObject* constructor); @@ -305,6 +404,11 @@ namespace WebCore { bool processingUserGesture(JSC::ExecState*); KURL completeURL(JSC::ExecState*, const String& relativeURL); + JSC::JSValue DebuggerCallFrame_evaluateInWorld(const JSC::DebuggerCallFrame& debuggerCallFrame, const JSC::UString& script, JSC::JSValue& exception); + JSC::JSValue callInWorld(JSC::ExecState*, JSC::JSValue function, JSC::CallType, const JSC::CallData&, JSC::JSValue thisValue, const JSC::ArgList&, DOMWrapperWorld*); + JSC::JSObject* constructInWorld(JSC::ExecState* exec, JSC::JSValue object, JSC::ConstructType constructType, const JSC::ConstructData& constructData, const JSC::ArgList& args, DOMWrapperWorld*); + JSC::Completion evaluateInWorld(JSC::ExecState*, JSC::ScopeChain&, const JSC::SourceCode&, JSC::JSValue thisValue, DOMWrapperWorld*); + } // namespace WebCore #endif // JSDOMBinding_h diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.cpp index 53bb26b..011a4e4 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.cpp @@ -63,7 +63,7 @@ PassRefPtr<JSEventListener> JSDOMGlobalObject::createJSAttributeEventListener(JS if (!val.isObject()) return 0; - return JSEventListener::create(asObject(val), true).get(); + return JSEventListener::create(asObject(val), true, currentWorld(globalExec())).get(); } void JSDOMGlobalObject::setCurrentEvent(Event* evt) @@ -81,15 +81,34 @@ void JSDOMGlobalObject::destroyJSDOMGlobalObjectData(void* jsDOMGlobalObjectData delete static_cast<JSDOMGlobalObjectData*>(jsDOMGlobalObjectData); } -JSDOMGlobalObject* toJSDOMGlobalObject(Document* document) +JSDOMGlobalObject* toJSDOMGlobalObject(Document* document, JSC::ExecState* exec) { - return toJSDOMWindow(document->frame()); + return toJSDOMWindow(document->frame(), currentWorld(exec)); } -JSDOMGlobalObject* toJSDOMGlobalObject(ScriptExecutionContext* scriptExecutionContext) +JSDOMGlobalObject* toJSDOMGlobalObject(ScriptExecutionContext* scriptExecutionContext, JSC::ExecState* exec) { if (scriptExecutionContext->isDocument()) - return toJSDOMGlobalObject(static_cast<Document*>(scriptExecutionContext)); + return toJSDOMGlobalObject(static_cast<Document*>(scriptExecutionContext), exec); + +#if ENABLE(WORKERS) + if (scriptExecutionContext->isWorkerContext()) + return static_cast<WorkerContext*>(scriptExecutionContext)->script()->workerContextWrapper(); +#endif + + ASSERT_NOT_REACHED(); + return 0; +} + +JSDOMGlobalObject* toJSDOMGlobalObject(Document* document, DOMWrapperWorld* world) +{ + return toJSDOMWindow(document->frame(), world); +} + +JSDOMGlobalObject* toJSDOMGlobalObject(ScriptExecutionContext* scriptExecutionContext, DOMWrapperWorld* world) +{ + if (scriptExecutionContext->isDocument()) + return toJSDOMGlobalObject(static_cast<Document*>(scriptExecutionContext), world); #if ENABLE(WORKERS) if (scriptExecutionContext->isWorkerContext()) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h index ce26857..6b75a6f 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h @@ -33,6 +33,7 @@ namespace WebCore { class Document; class Event; + class DOMWrapperWorld; class JSLazyEventListener; class JSEventListener; class ScriptExecutionContext; @@ -102,8 +103,11 @@ namespace WebCore { return constructor; } - JSDOMGlobalObject* toJSDOMGlobalObject(Document*); - JSDOMGlobalObject* toJSDOMGlobalObject(ScriptExecutionContext*); + JSDOMGlobalObject* toJSDOMGlobalObject(Document*, JSC::ExecState*); + JSDOMGlobalObject* toJSDOMGlobalObject(ScriptExecutionContext*, JSC::ExecState*); + + JSDOMGlobalObject* toJSDOMGlobalObject(Document*, DOMWrapperWorld*); + JSDOMGlobalObject* toJSDOMGlobalObject(ScriptExecutionContext*, DOMWrapperWorld*); } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp index a04ef89..86ff149 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp @@ -53,10 +53,11 @@ JSDOMWindowBase::JSDOMWindowBase(NonNullPassRefPtr<Structure> structure, PassRef addStaticGlobals(staticGlobals, sizeof(staticGlobals) / sizeof(GlobalPropertyInfo)); } -void JSDOMWindowBase::updateDocument() +void JSDOMWindowBase::updateDocument(DOMWrapperWorld* world) { ASSERT(d()->impl->document()); ExecState* exec = globalExec(); + EnterDOMWrapperWorld worldEntry(exec, world); symbolTablePutWithAttributes(Identifier(exec, "document"), toJS(exec, this, d()->impl->document()), DontDelete | ReadOnly); } @@ -79,21 +80,7 @@ String JSDOMWindowBase::crossDomainAccessErrorMessage(const JSGlobalObject* othe void JSDOMWindowBase::printErrorMessage(const String& message) const { - if (message.isEmpty()) - return; - - Frame* frame = impl()->frame(); - if (!frame) - return; - - Settings* settings = frame->settings(); - if (!settings) - return; - - if (settings->privateBrowsingEnabled()) - return; - - impl()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String()); // FIXME: provide a real line number and source URL. + printErrorMessageForFrame(impl()->frame(), message); } ExecState* JSDOMWindowBase::globalExec() @@ -157,13 +144,16 @@ JSDOMWindowShell* JSDOMWindowBase::shell() const JSGlobalData* JSDOMWindowBase::commonJSGlobalData() { - static JSGlobalData* globalData; + ASSERT(isMainThread()); + + static JSGlobalData* globalData = 0; if (!globalData) { globalData = JSGlobalData::createLeaked().releaseRef(); globalData->timeoutChecker.setTimeoutInterval(10000); // 10 seconds #ifndef NDEBUG globalData->mainThreadOnly = true; #endif + globalData->clientData = new WebCoreJSClientData(globalData); } return globalData; @@ -181,21 +171,21 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject*, DOMWindow* domWindow) return toJS(exec, domWindow); } -JSValue toJS(ExecState*, DOMWindow* domWindow) +JSValue toJS(ExecState* exec, DOMWindow* domWindow) { if (!domWindow) return jsNull(); Frame* frame = domWindow->frame(); if (!frame) return jsNull(); - return frame->script()->windowShell(); + return frame->script()->windowShell(currentWorld(exec)); } -JSDOMWindow* toJSDOMWindow(Frame* frame) +JSDOMWindow* toJSDOMWindow(Frame* frame, DOMWrapperWorld* world) { if (!frame) return 0; - return frame->script()->windowShell()->window(); + return frame->script()->windowShell(world)->window(); } JSDOMWindow* toJSDOMWindow(JSValue value) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.h index 52c3c1d..31e2486 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.h @@ -32,6 +32,7 @@ namespace WebCore { class DOMWindow; class Event; class Frame; + class DOMWrapperWorld; class JSDOMWindow; class JSDOMWindowShell; class JSLocation; @@ -46,7 +47,7 @@ namespace WebCore { JSDOMWindowBase(NonNullPassRefPtr<JSC::Structure>, PassRefPtr<DOMWindow>, JSDOMWindowShell*); public: - void updateDocument(); + void updateDocument(DOMWrapperWorld*); DOMWindow* impl() const { return d()->impl.get(); } virtual ScriptExecutionContext* scriptExecutionContext() const; @@ -102,7 +103,7 @@ namespace WebCore { JSC::JSValue toJS(JSC::ExecState*, DOMWindow*); // Returns JSDOMWindow or 0 - JSDOMWindow* toJSDOMWindow(Frame*); + JSDOMWindow* toJSDOMWindow(Frame*, DOMWrapperWorld*); JSDOMWindow* toJSDOMWindow(JSC::JSValue); } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp index deb92cb..2804b3c 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -771,7 +771,8 @@ static Frame* createWindow(ExecState* exec, Frame* lexicalFrame, Frame* dynamicF newFrame->loader()->setOpener(openerFrame); newFrame->page()->setOpenedByDOM(); - JSDOMWindow* newWindow = toJSDOMWindow(newFrame); + // FIXME: If a window is created from an isolated world, what are the consequences of this? 'dialogArguments' only appears back in the normal world? + JSDOMWindow* newWindow = toJSDOMWindow(newFrame, normalWorld(exec->globalData())); if (dialogArgs) newWindow->putDirect(Identifier(exec, "dialogArguments"), dialogArgs); @@ -831,7 +832,7 @@ JSValue JSDOMWindow::open(ExecState* exec, const ArgList& args) if (!shouldAllowNavigation(exec, frame)) return jsUndefined(); - const JSDOMWindow* targetedWindow = toJSDOMWindow(frame); + const JSDOMWindow* targetedWindow = toJSDOMWindow(frame, currentWorld(exec)); if (!completedURL.isEmpty() && (!protocolIsJavaScript(completedURL) || (targetedWindow && targetedWindow->allowsAccessFrom(exec)))) { bool userGesture = processingUserGesture(exec); @@ -932,7 +933,7 @@ JSValue JSDOMWindow::showModalDialog(ExecState* exec, const ArgList& args) if (!dialogFrame) return jsUndefined(); - JSDOMWindow* dialogWindow = toJSDOMWindow(dialogFrame); + JSDOMWindow* dialogWindow = toJSDOMWindow(dialogFrame, currentWorld(exec)); dialogFrame->page()->chrome()->runModal(); Identifier returnValue(exec, "returnValue"); @@ -975,7 +976,7 @@ JSValue JSDOMWindow::postMessage(ExecState* exec, const ArgList& args) JSValue JSDOMWindow::setTimeout(ExecState* exec, const ArgList& args) { - ScheduledAction* action = ScheduledAction::create(exec, args); + ScheduledAction* action = ScheduledAction::create(exec, args, currentWorld(exec)); if (exec->hadException()) return jsUndefined(); int delay = args.at(1).toInt32(exec); @@ -984,7 +985,7 @@ JSValue JSDOMWindow::setTimeout(ExecState* exec, const ArgList& args) JSValue JSDOMWindow::setInterval(ExecState* exec, const ArgList& args) { - ScheduledAction* action = ScheduledAction::create(exec, args); + ScheduledAction* action = ScheduledAction::create(exec, args, currentWorld(exec)); if (exec->hadException()) return jsUndefined(); int delay = args.at(1).toInt32(exec); @@ -1052,7 +1053,7 @@ JSValue JSDOMWindow::addEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec)); + impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -1066,7 +1067,7 @@ JSValue JSDOMWindow::removeEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp index 3c3ff4c..9072f91 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp @@ -171,18 +171,18 @@ void* JSDOMWindowShell::operator new(size_t size) // Conversion methods // ---- -JSValue toJS(ExecState*, Frame* frame) +JSValue toJS(ExecState* exec, Frame* frame) { if (!frame) return jsNull(); - return frame->script()->windowShell(); + return frame->script()->windowShell(currentWorld(exec)); } -JSDOMWindowShell* toJSDOMWindowShell(Frame* frame) +JSDOMWindowShell* toJSDOMWindowShell(Frame* frame, DOMWrapperWorld* isolatedWorld) { if (!frame) return 0; - return frame->script()->windowShell(); + return frame->script()->windowShell(isolatedWorld); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h index 1bb0938..36cb8d6 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h @@ -88,7 +88,7 @@ namespace WebCore { }; JSC::JSValue toJS(JSC::ExecState*, Frame*); - JSDOMWindowShell* toJSDOMWindowShell(Frame*); + JSDOMWindowShell* toJSDOMWindowShell(Frame*, DOMWrapperWorld*); } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp index 9bff637..7485c1f 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp @@ -67,7 +67,7 @@ JSValue JSNotification::addEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener)), false), args.at(2).toBoolean(exec)); + impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener)), false, currentWorld(exec)), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -77,7 +77,7 @@ JSValue JSNotification::removeEventListener(ExecState* exec, const ArgList& args if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp index 4f273fe..1a999a8 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp @@ -31,10 +31,11 @@ using namespace JSC; namespace WebCore { -JSEventListener::JSEventListener(JSObject* function, bool isAttribute) +JSEventListener::JSEventListener(JSObject* function, bool isAttribute, DOMWrapperWorld* isolatedWorld) : EventListener(JSEventListenerType) , m_jsFunction(function) , m_isAttribute(isAttribute) + , m_isolatedWorld(isolatedWorld) { } @@ -65,7 +66,7 @@ void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext if (!jsFunction) return; - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext, m_isolatedWorld.get()); if (!globalObject) return; @@ -86,7 +87,12 @@ void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext ExecState* exec = globalObject->globalExec(); - JSValue handleEventFunction = jsFunction->get(exec, Identifier(exec, "handleEvent")); + JSValue handleEventFunction; + { + // Switch worlds, just in case handleEvent is a getter and causes JS execution! + EnterDOMWrapperWorld worldEntry(exec, m_isolatedWorld.get()); + handleEventFunction = jsFunction->get(exec, Identifier(exec, "handleEvent")); + } CallData callData; CallType callType = handleEventFunction.getCallData(callData); if (callType == CallTypeNone) { @@ -108,8 +114,8 @@ void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext globalData->timeoutChecker.start(); JSValue retval = handleEventFunction - ? call(exec, handleEventFunction, callType, callData, jsFunction, args) - : call(exec, jsFunction, callType, callData, toJS(exec, globalObject, event->currentTarget()), args); + ? callInWorld(exec, handleEventFunction, callType, callData, jsFunction, args, m_isolatedWorld.get()) + : callInWorld(exec, jsFunction, callType, callData, toJS(exec, globalObject, event->currentTarget()), args, m_isolatedWorld.get()); globalData->timeoutChecker.stop(); globalObject->setCurrentEvent(savedEvent); @@ -140,7 +146,7 @@ bool JSEventListener::reportError(ScriptExecutionContext* context, const String& if (!jsFunction) return false; - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get()); ExecState* exec = globalObject->globalExec(); CallData callData; @@ -160,7 +166,7 @@ bool JSEventListener::reportError(ScriptExecutionContext* context, const String& JSValue thisValue = globalObject->toThisObject(exec); globalData->timeoutChecker.start(); - JSValue returnValue = call(exec, jsFunction, callType, callData, thisValue, args); + JSValue returnValue = callInWorld(exec, jsFunction, callType, callData, thisValue, args, m_isolatedWorld.get()); globalData->timeoutChecker.stop(); // If an error occurs while handling the script error, it should be bubbled up. diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h b/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h index 285a9c4..bf3af48 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h @@ -30,9 +30,9 @@ namespace WebCore { class JSEventListener : public EventListener { public: - static PassRefPtr<JSEventListener> create(JSC::JSObject* listener, bool isAttribute) + static PassRefPtr<JSEventListener> create(JSC::JSObject* listener, bool isAttribute, DOMWrapperWorld* isolatedWorld) { - return adoptRef(new JSEventListener(listener, isAttribute)); + return adoptRef(new JSEventListener(listener, isAttribute, isolatedWorld)); } static const JSEventListener* cast(const EventListener* listener) @@ -59,10 +59,11 @@ namespace WebCore { void clearJSFunctionInline(); protected: - JSEventListener(JSC::JSObject* function, bool isAttribute); + JSEventListener(JSC::JSObject* function, bool isAttribute, DOMWrapperWorld* isolatedWorld); mutable JSC::JSObject* m_jsFunction; bool m_isAttribute; + RefPtr<DOMWrapperWorld> m_isolatedWorld; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp index 00dfe12..8f0dfb1 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp @@ -49,7 +49,7 @@ JSValue JSEventSource::addEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -59,7 +59,7 @@ JSValue JSEventSource::removeEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSEventTarget.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSEventTarget.cpp index 0421d10..6ea1135 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSEventTarget.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSEventTarget.cpp @@ -128,7 +128,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ return toJS(exec, globalObject, worker); if (DedicatedWorkerContext* workerContext = target->toDedicatedWorkerContext()) - return toJSDOMGlobalObject(workerContext); + return toJSDOMGlobalObject(workerContext, exec); #endif #if ENABLE(SHARED_WORKERS) @@ -136,7 +136,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ return toJS(exec, globalObject, sharedWorker); if (SharedWorkerContext* workerContext = target->toSharedWorkerContext()) - return toJSDOMGlobalObject(workerContext); + return toJSDOMGlobalObject(workerContext, exec); #endif #if ENABLE(NOTIFICATIONS) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp new file mode 100644 index 0000000..fd1dd11 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JSHTMLAllCollection.h" + +#include "AtomicString.h" +#include "HTMLAllCollection.h" +#include "JSDOMBinding.h" +#include "JSHTMLAllCollection.h" +#include "JSNode.h" +#include "JSNodeList.h" +#include "Node.h" +#include "StaticNodeList.h" +#include <wtf/Vector.h> + +using namespace JSC; + +namespace WebCore { + +static JSValue getNamedItems(ExecState* exec, JSHTMLAllCollection* collection, const Identifier& propertyName) +{ + Vector<RefPtr<Node> > namedItems; + collection->impl()->namedItems(propertyName, namedItems); + + if (namedItems.isEmpty()) + return jsUndefined(); + if (namedItems.size() == 1) + return toJS(exec, collection->globalObject(), namedItems[0].get()); + + // FIXME: HTML5 specifies that this should be a DynamicNodeList. + // FIXME: HTML5 specifies that non-HTMLOptionsCollection collections should return + // the first matching item instead of a NodeList. + return toJS(exec, collection->globalObject(), StaticNodeList::adopt(namedItems).get()); +} + +// HTMLCollections are strange objects, they support both get and call, +// so that document.forms.item(0) and document.forms(0) both work. +static JSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec, JSObject* function, JSValue, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + // Do not use thisObj here. It can be the JSHTMLDocument, in the document.forms(i) case. + JSHTMLAllCollection* jsCollection = static_cast<JSHTMLAllCollection*>(function); + HTMLAllCollection* collection = static_cast<HTMLAllCollection*>(jsCollection->impl()); + + // Also, do we need the TypeError test here ? + + if (args.size() == 1) { + // Support for document.all(<index>) etc. + bool ok; + UString string = args.at(0).toString(exec); + unsigned index = string.toUInt32(&ok, false); + if (ok) + return toJS(exec, jsCollection->globalObject(), collection->item(index)); + + // Support for document.images('<name>') etc. + return getNamedItems(exec, jsCollection, Identifier(exec, string)); + } + + // The second arg, if set, is the index of the item we want + bool ok; + UString string = args.at(0).toString(exec); + unsigned index = args.at(1).toString(exec).toUInt32(&ok, false); + if (ok) { + String pstr = string; + Node* node = collection->namedItem(pstr); + while (node) { + if (!index) + return toJS(exec, jsCollection->globalObject(), node); + node = collection->nextNamedItem(pstr); + --index; + } + } + + return jsUndefined(); +} + +CallType JSHTMLAllCollection::getCallData(CallData& callData) +{ + callData.native.function = callHTMLAllCollection; + return CallTypeHost; +} + +bool JSHTMLAllCollection::canGetItemsForName(ExecState*, HTMLAllCollection* collection, const Identifier& propertyName) +{ + Vector<RefPtr<Node> > namedItems; + collection->namedItems(propertyName, namedItems); + return !namedItems.isEmpty(); +} + +JSValue JSHTMLAllCollection::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) +{ + JSHTMLAllCollection* thisObj = static_cast<JSHTMLAllCollection*>(asObject(slot.slotBase())); + return getNamedItems(exec, thisObj, propertyName); +} + +JSValue JSHTMLAllCollection::item(ExecState* exec, const ArgList& args) +{ + bool ok; + uint32_t index = args.at(0).toString(exec).toUInt32(&ok, false); + if (ok) + return toJS(exec, globalObject(), impl()->item(index)); + return getNamedItems(exec, this, Identifier(exec, args.at(0).toString(exec))); +} + +JSValue JSHTMLAllCollection::namedItem(ExecState* exec, const ArgList& args) +{ + return getNamedItems(exec, this, Identifier(exec, args.at(0).toString(exec))); +} + +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLCollectionCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLCollectionCustom.cpp index 8ffddf7..dd4ceaa 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLCollectionCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLCollectionCustom.cpp @@ -23,6 +23,7 @@ #include "AtomicString.h" #include "HTMLCollection.h" #include "HTMLOptionsCollection.h" +#include "HTMLAllCollection.h" #include "JSDOMBinding.h" #include "JSHTMLAllCollection.h" #include "JSHTMLOptionsCollection.h" @@ -143,7 +144,6 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, HTMLCollection* c wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, HTMLOptionsCollection, collection); break; case DocAll: - typedef HTMLCollection HTMLAllCollection; wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, HTMLAllCollection, collection); break; default: diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLDocumentCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLDocumentCustom.cpp index c113ec7..a65ca7c 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLDocumentCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLDocumentCustom.cpp @@ -28,6 +28,7 @@ #include "CharacterNames.h" #include "Frame.h" +#include "HTMLAllCollection.h" #include "HTMLBodyElement.h" #include "HTMLCollection.h" #include "HTMLDocument.h" @@ -105,14 +106,14 @@ JSValue JSHTMLDocument::open(ExecState* exec, const ArgList& args) if (args.size() > 2) { Frame* frame = static_cast<HTMLDocument*>(impl())->frame(); if (frame) { - JSDOMWindowShell* wrapper = toJSDOMWindowShell(frame); + JSDOMWindowShell* wrapper = toJSDOMWindowShell(frame, currentWorld(exec)); if (wrapper) { JSValue function = wrapper->get(exec, Identifier(exec, "open")); CallData callData; CallType callType = function.getCallData(callData); if (callType == CallTypeNone) return throwError(exec, TypeError); - return call(exec, function, callType, callData, wrapper, args); + return callInWorld(exec, function, callType, callData, wrapper, args, currentWorld(exec)); } } return jsUndefined(); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp index 05972e6..68769d6 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp @@ -47,14 +47,14 @@ bool JSHTMLFrameSetElement::canGetItemsForName(ExecState*, HTMLFrameSetElement* return frame && frame->hasTagName(frameTag); } -JSValue JSHTMLFrameSetElement::nameGetter(ExecState*, const Identifier& propertyName, const PropertySlot& slot) +JSValue JSHTMLFrameSetElement::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) { JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(asObject(slot.slotBase())); HTMLElement* element = static_cast<HTMLElement*>(thisObj->impl()); Node* frame = element->children()->namedItem(propertyName); if (Document* doc = static_cast<HTMLFrameElement*>(frame)->contentDocument()) { - if (JSDOMWindowShell* window = toJSDOMWindowShell(doc->frame())) + if (JSDOMWindowShell* window = toJSDOMWindowShell(doc->frame(), currentWorld(exec))) return window; } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSInspectorBackendCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSInspectorBackendCustom.cpp index 391cacc..439f532 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSInspectorBackendCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSInspectorBackendCustom.cpp @@ -131,7 +131,8 @@ JSValue JSInspectorBackend::databaseForId(ExecState* exec, const ArgList& args) Database* database = impl()->databaseForId(args.at(0).toInt32(exec)); if (!database) return jsUndefined(); - JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame()); + // Could use currentWorld(exec) ... but which exec! The following mixed use of exec & inspectedWindow->globalExec() scares me! + JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame(), debuggerWorld()); return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), toJS(exec, database)); } #endif @@ -141,7 +142,7 @@ JSValue JSInspectorBackend::inspectedWindow(ExecState*, const ArgList&) InspectorController* ic = impl()->inspectorController(); if (!ic) return jsUndefined(); - JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame()); + JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame(), debuggerWorld()); return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), inspectedWindow); } @@ -266,7 +267,7 @@ JSValue JSInspectorBackend::nodeForId(ExecState* exec, const ArgList& args) return jsUndefined(); JSLock lock(SilenceAssertionsOnly); - JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame()); + JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame(), debuggerWorld()); return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), toJS(exec, deprecatedGlobalObjectForPrototype(inspectedWindow->globalExec()), node)); } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp index 0d6cb57..6d75f4f 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp @@ -35,8 +35,8 @@ namespace WebCore { static WTF::RefCountedLeakCounter eventListenerCounter("JSLazyEventListener"); #endif -JSLazyEventListener::JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber) - : JSEventListener(0, true) +JSLazyEventListener::JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber, DOMWrapperWorld* isolatedWorld) + : JSEventListener(0, true, isolatedWorld) , m_functionName(functionName) , m_eventParameterName(eventParameterName) , m_code(code) @@ -92,7 +92,7 @@ void JSLazyEventListener::parseCode(ScriptExecutionContext* executionContext) co if (!scriptController->isEnabled()) return; - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(executionContext); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(executionContext, m_isolatedWorld.get()); if (!globalObject) return; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.h b/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.h index e3137b8..ba26ef6 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.h @@ -29,14 +29,14 @@ namespace WebCore { class JSLazyEventListener : public JSEventListener { public: - static PassRefPtr<JSLazyEventListener> create(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber) + static PassRefPtr<JSLazyEventListener> create(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber, DOMWrapperWorld* isolatedWorld) { - return adoptRef(new JSLazyEventListener(functionName, eventParameterName, code, node, sourceURL, lineNumber)); + return adoptRef(new JSLazyEventListener(functionName, eventParameterName, code, node, sourceURL, lineNumber, isolatedWorld)); } virtual ~JSLazyEventListener(); private: - JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node*, const String& sourceURL, int lineNumber); + JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node*, const String& sourceURL, int lineNumber, DOMWrapperWorld* isolatedWorld); virtual JSC::JSObject* jsFunction(ScriptExecutionContext*) const; virtual bool wasCreatedFromMarkup() const { return true; } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSMessageChannelCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSMessageChannelCustom.cpp index 574e28a..d28d494 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSMessageChannelCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSMessageChannelCustom.cpp @@ -36,17 +36,11 @@ void JSMessageChannel::markChildren(MarkStack& markStack) { Base::markChildren(markStack); - if (MessagePort* port = m_impl->port1()) { - DOMObject* wrapper = getCachedDOMObjectWrapper(*Heap::heap(this)->globalData(), port); - if (wrapper) - markStack.append(wrapper); - } + if (MessagePort* port = m_impl->port1()) + markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), port); - if (MessagePort* port = m_impl->port2()) { - DOMObject* wrapper = getCachedDOMObjectWrapper(*Heap::heap(this)->globalData(), port); - if (wrapper) - markStack.append(wrapper); - } + if (MessagePort* port = m_impl->port2()) + markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), port); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp index a0a92be..2c09620 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp @@ -46,11 +46,8 @@ void JSMessagePort::markChildren(MarkStack& markStack) Base::markChildren(markStack); // If we have a locally entangled port, we can directly mark it as reachable. Ports that are remotely entangled are marked in-use by markActiveObjectsForContext(). - if (MessagePort* entangledPort = m_impl->locallyEntangledPort()) { - DOMObject* wrapper = getCachedDOMObjectWrapper(*Heap::heap(this)->globalData(), entangledPort); - if (wrapper) - markStack.append(wrapper); - } + if (MessagePort* entangledPort = m_impl->locallyEntangledPort()) + markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), entangledPort); m_impl->markEventListeners(markStack); } @@ -61,7 +58,7 @@ JSValue JSMessagePort::addEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -71,7 +68,7 @@ JSValue JSMessagePort::removeEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp index 4e7d622..2a4aa80 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp @@ -114,7 +114,7 @@ JSValue JSNode::addEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec)); + impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -124,7 +124,7 @@ JSValue JSNode::removeEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -143,10 +143,8 @@ void JSNode::markChildren(MarkStack& markStack) // the document, we need to mark the document, but we don't need to explicitly // mark any other nodes. if (node->inDocument()) { - if (Document* doc = node->ownerDocument()) { - if (DOMObject* docWrapper = getCachedDOMObjectWrapper(*Heap::heap(this)->globalData(), doc)) - markStack.append(docWrapper); - } + if (Document* doc = node->ownerDocument()) + markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), doc); return; } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSNodeFilterCondition.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSNodeFilterCondition.cpp index a199417..54dc020 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSNodeFilterCondition.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSNodeFilterCondition.cpp @@ -66,7 +66,7 @@ short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode) if (exec->hadException()) return NodeFilter::FILTER_REJECT; - JSValue result = call(exec, m_filter, callType, callData, m_filter, args); + JSValue result = callInWorld(exec, m_filter, callType, callData, m_filter, args, currentWorld(exec)); if (exec->hadException()) return NodeFilter::FILTER_REJECT; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp index a0551a1..2ab2c00 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "JSQuarantinedObjectWrapper.h" +#include "JSDOMBinding.h" + #include <runtime/JSGlobalObject.h> using namespace JSC; @@ -243,7 +245,8 @@ JSObject* JSQuarantinedObjectWrapper::construct(ExecState* exec, JSObject* const ConstructType unwrappedConstructType = wrapper->m_unwrappedObject->getConstructData(unwrappedConstructData); ASSERT(unwrappedConstructType != ConstructTypeNone); - JSValue unwrappedResult = JSC::construct(wrapper->unwrappedExecState(), wrapper->m_unwrappedObject, unwrappedConstructType, unwrappedConstructData, preparedArgs); + // FIXME: Quarantined objects are all in the debuggerWorld(), for now. Instead, we should remove the quarantined objects, & replace them with an isolated world? + JSValue unwrappedResult = constructInWorld(wrapper->unwrappedExecState(), wrapper->m_unwrappedObject, unwrappedConstructType, unwrappedConstructData, preparedArgs, debuggerWorld()); JSValue resultValue = wrapper->wrapOutgoingValue(wrapper->unwrappedExecState(), unwrappedResult); ASSERT(resultValue.isObject()); @@ -293,7 +296,8 @@ JSValue JSQuarantinedObjectWrapper::call(ExecState* exec, JSObject* function, JS CallType unwrappedCallType = wrapper->m_unwrappedObject->getCallData(unwrappedCallData); ASSERT(unwrappedCallType != CallTypeNone); - JSValue unwrappedResult = JSC::call(wrapper->unwrappedExecState(), wrapper->m_unwrappedObject, unwrappedCallType, unwrappedCallData, preparedThisValue, preparedArgs); + // FIXME: Quarantined objects are all in the debuggerWorld(), for now. Instead, we should remove the quarantined objects, & replace them with an isolated world? + JSValue unwrappedResult = callInWorld(wrapper->unwrappedExecState(), wrapper->m_unwrappedObject, unwrappedCallType, unwrappedCallData, preparedThisValue, preparedArgs, debuggerWorld()); JSValue result = wrapper->wrapOutgoingValue(wrapper->unwrappedExecState(), unwrappedResult); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp index fd3742d..ba1cf22 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp @@ -54,7 +54,7 @@ JSValue JSSVGElementInstance::addEventListener(ExecState* exec, const ArgList& a if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec)); + impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -64,7 +64,7 @@ JSValue JSSVGElementInstance::removeEventListener(ExecState* exec, const ArgList if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerCustom.cpp index f21f50c..4617087 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerCustom.cpp @@ -45,11 +45,8 @@ void JSSharedWorker::markChildren(MarkStack& markStack) { Base::markChildren(markStack); - if (MessagePort* port = impl()->port()) { - DOMObject* wrapper = getCachedDOMObjectWrapper(*Heap::heap(this)->globalData(), port); - if (wrapper) - markStack.append(wrapper); - } + if (MessagePort* port = impl()->port()) + markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), port); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSWebSocketCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSWebSocketCustom.cpp index bea3563..33c3fcd 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSWebSocketCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSWebSocketCustom.cpp @@ -66,7 +66,7 @@ JSValue JSWebSocket::addEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec)); + impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -76,7 +76,7 @@ JSValue JSWebSocket::removeEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp index e1c8a8c..490d9b1 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp @@ -122,7 +122,7 @@ JSValue JSWorkerContext::addEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec)); + impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -132,13 +132,13 @@ JSValue JSWorkerContext::removeEventListener(ExecState* exec, const ArgList& arg if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } JSValue JSWorkerContext::setTimeout(ExecState* exec, const ArgList& args) { - ScheduledAction* action = ScheduledAction::create(exec, args); + ScheduledAction* action = ScheduledAction::create(exec, args, currentWorld(exec)); if (exec->hadException()) return jsUndefined(); int delay = args.at(1).toInt32(exec); @@ -147,7 +147,7 @@ JSValue JSWorkerContext::setTimeout(ExecState* exec, const ArgList& args) JSValue JSWorkerContext::setInterval(ExecState* exec, const ArgList& args) { - ScheduledAction* action = ScheduledAction::create(exec, args); + ScheduledAction* action = ScheduledAction::create(exec, args, currentWorld(exec)); if (exec->hadException()) return jsUndefined(); int delay = args.at(1).toInt32(exec); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp index 7d3f8af..7ee2720 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp @@ -53,11 +53,8 @@ void JSXMLHttpRequest::markChildren(MarkStack& markStack) { Base::markChildren(markStack); - if (XMLHttpRequestUpload* upload = m_impl->optionalUpload()) { - DOMObject* wrapper = getCachedDOMObjectWrapper(*Heap::heap(this)->globalData(), upload); - if (wrapper) - markStack.append(wrapper); - } + if (XMLHttpRequestUpload* upload = m_impl->optionalUpload()) + markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), upload); m_impl->markEventListeners(markStack); } @@ -156,7 +153,7 @@ JSValue JSXMLHttpRequest::addEventListener(ExecState* exec, const ArgList& args) if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec)); + impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -166,7 +163,7 @@ JSValue JSXMLHttpRequest::removeEventListener(ExecState* exec, const ArgList& ar if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp index 275d1fb..fa7cfec 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp @@ -45,11 +45,8 @@ void JSXMLHttpRequestUpload::markChildren(MarkStack& markStack) { Base::markChildren(markStack); - if (XMLHttpRequest* xmlHttpRequest = m_impl->associatedXMLHttpRequest()) { - DOMObject* wrapper = getCachedDOMObjectWrapper(*Heap::heap(this)->globalData(), xmlHttpRequest); - if (wrapper) - markStack.append(wrapper); - } + if (XMLHttpRequest* xmlHttpRequest = m_impl->associatedXMLHttpRequest()) + markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), xmlHttpRequest); m_impl->markEventListeners(markStack); } @@ -60,7 +57,7 @@ JSValue JSXMLHttpRequestUpload::addEventListener(ExecState* exec, const ArgList& if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec)); + impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec)); return jsUndefined(); } @@ -70,7 +67,7 @@ JSValue JSXMLHttpRequestUpload::removeEventListener(ExecState* exec, const ArgLi if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); return jsUndefined(); } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScheduledAction.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScheduledAction.cpp index 93155e1..9a21b6b 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScheduledAction.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScheduledAction.cpp @@ -47,7 +47,7 @@ using namespace JSC; namespace WebCore { -ScheduledAction* ScheduledAction::create(ExecState* exec, const ArgList& args) +ScheduledAction* ScheduledAction::create(ExecState* exec, const ArgList& args, DOMWrapperWorld* isolatedWorld) { JSValue v = args.at(0); CallData callData; @@ -55,15 +55,16 @@ ScheduledAction* ScheduledAction::create(ExecState* exec, const ArgList& args) UString string = v.toString(exec); if (exec->hadException()) return 0; - return new ScheduledAction(string); + return new ScheduledAction(string, isolatedWorld); } ArgList argsTail; args.getSlice(2, argsTail); - return new ScheduledAction(v, argsTail); + return new ScheduledAction(v, argsTail, isolatedWorld); } -ScheduledAction::ScheduledAction(JSValue function, const ArgList& args) +ScheduledAction::ScheduledAction(JSValue function, const ArgList& args, DOMWrapperWorld* isolatedWorld) : m_function(function) + , m_isolatedWorld(isolatedWorld) { ArgList::const_iterator end = args.end(); for (ArgList::const_iterator it = args.begin(); it != end; ++it) @@ -102,7 +103,7 @@ void ScheduledAction::executeFunctionInContext(JSGlobalObject* globalObject, JSV args.append(m_args[i]); globalObject->globalData()->timeoutChecker.start(); - call(exec, m_function, callType, callData, thisValue, args); + callInWorld(exec, m_function, callType, callData, thisValue, args, m_isolatedWorld.get()); globalObject->globalData()->timeoutChecker.stop(); if (exec->hadException()) @@ -111,7 +112,7 @@ void ScheduledAction::executeFunctionInContext(JSGlobalObject* globalObject, JSV void ScheduledAction::execute(Document* document) { - JSDOMWindow* window = toJSDOMWindow(document->frame()); + JSDOMWindow* window = toJSDOMWindow(document->frame(), m_isolatedWorld.get()); if (!window) return; @@ -125,7 +126,7 @@ void ScheduledAction::execute(Document* document) executeFunctionInContext(window, window->shell()); Document::updateStyleForAllDocuments(); } else - frame->script()->executeScript(m_code); + frame->script()->executeScriptInIsolatedWorld(m_isolatedWorld.get(), m_code); frame->script()->setProcessingTimerCallback(false); } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScheduledAction.h b/src/3rdparty/webkit/WebCore/bindings/js/ScheduledAction.h index 2cd36ed..4ea727d 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScheduledAction.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScheduledAction.h @@ -21,6 +21,7 @@ #define ScheduledAction_h #include "PlatformString.h" +#include <JSDOMBinding.h> #include <runtime/JSCell.h> #include <runtime/Protect.h> #include <wtf/Vector.h> @@ -41,14 +42,15 @@ namespace WebCore { */ class ScheduledAction { public: - static ScheduledAction* create(JSC::ExecState*, const JSC::ArgList&); + static ScheduledAction* create(JSC::ExecState*, const JSC::ArgList&, DOMWrapperWorld* isolatedWorld); void execute(ScriptExecutionContext*); private: - ScheduledAction(JSC::JSValue function, const JSC::ArgList&); - ScheduledAction(const String& code) + ScheduledAction(JSC::JSValue function, const JSC::ArgList&, DOMWrapperWorld* isolatedWorld); + ScheduledAction(const String& code, DOMWrapperWorld* isolatedWorld) : m_code(code) + , m_isolatedWorld(isolatedWorld) { } @@ -61,6 +63,7 @@ namespace WebCore { JSC::ProtectedJSValue m_function; Vector<JSC::ProtectedJSValue> m_args; String m_code; + RefPtr<DOMWrapperWorld> m_isolatedWorld; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptCachedFrameData.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptCachedFrameData.cpp index 77b8ca4..e01324e 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptCachedFrameData.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptCachedFrameData.cpp @@ -48,8 +48,9 @@ ScriptCachedFrameData::ScriptCachedFrameData(Frame* frame) JSLock lock(SilenceAssertionsOnly); ScriptController* scriptController = frame->script(); - if (scriptController->haveWindowShell()) { - m_window = scriptController->windowShell()->window(); + // FIXME: explicitly save and restore isolated worlds' global objects when using the back/forward cache. <rdar://problem/7328111> + if (JSDOMWindowShell* windowShell = scriptController->existingWindowShell(mainThreadNormalWorld())) { + m_window = windowShell->window(); scriptController->attachDebugger(0); } } @@ -70,11 +71,11 @@ void ScriptCachedFrameData::restore(Frame* frame) JSLock lock(SilenceAssertionsOnly); ScriptController* scriptController = frame->script(); - if (scriptController->haveWindowShell()) { - JSDOMWindowShell* windowShell = scriptController->windowShell(); - if (m_window) { + // FIXME: explicitly save and restore isolated worlds' global objects when using the back/forward cache. <rdar://problem/7328111> + if (JSDOMWindowShell* windowShell = scriptController->existingWindowShell(mainThreadNormalWorld())) { + if (m_window) windowShell->setWindow(m_window.get()); - } else { + else { windowShell->setWindow(frame->domWindow()); scriptController->attachDebugger(page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp index 54acc90..4a1d413 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.cpp @@ -21,6 +21,7 @@ #include "config.h" #include "ScriptController.h" +#include "CString.h" #include "Event.h" #include "EventNames.h" #include "Frame.h" @@ -38,12 +39,18 @@ #include "npruntime_impl.h" #include "runtime_root.h" #include <debugger/Debugger.h> +#include <runtime/InitializeThreading.h> #include <runtime/JSLock.h> using namespace JSC; namespace WebCore { +void ScriptController::initializeThreading() +{ + JSC::initializeThreading(); +} + ScriptController::ScriptController(Frame* frame) : m_frame(frame) , m_handlerLineNumber(0) @@ -71,8 +78,11 @@ ScriptController::ScriptController(Frame* frame) ScriptController::~ScriptController() { - if (m_windowShell) { - m_windowShell = 0; + if (!m_windowShells.isEmpty()) { + for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter) + iter->first->forgetScriptController(this); + + m_windowShells.clear(); // It's likely that releasing the global object has created a lot of garbage. gcController().garbageCollectSoon(); @@ -81,7 +91,7 @@ ScriptController::~ScriptController() disconnectPlatformScriptObjects(); } -ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode) +ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode, DOMWrapperWorld* world) { const SourceCode& jsSourceCode = sourceCode.jsSourceCode(); String sourceURL = jsSourceCode.provider()->url(); @@ -94,12 +104,12 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode) // evaluate code. Returns the JS return value or 0 // if there was none, an error occured or the type couldn't be converted. - initScriptIfNeeded(); // inlineCode is true for <a href="javascript:doSomething()"> // and false for <script>doSomething()</script>. Check if it has the // expected value in all cases. // See smart window.open policy for where this is used. - ExecState* exec = m_windowShell->window()->globalExec(); + JSDOMWindowShell* shell = windowShell(world); + ExecState* exec = shell->window()->globalExec(); const String* savedSourceURL = m_sourceURL; m_sourceURL = &sourceURL; @@ -107,9 +117,9 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode) RefPtr<Frame> protect = m_frame; - m_windowShell->window()->globalData()->timeoutChecker.start(); - Completion comp = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, m_windowShell); - m_windowShell->window()->globalData()->timeoutChecker.stop(); + exec->globalData().timeoutChecker.start(); + Completion comp = WebCore::evaluateInWorld(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, shell, world); + exec->globalData().timeoutChecker.stop(); // Evaluating the JavaScript could cause the frame to be deallocated // so we start the keep alive timer here. @@ -127,52 +137,114 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode) return JSValue(); } -void ScriptController::evaluateInIsolatedWorld(unsigned /* worldID */, const Vector<ScriptSourceCode>& sourceCode) +ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode) +{ + return evaluateInWorld(sourceCode, mainThreadNormalWorld()); +} + +// An DOMWrapperWorld other than the thread's normal world. +class IsolatedWorld : public DOMWrapperWorld { +public: + IsolatedWorld(JSGlobalData* globalData) + : DOMWrapperWorld(globalData) + { + JSGlobalData::ClientData* clientData = globalData->clientData; + ASSERT(clientData); + static_cast<WebCoreJSClientData*>(clientData)->rememberWorld(this); + } + + static PassRefPtr<IsolatedWorld> create(JSGlobalData* globalData) { return adoptRef(new IsolatedWorld(globalData)); } +}; + +static PassRefPtr<IsolatedWorld> findWorld(unsigned worldID) +{ + if (!worldID) + return IsolatedWorld::create(JSDOMWindow::commonJSGlobalData()); + + typedef HashMap<unsigned, RefPtr<IsolatedWorld> > WorldMap; + DEFINE_STATIC_LOCAL(WorldMap, isolatedWorlds, ()); + + WorldMap::iterator iter = isolatedWorlds.find(worldID); + if (iter != isolatedWorlds.end()) + return iter->second; + + RefPtr<IsolatedWorld> newWorld = IsolatedWorld::create(JSDOMWindow::commonJSGlobalData()); + isolatedWorlds.add(worldID, newWorld); + return newWorld; +} + +JSDOMWindow* ScriptController::globalObject(unsigned worldID) +{ + RefPtr<DOMWrapperWorld> world = findWorld(worldID); + return windowShell(world.get())->window(); +} + +ScriptValue ScriptController::evaluateInIsolatedWorld(unsigned worldID, const ScriptSourceCode& sourceCode) +{ + RefPtr<DOMWrapperWorld> world = findWorld(worldID); + return evaluateInWorld(sourceCode, world.get()); +} + +void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sourceCode) { - // FIXME: Actually support isolated worlds! + RefPtr<DOMWrapperWorld> world = findWorld(worldID); + unsigned size = sourceCode.size(); for (unsigned i = 0; i < size; ++i) - evaluate(sourceCode[i]); + evaluateInWorld(sourceCode[i], world.get()); } void ScriptController::clearWindowShell() { - if (!m_windowShell) + if (m_windowShells.isEmpty()) return; JSLock lock(SilenceAssertionsOnly); // Clear the debugger from the current window before setting the new window. + DOMWrapperWorld* debugWorld = debuggerWorld(); attachDebugger(0); - m_windowShell->window()->willRemoveFromWindowShell(); - m_windowShell->setWindow(m_frame->domWindow()); + for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter) { + DOMWrapperWorld* world = iter->first; + JSDOMWindowShell* windowShell = iter->second; + windowShell->window()->willRemoveFromWindowShell(); + windowShell->setWindow(m_frame->domWindow()); - if (Page* page = m_frame->page()) { - attachDebugger(page->debugger()); - m_windowShell->window()->setProfileGroup(page->group().identifier()); + if (Page* page = m_frame->page()) { + if (world == debugWorld) + attachDebugger(page->debugger()); + windowShell->window()->setProfileGroup(page->group().identifier()); + } } // There is likely to be a lot of garbage now. gcController().garbageCollectSoon(); } -void ScriptController::initScript() +JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld* world) { - if (m_windowShell) - return; + ASSERT(!m_windowShells.contains(world)); JSLock lock(SilenceAssertionsOnly); - m_windowShell = new JSDOMWindowShell(m_frame->domWindow()); - m_windowShell->window()->updateDocument(); + JSDOMWindowShell* windowShell = new JSDOMWindowShell(m_frame->domWindow()); + m_windowShells.add(world, windowShell); + world->rememberScriptController(this); + windowShell->window()->updateDocument(world); if (Page* page = m_frame->page()) { - attachDebugger(page->debugger()); - m_windowShell->window()->setProfileGroup(page->group().identifier()); + if (world == debuggerWorld()) + attachDebugger(page->debugger()); + windowShell->window()->setProfileGroup(page->group().identifier()); + } + + { + EnterDOMWrapperWorld worldEntry(*JSDOMWindow::commonJSGlobalData(), world); + m_frame->loader()->dispatchWindowObjectAvailable(); } - m_frame->loader()->dispatchWindowObjectAvailable(); + return windowShell; } bool ScriptController::processingUserGesture() const @@ -182,10 +254,11 @@ bool ScriptController::processingUserGesture() const bool ScriptController::processingUserGestureEvent() const { - if (!m_windowShell) + JSDOMWindowShell* shell = existingWindowShell(mainThreadNormalWorld()); + if (!shell) return false; - if (Event* event = m_windowShell->window()->currentEvent()) { + if (Event* event = shell->window()->currentEvent()) { if (event->createdByDOM()) return false; @@ -243,13 +316,16 @@ bool ScriptController::isEnabled() void ScriptController::attachDebugger(JSC::Debugger* debugger) { - if (!m_windowShell) + // FIXME: Should be able to debug isolated worlds. + JSDOMWindowShell* shell = existingWindowShell(debuggerWorld()); + if (!shell) return; + JSDOMWindow* globalObject = shell->window(); if (debugger) - debugger->attach(m_windowShell->window()); - else if (JSC::Debugger* currentDebugger = m_windowShell->window()->debugger()) - currentDebugger->detach(m_windowShell->window()); + debugger->attach(globalObject); + else if (JSC::Debugger* currentDebugger = globalObject->debugger()) + currentDebugger->detach(globalObject); } void ScriptController::updateDocument() @@ -258,8 +334,8 @@ void ScriptController::updateDocument() return; JSLock lock(SilenceAssertionsOnly); - if (m_windowShell) - m_windowShell->window()->updateDocument(); + for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter) + iter->second->window()->updateDocument(iter->first); } void ScriptController::updateSecurityOrigin() @@ -274,7 +350,7 @@ Bindings::RootObject* ScriptController::bindingRootObject() if (!m_bindingRootObject) { JSLock lock(SilenceAssertionsOnly); - m_bindingRootObject = Bindings::RootObject::create(0, globalObject()); + m_bindingRootObject = Bindings::RootObject::create(0, globalObject(pluginWorld())); } return m_bindingRootObject.get(); } @@ -285,7 +361,7 @@ PassRefPtr<Bindings::RootObject> ScriptController::createRootObject(void* native if (it != m_rootObjects.end()) return it->second; - RefPtr<Bindings::RootObject> rootObject = Bindings::RootObject::create(nativeHandle, globalObject()); + RefPtr<Bindings::RootObject> rootObject = Bindings::RootObject::create(nativeHandle, globalObject(pluginWorld())); m_rootObjects.set(nativeHandle, rootObject); return rootObject.release(); @@ -300,7 +376,7 @@ NPObject* ScriptController::windowScriptNPObject() // JavaScript is enabled, so there is a JavaScript window object. // Return an NPObject bound to the window object. JSC::JSLock lock(SilenceAssertionsOnly); - JSObject* win = windowShell()->window(); + JSObject* win = windowShell(pluginWorld())->window(); ASSERT(win); Bindings::RootObject* root = bindingRootObject(); m_windowScriptNPObject = _NPN_CreateScriptObject(0, win, root); @@ -334,8 +410,9 @@ JSObject* ScriptController::jsObjectForPluginElement(HTMLPlugInElement* plugin) // Create a JSObject bound to this element JSLock lock(SilenceAssertionsOnly); - ExecState* exec = globalObject()->globalExec(); - JSValue jsElementValue = toJS(exec, globalObject(), plugin); + JSDOMWindow* globalObj = globalObject(pluginWorld()); + // FIXME: is normal okay? - used for NP plugins? + JSValue jsElementValue = toJS(globalObj->globalExec(), globalObj, plugin); if (!jsElementValue || !jsElementValue.isObject()) return 0; @@ -391,4 +468,44 @@ void ScriptController::clearScriptObjects() #endif } +ScriptValue ScriptController::executeScriptInIsolatedWorld(unsigned worldID, const String& script, bool forceUserGesture) +{ + ScriptSourceCode sourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url()); + + if (!isEnabled() || isPaused()) + return ScriptValue(); + + bool wasInExecuteScript = m_inExecuteScript; + m_inExecuteScript = true; + + ScriptValue result = evaluateInIsolatedWorld(worldID, sourceCode); + + if (!wasInExecuteScript) { + m_inExecuteScript = false; + Document::updateStyleForAllDocuments(); + } + + return result; +} + +ScriptValue ScriptController::executeScriptInIsolatedWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture) +{ + ScriptSourceCode sourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url()); + + if (!isEnabled() || isPaused()) + return ScriptValue(); + + bool wasInExecuteScript = m_inExecuteScript; + m_inExecuteScript = true; + + ScriptValue result = evaluateInWorld(sourceCode, world); + + if (!wasInExecuteScript) { + m_inExecuteScript = false; + Document::updateStyleForAllDocuments(); + } + + return result; +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h index bd4b65e..f2a497d 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h @@ -63,31 +63,49 @@ class XSSAuditor; typedef HashMap<void*, RefPtr<JSC::Bindings::RootObject> > RootObjectMap; class ScriptController { + typedef WTF::HashMap<DOMWrapperWorld*, JSC::ProtectedPtr<JSDOMWindowShell> > ShellMap; + public: ScriptController(Frame*); ~ScriptController(); - bool haveWindowShell() const { return m_windowShell; } - JSDOMWindowShell* windowShell() + JSDOMWindowShell* windowShell(DOMWrapperWorld* world) + { + ShellMap::iterator iter = m_windowShells.find(world); + return (iter != m_windowShells.end()) ? iter->second.get() : initScript(world); + } + JSDOMWindowShell* existingWindowShell(DOMWrapperWorld* world) const + { + ShellMap::const_iterator iter = m_windowShells.find(world); + return (iter != m_windowShells.end()) ? iter->second.get() : 0; + } + JSDOMWindow* globalObject(DOMWrapperWorld* world) { - initScriptIfNeeded(); - return m_windowShell; + return windowShell(world)->window(); } + JSDOMWindow* globalObject(unsigned worldID); - JSDOMWindow* globalObject() + void forgetWorld(DOMWrapperWorld* world) { - initScriptIfNeeded(); - return m_windowShell->window(); + m_windowShells.remove(world); } ScriptValue executeScript(const ScriptSourceCode&); ScriptValue executeScript(const String& script, bool forceUserGesture = false); + ScriptValue executeScriptInIsolatedWorld(unsigned worldID, const String& script, bool forceUserGesture = false); + ScriptValue executeScriptInIsolatedWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture = false); // Returns true if argument is a JavaScript URL. bool executeIfJavaScriptURL(const KURL&, bool userGesture = false, bool replaceDocument = true); + // This function must be called from the main thread. It is safe to call it repeatedly. + // Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly. + static void initializeThreading(); + ScriptValue evaluate(const ScriptSourceCode&); - void evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>&); + ScriptValue evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*); + ScriptValue evaluateInIsolatedWorld(unsigned /*worldID*/, const ScriptSourceCode&); + void evaluateInIsolatedWorld(unsigned /*worldID*/, const Vector<ScriptSourceCode>&); void setEventHandlerLineNumber(int lineno) { m_handlerLineNumber = lineno; } int eventHandlerLineNumber() { return m_handlerLineNumber; } @@ -144,19 +162,14 @@ public: XSSAuditor* xssAuditor() { return m_XSSAuditor.get(); } private: - void initScriptIfNeeded() - { - if (!m_windowShell) - initScript(); - } - void initScript(); + JSDOMWindowShell* initScript(DOMWrapperWorld* world); void disconnectPlatformScriptObjects(); bool processingUserGestureEvent() const; bool isJavaScriptAnchorNavigation() const; - JSC::ProtectedPtr<JSDOMWindowShell> m_windowShell; + ShellMap m_windowShells; Frame* m_frame; int m_handlerLineNumber; const String* m_sourceURL; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm index e6a654f..21ec0f2 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm @@ -114,7 +114,7 @@ WebScriptObject* ScriptController::windowScriptObject() if (!m_windowScriptObject) { JSC::JSLock lock(JSC::SilenceAssertionsOnly); JSC::Bindings::RootObject* root = bindingRootObject(); - m_windowScriptObject = [WebScriptObject scriptObjectForJSObject:toRef(windowShell()) originRootObject:root rootObject:root]; + m_windowScriptObject = [WebScriptObject scriptObjectForJSObject:toRef(windowShell(pluginWorld())) originRootObject:root rootObject:root]; } ASSERT([m_windowScriptObject.get() isKindOfClass:[DOMAbstractView class]]); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp index 0b0047b..8399c7a 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp @@ -71,7 +71,7 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node* node, Attribu sourceURL = node->document()->url().string(); } - return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), node, sourceURL, lineNumber); + return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), node, sourceURL, lineNumber, mainThreadNormalWorld()); } PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attribute* attr) @@ -93,7 +93,7 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attri lineNumber = scriptController->eventHandlerLineNumber(); sourceURL = frame->document()->url().string(); - return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber); + return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber, mainThreadNormalWorld()); } String getEventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* eventListener) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp index 46e80ac..91b2a57 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp @@ -123,7 +123,8 @@ ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions) if (callType == CallTypeNone) return ScriptValue(); - JSValue result = JSC::call(m_exec, function, callType, callData, thisObject, m_arguments); + // FIXME: Should this function take a worldID? - only used by inspector? + JSValue result = callInWorld(m_exec, function, callType, callData, thisObject, m_arguments, debuggerWorld()); if (m_exec->hadException()) { if (reportExceptions) reportException(m_exec, m_exec->exception()); @@ -161,7 +162,8 @@ ScriptObject ScriptFunctionCall::construct(bool& hadException, bool reportExcept if (constructType == ConstructTypeNone) return ScriptObject(); - JSValue result = JSC::construct(m_exec, constructor, constructType, constructData, m_arguments); + // FIXME: Currently this method constructs objects in debuggerWorld(). We could use the current world, or pass a worldID to this function? + JSValue result = constructInWorld(m_exec, constructor, constructType, constructData, m_arguments, debuggerWorld()); if (m_exec->hadException()) { if (reportExceptions) reportException(m_exec, m_exec->exception()); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp index b48556e..313530f 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp @@ -72,7 +72,7 @@ bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObj if (!frame) return false; - JSDOMGlobalObject* globalObject = toJSDOMWindow(frame); + JSDOMGlobalObject* globalObject = toJSDOMWindow(frame, debuggerWorld()); ExecState* exec = globalObject->globalExec(); JSLock lock(SilenceAssertionsOnly); @@ -89,7 +89,7 @@ bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObjec Frame* frame = storage->frame(); ASSERT(frame); - JSDOMGlobalObject* globalObject = toJSDOMWindow(frame); + JSDOMGlobalObject* globalObject = toJSDOMWindow(frame, debuggerWorld()); ExecState* exec = globalObject->globalExec(); JSLock lock(SilenceAssertionsOnly); @@ -116,7 +116,7 @@ bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedO { ASSERT(domWindow); - JSDOMWindow* window = toJSDOMWindow(domWindow->frame()); + JSDOMWindow* window = toJSDOMWindow(domWindow->frame(), debuggerWorld()); ExecState* exec = window->globalExec(); JSLock lock(SilenceAssertionsOnly); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptSourceCode.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptSourceCode.h index 1b05ded..32d6298 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptSourceCode.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptSourceCode.h @@ -44,6 +44,7 @@ public: ScriptSourceCode(const String& source, const KURL& url = KURL(), int startLine = 1) : m_provider(StringSourceProvider::create(source, url.isNull() ? String() : url.string())) , m_code(m_provider, startLine) + , m_url(url) { } @@ -59,10 +60,17 @@ public: const String& source() const { return m_provider->source(); } + int startLine() const { return m_code.firstLine(); } + + const KURL& url() const { return m_url; } + private: RefPtr<ScriptSourceProvider> m_provider; JSC::SourceCode m_code; + + KURL m_url; + }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp index 8bfa33d..60ba2a0 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp @@ -32,6 +32,7 @@ #include "ScriptState.h" #include "Frame.h" +#include "JSDOMWindowBase.h" #include "Node.h" #include "Page.h" @@ -49,12 +50,12 @@ ScriptState* scriptStateFromNode(Node* node) return 0; if (!frame->script()->isEnabled()) return 0; - return frame->script()->globalObject()->globalExec(); + return frame->script()->globalObject(mainThreadCurrentWorld())->globalExec(); } ScriptState* scriptStateFromPage(Page* page) { - return page->mainFrame()->script()->globalObject()->globalExec(); + return page->mainFrame()->script()->globalObject(mainThreadCurrentWorld())->globalExec(); } } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h index fa5c4a8..279234e 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h @@ -35,6 +35,7 @@ #include "JSDOMBinding.h" namespace WebCore { + class DOMWrapperWorld; class Node; class Page; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp b/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp index 3590dad..b66b0e8 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp @@ -52,6 +52,7 @@ WorkerScriptController::WorkerScriptController(WorkerContext* workerContext) , m_workerContext(workerContext) , m_executionForbidden(false) { + m_globalData->clientData = new WebCoreJSClientData(m_globalData.get()); } WorkerScriptController::~WorkerScriptController() @@ -122,7 +123,7 @@ ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, ExecState* exec = m_workerContextWrapper->globalExec(); m_workerContextWrapper->globalData()->timeoutChecker.start(); - Completion comp = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode.jsSourceCode(), m_workerContextWrapper); + Completion comp = evaluateInWorld(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode.jsSourceCode(), m_workerContextWrapper, currentWorld(exec)); m_workerContextWrapper->globalData()->timeoutChecker.stop(); if (comp.complType() == Normal || comp.complType() == ReturnValue) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.h b/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.h index bb33f60..c820cd9 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.h @@ -62,6 +62,9 @@ namespace WebCore { void setException(ScriptValue); void forbidExecution(); + + JSC::JSGlobalData* globalData() { return m_globalData.get(); } + private: void initScriptIfNeeded() { diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm index ff7b52f..d8367ac 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -292,7 +292,7 @@ sub GenerateGetOwnPropertySlotBody my @getOwnPropertySlotImpl = (); - if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection") { + if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") { push(@getOwnPropertySlotImpl, " ${namespaceMaybe}JSValue proto = prototype();\n"); push(@getOwnPropertySlotImpl, " if (proto.isObject() && static_cast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n"); push(@getOwnPropertySlotImpl, " return false;\n\n"); @@ -369,7 +369,7 @@ sub GenerateGetOwnPropertyDescriptorBody my @getOwnPropertyDescriptorImpl = (); - if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection") { + if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") { push(@getOwnPropertyDescriptorImpl, " ${namespaceMaybe}JSValue proto = prototype();\n"); push(@getOwnPropertyDescriptorImpl, " if (proto.isObject() && static_cast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n"); push(@getOwnPropertyDescriptorImpl, " return false;\n\n"); @@ -658,6 +658,12 @@ sub GenerateHeader # Custom lookupSetter function push(@headerContent, " virtual JSC::JSValue lookupSetter(JSC::ExecState*, const JSC::Identifier& propertyName);\n") if $dataNode->extendedAttributes->{"CustomLookupSetter"}; + # Override toBoolean to return false for objects that want to 'MasqueradesAsUndefined'. + if ($dataNode->extendedAttributes->{"MasqueradesAsUndefined"}) { + push(@headerContent, " virtual bool toBoolean(JSC::ExecState*) const { return false; };\n"); + $structureFlags{"JSC::MasqueradesAsUndefined"} = 1; + } + # Constructor object getter push(@headerContent, " static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*);\n") if $dataNode->extendedAttributes->{"GenerateConstructor"}; @@ -1188,19 +1194,21 @@ sub GenerateImplementation push(@implContent, " impl()->invalidateEventListeners();\n"); } - if ($interfaceName eq "Node") { - push(@implContent, " forgetDOMNode(impl()->document(), impl());\n"); - } else { - if ($podType) { - my $animatedType = $implClassName; - $animatedType =~ s/SVG/SVGAnimated/; + if (!$dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}) { + if ($interfaceName eq "Node") { + push(@implContent, " forgetDOMNode(this, impl(), impl()->document());\n"); + } else { + if ($podType) { + my $animatedType = $implClassName; + $animatedType =~ s/SVG/SVGAnimated/; - # Special case for JSSVGNumber - if ($codeGenerator->IsSVGAnimatedType($animatedType) and $podType ne "float") { - push(@implContent, " JSSVGDynamicPODTypeWrapperCache<$podType, $animatedType>::forgetWrapper(m_impl.get());\n"); + # Special case for JSSVGNumber + if ($codeGenerator->IsSVGAnimatedType($animatedType) and $podType ne "float") { + push(@implContent, " JSSVGDynamicPODTypeWrapperCache<$podType, $animatedType>::forgetWrapper(m_impl.get());\n"); + } } + push(@implContent, " forgetDOMObject(this, impl());\n"); } - push(@implContent, " forgetDOMObject(*Heap::heap(this)->globalData(), impl());\n"); } push(@implContent, "}\n\n"); @@ -1210,7 +1218,7 @@ sub GenerateImplementation # its own special handling rather than relying on the caching that Node normally does. if ($interfaceName eq "Document") { push(@implContent, "${className}::~$className()\n"); - push(@implContent, "{\n forgetDOMObject(*Heap::heap(this)->globalData(), static_cast<${implClassName}*>(impl()));\n}\n\n"); + push(@implContent, "{\n forgetDOMObject(this, static_cast<${implClassName}*>(impl()));\n}\n\n"); } if ($needsMarkChildren && !$dataNode->extendedAttributes->{"CustomMarkFunction"}) { @@ -1476,7 +1484,7 @@ sub GenerateImplementation } else { $implIncludes{"Frame.h"} = 1; $implIncludes{"JSDOMGlobalObject.h"} = 1; - push(@implContent, " JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());\n"); + push(@implContent, " JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec);\n"); push(@implContent, " if (!globalObject)\n"); push(@implContent, " return;\n"); } @@ -1700,7 +1708,7 @@ sub GenerateImplementation push(@implContent, " return toJS(exec, thisObj->globalObject(), static_cast<$implClassName*>(thisObj->impl())->item(slot.index()));\n"); } push(@implContent, "}\n"); - if ($interfaceName eq "HTMLCollection") { + if ($interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") { $implIncludes{"JSNode.h"} = 1; $implIncludes{"Node.h"} = 1; } @@ -1711,7 +1719,7 @@ sub GenerateImplementation push(@implContent, "{\n"); push(@implContent, " return jsNumber(exec, static_cast<$implClassName*>(impl())->item(index));\n"); push(@implContent, "}\n"); - if ($interfaceName eq "HTMLCollection") { + if ($interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") { $implIncludes{"JSNode.h"} = 1; $implIncludes{"Node.h"} = 1; } diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm index 28562f1..95b2aa2 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -215,7 +215,6 @@ sub AddClassForwardIfNeeded sub GetImplementationFileName { my $iface = shift; - return "HTMLCollection.h" if $iface eq "HTMLAllCollection"; return "Event.h" if $iface eq "DOMTimeStamp"; return "NamedAttrMap.h" if $iface eq "NamedNodeMap"; return "NameNodeList.h" if $iface eq "NodeList"; @@ -307,7 +306,7 @@ sub GenerateSetDOMException my $indent = shift; my $result = ""; - $result .= $indent . "if (ec) {\n"; + $result .= $indent . "if (UNLIKELY(ec)) {\n"; $result .= $indent . " V8Proxy::setDOMException(ec);\n"; $result .= $indent . " return v8::Handle<v8::Value>();\n"; $result .= $indent . "}\n"; @@ -622,15 +621,17 @@ END push(@implContentDecls, " if (!imp->document())\n"); push(@implContentDecls, " return v8::Undefined();\n"); } - push(@implContentDecls, " $nativeType v = "); - - push(@implContentDecls, "$getterString;\n"); if ($useExceptions) { + push(@implContentDecls, " $nativeType v = "); + push(@implContentDecls, "$getterString;\n"); push(@implContentDecls, GenerateSetDOMException(" ")); + $result = "v"; + $result .= ".release()" if (IsRefPtrType($returnType)); + } else { + # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary + $result = $getterString; } - - $result = "v"; } if (IsSVGTypeNeedingContextParameter($attrType) && !$skipContext) { @@ -646,7 +647,6 @@ END my $classIndex = uc($attrType); push(@implContentDecls, " return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper.release());\n"); } else { - $result .= ".release()" if (IsRefPtrType($attrType)); push(@implContentDecls, " " . ReturnNativeToJSValue($attribute->signature, $result, " ").";\n"); } @@ -784,7 +784,8 @@ END } if ($useExceptions) { - push(@implContentDecls, " V8Proxy::setDOMException(ec);\n"); + push(@implContentDecls, " if (UNLIKELY(ec))\n"); + push(@implContentDecls, " V8Proxy::setDOMException(ec);\n"); } if ($isPodType) { @@ -917,7 +918,7 @@ END if (TypeCanFailConversion($parameter)) { $implIncludes{"ExceptionCode.h"} = 1; push(@implContentDecls, -" if (!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ") {\n" . +" if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n" . " V8Proxy::setDOMException(TYPE_MISMATCH_ERR);\n" . " return v8::Handle<v8::Value>();\n" . " }\n"); @@ -926,7 +927,7 @@ END if ($parameter->extendedAttributes->{"IsIndex"}) { $implIncludes{"ExceptionCode.h"} = 1; push(@implContentDecls, -" if ($parameterName < 0) {\n" . +" if (UNLIKELY($parameterName < 0)) {\n" . " V8Proxy::setDOMException(INDEX_SIZE_ERR);\n" . " return v8::Handle<v8::Value>();\n" . " }\n"); @@ -1322,6 +1323,13 @@ END $template = "instance"; } + my $conditional = ""; + if ($attrExt->{"EnabledAtRuntime"}) { + # Only call Set()/SetAccessor() if this method should be enabled + $enable_function = $interfaceName . $codeGenerator->WK_ucfirst($function->signature->name); + $conditional = "if (V8Custom::v8${enable_function}Enabled())\n"; + } + if ($attrExt->{"DoNotCheckDomainSecurity"} && ($dataNode->extendedAttributes->{"CheckDomainSecurity"} || $interfaceName eq "DOMWindow")) { # Mark the accessor as ReadOnly and set it on the proto object so @@ -1342,7 +1350,7 @@ END push(@implContent, <<END); // $commentInfo - $template->SetAccessor( + $conditional $template->SetAccessor( v8::String::New("$name"), ${interfaceName}Internal::${name}AttrGetter, 0, @@ -1370,7 +1378,7 @@ END push(@implContent, <<END); // $commentInfo - ${template}->Set( + $conditional ${template}->Set( v8::String::New("$name"), $templateFunction, static_cast<v8::PropertyAttribute>($property_attributes)); @@ -1388,7 +1396,7 @@ END } # Set the class name. This is used when printing objects. - push(@implContent, " desc->SetClassName(v8::String::New(\"" . GetClassName(${interfaceName}) . "\"));\n"); + push(@implContent, " desc->SetClassName(v8::String::New(\"${interfaceName}\"));\n"); if ($has_constants) { push(@implContent, <<END); @@ -1530,6 +1538,9 @@ sub GenerateFunctionCallString() } $functionString .= ")"; + my $return = "result"; + my $returnIsRef = IsRefPtrType($returnType); + if ($nodeToReturn) { # Special case for insertBefore, replaceChild, removeChild and # appendChild functions from Node. @@ -1550,16 +1561,18 @@ sub GenerateFunctionCallString() $indent . "$functionString;\n"; } elsif ($returnsListItemPodType) { $result .= $indent . "RefPtr<SVGPODListItem<$nativeReturnType> > result = $functionString;\n"; - } else { + } elsif (@{$function->raisesExceptions} or $returnsPodType or $isPodType or IsSVGTypeNeedingContextParameter($returnType)) { $result .= $indent . $nativeReturnType . " result = $functionString;\n"; + } else { + # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary + $return = $functionString; + $returnIsRef = 0; } if (@{$function->raisesExceptions}) { $result .= GenerateSetDOMException($indent); } - my $return = "result"; - # If the return type is a POD type, separate out the wrapper generation if ($returnsListItemPodType) { $result .= $indent . "RefPtr<V8SVGPODTypeWrapper<" . $nativeReturnType . "> > wrapper = "; @@ -1602,7 +1615,7 @@ sub GenerateFunctionCallString() my $classIndex = uc($returnType); $result .= $indent . "return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper.release());\n"; } else { - $return .= ".release()" if (IsRefPtrType($returnType)); + $return .= ".release()" if ($returnIsRef); $result .= $indent . ReturnNativeToJSValue($function->signature, $return, $indent) . ";\n"; } @@ -1610,15 +1623,6 @@ sub GenerateFunctionCallString() } -# Get the class name used for printing javascript DOM-object wrappers. -sub GetClassName -{ - my $type = shift; - return "HTMLCollection" if $type eq "HTMLAllCollection"; - return $type; -} - - sub GetTypeFromSignature { my $signature = shift; @@ -1696,6 +1700,7 @@ sub IsRefPtrType return 1 if $type eq "EventListener"; return 1 if $type eq "FileList"; return 1 if $type eq "HTMLCollection"; + return 1 if $type eq "HTMLAllCollection"; return 1 if $type eq "HTMLDocument"; return 1 if $type eq "HTMLElement"; return 1 if $type eq "HTMLOptionsCollection"; @@ -2147,7 +2152,11 @@ sub ReturnNativeToJSValue # special case for non-DOM node interfaces if (IsDOMNodeType($type)) { - return "return V8DOMWrapper::convertNodeToV8Object($value)"; + if ($signature->extendedAttributes->{"ReturnsNew"}) { + return "return V8DOMWrapper::convertNewNodeToV8Object($value)"; + } else { + return "return V8DOMWrapper::convertNodeToV8Object($value)"; + } } if ($type eq "EventTarget" or $type eq "SVGElementInstance") { @@ -2159,7 +2168,7 @@ sub ReturnNativeToJSValue } if ($type eq "EventListener") { - return "return V8DOMWrapper::convertEventListenerToV8Object($value)"; + return "return V8DOMWrapper::convertEventListenerToV8Object(imp->scriptExecutionContext(), $value)"; } if ($type eq "SerializedScriptValue") { diff --git a/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp b/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp index 006f17f..6a89652 100644 --- a/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp @@ -34,6 +34,7 @@ #include "c_utility.h" #include "c_instance.h" #include "IdentifierRep.h" +#include "JSDOMBinding.h" #include "npruntime_impl.h" #include "npruntime_priv.h" #include "runtime_root.h" @@ -123,7 +124,7 @@ bool _NPN_InvokeDefault(NPP, NPObject* o, const NPVariant* args, uint32_t argCou getListFromVariantArgs(exec, args, argCount, rootObject, argList); ProtectedPtr<JSGlobalObject> globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); - JSValue resultV = call(exec, function, callType, callData, function, argList); + JSValue resultV = callInWorld(exec, function, callType, callData, function, argList, pluginWorld()); globalObject->globalData()->timeoutChecker.stop(); // Convert and return the result of the function call. @@ -173,7 +174,7 @@ bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant* getListFromVariantArgs(exec, args, argCount, rootObject, argList); ProtectedPtr<JSGlobalObject> globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); - JSValue resultV = call(exec, function, callType, callData, obj->imp, argList); + JSValue resultV = callInWorld(exec, function, callType, callData, obj->imp, argList, pluginWorld()); globalObject->globalData()->timeoutChecker.stop(); // Convert and return the result of the function call. @@ -203,7 +204,7 @@ bool _NPN_Evaluate(NPP, NPObject* o, NPString* s, NPVariant* variant) String scriptString = convertNPStringToUTF16(s); ProtectedPtr<JSGlobalObject> globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); - Completion completion = JSC::evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(scriptString)); + Completion completion = evaluateInWorld(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(scriptString), JSC::JSValue(), pluginWorld()); globalObject->globalData()->timeoutChecker.stop(); ComplType type = completion.complType(); @@ -443,7 +444,7 @@ bool _NPN_Construct(NPP, NPObject* o, const NPVariant* args, uint32_t argCount, getListFromVariantArgs(exec, args, argCount, rootObject, argList); ProtectedPtr<JSGlobalObject> globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); - JSValue resultV = construct(exec, constructor, constructType, constructData, argList); + JSValue resultV = constructInWorld(exec, constructor, constructType, constructData, argList, pluginWorld()); globalObject->globalData()->timeoutChecker.stop(); // Convert and return the result. diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm b/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm index eb4a6bd..cc28a75 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm @@ -29,6 +29,7 @@ #if ENABLE(MAC_JAVA_BRIDGE) #include "Frame.h" +#include "JSDOMBinding.h" #include "ScriptController.h" #include "StringSourceProvider.h" #include "WebCoreFrameView.h" @@ -302,7 +303,7 @@ jobject JavaJSObject::call(jstring methodName, jobjectArray args) const MarkedArgumentBuffer argList; getListFromJArray(exec, args, argList); rootObject->globalObject()->globalData()->timeoutChecker.start(); - JSValue result = JSC::call(exec, function, callType, callData, _imp, argList); + JSValue result = WebCore::callInWorld(exec, function, callType, callData, _imp, argList, WebCore::pluginWorld()); rootObject->globalObject()->globalData()->timeoutChecker.stop(); return convertValueToJObject(result); @@ -321,7 +322,7 @@ jobject JavaJSObject::eval(jstring script) const return 0; rootObject->globalObject()->globalData()->timeoutChecker.start(); - Completion completion = JSC::evaluate(rootObject->globalObject()->globalExec(), rootObject->globalObject()->globalScopeChain(), makeSource(JavaString(script))); + Completion completion = WebCore::evaluateInWorld(rootObject->globalObject()->globalExec(), rootObject->globalObject()->globalScopeChain(), makeSource(JavaString(script)), JSC::JSValue(), WebCore::pluginWorld()); rootObject->globalObject()->globalData()->timeoutChecker.stop(); ComplType type = completion.complType(); diff --git a/src/3rdparty/webkit/WebCore/bridge/npapi.h b/src/3rdparty/webkit/WebCore/bridge/npapi.h index 5d48b0d..c6cd557 100644 --- a/src/3rdparty/webkit/WebCore/bridge/npapi.h +++ b/src/3rdparty/webkit/WebCore/bridge/npapi.h @@ -56,6 +56,12 @@ # endif /* XP_WIN */ #endif /* _WIN32 */ +#ifdef __SYMBIAN32__ +# ifndef XP_SYMBIAN +# define XP_SYMBIAN 1 +# endif +#endif /* __SYMBIAN32__ */ + #ifdef __MWERKS__ # define _declspec __declspec # ifdef macintosh @@ -64,22 +70,15 @@ # endif /* XP_MAC */ # endif /* macintosh */ # ifdef __INTEL__ -# ifndef __SYMBIAN32__ +# ifndef XP_SYMBIAN # undef NULL -# endif -# ifndef XP_WIN -# define XP_WIN 1 -# endif /* __INTEL__ */ -# endif /* XP_PC */ +# ifndef XP_WIN +# define XP_WIN 1 +# endif /* XP_WIN */ +# endif /* XP_SYMBIAN */ +# endif /* __INTEL__ */ #endif /* __MWERKS__ */ -#ifdef __SYMBIAN32__ -# ifndef XP_SYMBIAN -# define XP_SYMBIAN 1 -# undef XP_WIN -# endif -#endif /* __SYMBIAN32__ */ - #if defined(__APPLE_CC__) && !defined(__MACOS_CLASSIC__) && !defined(XP_UNIX) # define XP_MACOSX #endif diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp index 3cb2156..6887325 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp @@ -458,7 +458,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type if (type == Date) { DateInstance* date = static_cast<DateInstance*>(object); WTF::GregorianDateTime gdt; - date->getUTCTime(gdt); + WTF::msToGregorianDateTime(date->internalNumber(), true, gdt); if (hint == QMetaType::QDateTime) { ret = QDateTime(QDate(gdt.year + 1900, gdt.month + 1, gdt.monthDay), QTime(gdt.hour, gdt.minute, gdt.second), Qt::UTC); dist = 0; @@ -834,9 +834,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con dt.isDST = -1; double ms = WTF::gregorianDateTimeToMS(dt, time.msec(), /*inputIsUTC*/ false); - DateInstance* instance = new (exec) DateInstance(exec->lexicalGlobalObject()->dateStructure()); - instance->setInternalValue(jsNumber(exec, trunc(ms))); - return instance; + return new (exec) DateInstance(exec, trunc(ms)); } if (type == QMetaType::QByteArray) { diff --git a/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp index 4e067ce..b8769f9 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -157,6 +157,7 @@ static const int computedProperties[] = { CSSPropertyWebkitBackgroundClip, CSSPropertyWebkitBackgroundComposite, CSSPropertyWebkitBackgroundOrigin, + CSSPropertyWebkitBackgroundSize, CSSPropertyWebkitBorderFit, CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderImage, @@ -260,30 +261,13 @@ static const int computedProperties[] = { CSSPropertyTextAnchor, CSSPropertyWritingMode, CSSPropertyGlyphOrientationHorizontal, - CSSPropertyGlyphOrientationVertical + CSSPropertyGlyphOrientationVertical, + CSSPropertyWebkitShadow #endif }; const unsigned numComputedProperties = sizeof(computedProperties) / sizeof(computedProperties[0]); -static PassRefPtr<CSSValue> valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID) -{ - if (!shadow) - return CSSPrimitiveValue::createIdentifier(CSSValueNone); - - RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); - for (const ShadowData* s = shadow; s; s = s->next) { - RefPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(s->x, CSSPrimitiveValue::CSS_PX); - RefPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(s->y, CSSPrimitiveValue::CSS_PX); - RefPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(s->blur, CSSPrimitiveValue::CSS_PX); - RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? 0 : CSSPrimitiveValue::create(s->spread, CSSPrimitiveValue::CSS_PX); - RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style == Normal ? 0 : CSSPrimitiveValue::createIdentifier(CSSValueInset); - RefPtr<CSSPrimitiveValue> color = CSSPrimitiveValue::createColor(s->color.rgb()); - list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release())); - } - return list.release(); -} - static int valueForRepeatRule(int rule) { switch (rule) { @@ -571,6 +555,26 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringK return CSSPrimitiveValue::create(style->fontDescription().computedPixelSize(), CSSPrimitiveValue::CSS_PX); } +PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, int id) const +{ + if (!shadow) + return CSSPrimitiveValue::createIdentifier(CSSValueNone); + + CSSPropertyID propertyID = static_cast<CSSPropertyID>(id); + + RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); + for (const ShadowData* s = shadow; s; s = s->next) { + RefPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(s->x, CSSPrimitiveValue::CSS_PX); + RefPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(s->y, CSSPrimitiveValue::CSS_PX); + RefPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(s->blur, CSSPrimitiveValue::CSS_PX); + RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? 0 : CSSPrimitiveValue::create(s->spread, CSSPrimitiveValue::CSS_PX); + RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style == Normal ? 0 : CSSPrimitiveValue::createIdentifier(CSSValueInset); + RefPtr<CSSPrimitiveValue> color = CSSPrimitiveValue::createColor(s->color.rgb()); + list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release())); + } + return list.release(); +} + PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID) const { return getPropertyCSSValue(propertyID, UpdateLayout); @@ -676,7 +680,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper if (style->backgroundImage()) return style->backgroundImage()->cssValue(); return CSSPrimitiveValue::createIdentifier(CSSValueNone); - case CSSPropertyBackgroundSize: { + case CSSPropertyBackgroundSize: + case CSSPropertyWebkitBackgroundSize: { EFillSizeType size = style->backgroundSizeType(); if (size == Contain) return CSSPrimitiveValue::createIdentifier(CSSValueContain); @@ -777,7 +782,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper case CSSPropertyWebkitBoxReflect: return valueForReflection(style->boxReflect()); case CSSPropertyWebkitBoxShadow: - return valueForShadow(style->boxShadow(), static_cast<CSSPropertyID>(propertyID)); + return valueForShadow(style->boxShadow(), propertyID); case CSSPropertyCaptionSide: return CSSPrimitiveValue::create(style->captionSide()); case CSSPropertyClear: @@ -1061,7 +1066,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper case CSSPropertyTextIndent: return CSSPrimitiveValue::create(style->textIndent()); case CSSPropertyTextShadow: - return valueForShadow(style->textShadow(), static_cast<CSSPropertyID>(propertyID)); + return valueForShadow(style->textShadow(), propertyID); case CSSPropertyTextRendering: return CSSPrimitiveValue::create(style->fontDescription().textRenderingMode()); case CSSPropertyTextOverflow: diff --git a/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.h b/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.h index c1f34c3..842a995 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.h +++ b/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.h @@ -27,6 +27,7 @@ namespace WebCore { class CSSMutableStyleDeclaration; +class ShadowData; enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true }; @@ -66,6 +67,8 @@ private: virtual String removeProperty(int propertyID, ExceptionCode&); virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&); + PassRefPtr<CSSValue> valueForShadow(const ShadowData*, int) const; + RefPtr<Node> m_node; }; diff --git a/src/3rdparty/webkit/WebCore/css/CSSParser.cpp b/src/3rdparty/webkit/WebCore/css/CSSParser.cpp index 10949dd..6024a5b 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSParser.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSParser.cpp @@ -873,6 +873,7 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyBackgroundPositionX: case CSSPropertyBackgroundPositionY: case CSSPropertyBackgroundSize: + case CSSPropertyWebkitBackgroundSize: case CSSPropertyBackgroundRepeat: case CSSPropertyBackgroundRepeatX: case CSSPropertyBackgroundRepeatY: @@ -1726,6 +1727,15 @@ void CSSParser::addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval) lval = rval; } +static bool parseBackgroundClip(CSSParserValue* parserValue, RefPtr<CSSValue>& cssValue) +{ + if (parserValue->id == CSSValueBorderBox || parserValue->id == CSSValuePaddingBox || parserValue->id == CSSValueWebkitText) { + cssValue = CSSPrimitiveValue::createIdentifier(parserValue->id); + return true; + } + return false; +} + const int cMaxFillProperties = 9; bool CSSParser::parseFillShorthand(int propId, const int* properties, int numProperties, bool important) @@ -1777,6 +1787,7 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro RefPtr<CSSValue> val1; RefPtr<CSSValue> val2; int propId1, propId2; + CSSParserValue* parserValue = m_valueList->current(); if (parseFillProperty(properties[i], propId1, propId2, val1, val2)) { parsedProperty[i] = found = true; addFillValue(values[i], val1.release()); @@ -1786,7 +1797,7 @@ bool CSSParser::parseFillShorthand(int propId, const int* properties, int numPro addFillValue(repeatYValue, val2.release()); if (properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin) { // Reparse the value as a clip, and see if we succeed. - if (parseFillProperty(CSSPropertyBackgroundClip, propId1, propId2, val1, val2)) + if (parseBackgroundClip(parserValue, val1)) addFillValue(clipValue, val1.release()); // The property parsed successfully. else addFillValue(clipValue, CSSInitialValue::createImplicit()); // Some value was used for origin that is not supported by clip. Just reset clip instead. @@ -2319,7 +2330,7 @@ void CSSParser::parseFillRepeat(RefPtr<CSSValue>& value1, RefPtr<CSSValue>& valu } } -PassRefPtr<CSSValue> CSSParser::parseFillSize(bool& allowComma) +PassRefPtr<CSSValue> CSSParser::parseFillSize(int propId, bool& allowComma) { allowComma = true; CSSParserValue* value = m_valueList->current(); @@ -2328,7 +2339,7 @@ PassRefPtr<CSSValue> CSSParser::parseFillSize(bool& allowComma) return CSSPrimitiveValue::createIdentifier(value->id); RefPtr<CSSPrimitiveValue> parsedValue1; - + if (value->id == CSSValueAuto) parsedValue1 = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_UNKNOWN); else { @@ -2336,8 +2347,9 @@ PassRefPtr<CSSValue> CSSParser::parseFillSize(bool& allowComma) return 0; parsedValue1 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit); } - - RefPtr<CSSPrimitiveValue> parsedValue2 = parsedValue1; + + CSSPropertyID property = static_cast<CSSPropertyID>(propId); + RefPtr<CSSPrimitiveValue> parsedValue2; if ((value = m_valueList->next())) { if (value->id == CSSValueAuto) parsedValue2 = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_UNKNOWN); @@ -2349,7 +2361,13 @@ PassRefPtr<CSSValue> CSSParser::parseFillSize(bool& allowComma) parsedValue2 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit); } } - + if (!parsedValue2) { + if (property == CSSPropertyWebkitBackgroundSize || property == CSSPropertyWebkitMaskSize) + parsedValue2 = parsedValue1; + else + parsedValue2 = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_UNKNOWN); + } + return CSSPrimitiveValue::create(Pair::create(parsedValue1.release(), parsedValue2.release())); } @@ -2425,10 +2443,8 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2, } break; case CSSPropertyBackgroundClip: - if (val->id == CSSValueBorderBox || val->id == CSSValuePaddingBox || val->id == CSSValueWebkitText) { - currValue = CSSPrimitiveValue::createIdentifier(val->id); + if (parseBackgroundClip(val, currValue)) m_valueList->next(); - } break; case CSSPropertyBackgroundOrigin: if (val->id == CSSValueBorderBox || val->id == CSSValuePaddingBox || val->id == CSSValueContentBox) { @@ -2470,8 +2486,9 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2, // parseFillRepeat advances the m_valueList pointer break; case CSSPropertyBackgroundSize: + case CSSPropertyWebkitBackgroundSize: case CSSPropertyWebkitMaskSize: { - currValue = parseFillSize(allowComma); + currValue = parseFillSize(propId, allowComma); if (currValue) m_valueList->next(); break; @@ -3736,7 +3753,11 @@ bool CSSParser::parseShadow(int propId, bool important) // Other operators aren't legal or we aren't done with the current shadow // value. Treat as invalid. return false; - +#if ENABLE(SVG) + // -webkit-shadow does not support multiple values. + if (static_cast<CSSPropertyID>(propId) == CSSPropertyWebkitShadow) + return false; +#endif // The value is good. Commit it. context.commitValue(); } else if (validUnit(val, FLength, true)) { @@ -5182,11 +5203,6 @@ static int cssPropertyID(const UChar* propertyName, unsigned length) const char* const opacity = "opacity"; name = opacity; length = strlen(opacity); - } else if (strcmp(buffer, "-webkit-background-size") == 0) { - // CSS Backgrounds/Borders. -webkit-background-size worked in Safari 4 and earlier. - const char* const backgroundSize = "background-size"; - name = backgroundSize; - length = strlen(backgroundSize); } else if (hasPrefix(buffer + 7, length - 7, "-border-")) { // -webkit-border-*-*-radius worked in Safari 4 and earlier. -webkit-border-radius syntax // differs from border-radius, so it is remains as a distinct property. diff --git a/src/3rdparty/webkit/WebCore/css/CSSParser.h b/src/3rdparty/webkit/WebCore/css/CSSParser.h index 1a156da..6d1bb32 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSParser.h +++ b/src/3rdparty/webkit/WebCore/css/CSSParser.h @@ -83,7 +83,7 @@ namespace WebCore { PassRefPtr<CSSValue> parseFillPositionXY(bool& xFound, bool& yFound); void parseFillPosition(RefPtr<CSSValue>&, RefPtr<CSSValue>&); void parseFillRepeat(RefPtr<CSSValue>&, RefPtr<CSSValue>&); - PassRefPtr<CSSValue> parseFillSize(bool &allowComma); + PassRefPtr<CSSValue> parseFillSize(int propId, bool &allowComma); bool parseFillProperty(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&); bool parseFillShorthand(int propId, const int* properties, int numProperties, bool important); diff --git a/src/3rdparty/webkit/WebCore/css/CSSParserValues.h b/src/3rdparty/webkit/WebCore/css/CSSParserValues.h index 242cda8..1e9767a 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSParserValues.h +++ b/src/3rdparty/webkit/WebCore/css/CSSParserValues.h @@ -88,7 +88,7 @@ private: unsigned m_variablesCount; }; -struct CSSParserFunction { +struct CSSParserFunction : FastAllocBase { CSSParserString name; CSSParserValueList* args; diff --git a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h index 3616aa5..6f89df9 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h +++ b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h @@ -200,11 +200,11 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) case ListboxPart: m_value.ident = CSSValueListbox; break; -#if ENABLE(DATALIST) case ListButtonPart: +#if ENABLE(DATALIST) m_value.ident = CSSValueListButton; - break; #endif + break; case ListItemPart: m_value.ident = CSSValueListitem; break; @@ -378,6 +378,7 @@ template<> inline CSSPrimitiveValue::operator EFillBox() const case CSSValueContentBox: return ContentFillBox; case CSSValueText: + case CSSValueWebkitText: return TextFillBox; default: ASSERT_NOT_REACHED(); diff --git a/src/3rdparty/webkit/WebCore/css/CSSProperty.h b/src/3rdparty/webkit/WebCore/css/CSSProperty.h index 7af8348..b5635d0 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSProperty.h +++ b/src/3rdparty/webkit/WebCore/css/CSSProperty.h @@ -29,7 +29,7 @@ namespace WebCore { -class CSSProperty { +class CSSProperty : public FastAllocBase { public: CSSProperty(int propID, PassRefPtr<CSSValue> value, bool important = false, int shorthandID = 0, bool implicit = false) : m_id(propID) diff --git a/src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in b/src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in index 5ef6605..48a18e7 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in +++ b/src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in @@ -160,6 +160,10 @@ zoom -webkit-background-clip -webkit-background-composite -webkit-background-origin +# -webkit-background-size differs from background-size only in the interpretation of +# a single value: -webkit-background-size: l; is equivalent to background-size: l l; +# whereas background-size: l; is equivalent to background-size: l auto; +-webkit-background-size -webkit-binding -webkit-border-fit -webkit-border-horizontal-spacing diff --git a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp index 181e480..40627cf 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp @@ -2961,6 +2961,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) HANDLE_BACKGROUND_VALUE(origin, Origin, value) return; case CSSPropertyBackgroundSize: + case CSSPropertyWebkitBackgroundSize: HANDLE_BACKGROUND_VALUE(size, Size, value) return; case CSSPropertyWebkitMaskAttachment: diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp index e8492d4..1f19983 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp @@ -166,6 +166,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro return 0; } + case CSSPropertyWebkitShadow: + return valueForShadow(svgStyle->shadow(), propertyID); case CSSPropertyMarker: case CSSPropertyEnableBackground: case CSSPropertyColorProfile: diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp b/src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp index 0ae9fbc..8730e49 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp @@ -257,6 +257,11 @@ bool CSSParser::parseSVGValue(int propId, bool important) m_valueList->next(); } break; + case CSSPropertyWebkitShadow: + if (id == CSSValueNone) + valid_primitive = true; + else + return parseShadow(propId, important); /* shorthand properties */ case CSSPropertyMarker: diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in b/src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in index e400ffe..809eabe 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in @@ -46,3 +46,5 @@ glyph-orientation-vertical kerning text-anchor writing-mode + +-webkit-shadow diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp b/src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp index b81b4f2..7e4483f 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp @@ -37,6 +37,7 @@ #include "CSSPropertyNames.h" #include "CSSValueList.h" #include "Document.h" +#include "ShadowValue.h" #include "SVGColor.h" #include "SVGNames.h" #include "SVGPaint.h" @@ -526,6 +527,35 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value) // Silently ignoring this property for now // http://bugs.webkit.org/show_bug.cgi?id=6022 break; + case CSSPropertyWebkitShadow: { + if (isInherit) + return svgstyle->setShadow(m_parentStyle->svgStyle()->shadow() ? new ShadowData(*m_parentStyle->svgStyle()->shadow()) : 0); + if (isInitial || primitiveValue) // initial | none + return svgstyle->setShadow(0); + + if (!value->isValueList()) + return; + + float zoomFactor = m_style->effectiveZoom(); + + CSSValueList *list = static_cast<CSSValueList*>(value); + ASSERT(list->length() == 1); + ShadowValue* item = static_cast<ShadowValue*>(list->itemWithoutBoundsCheck(0)); + int x = item->x->computeLengthInt(style(), m_rootElementStyle, zoomFactor); + int y = item->y->computeLengthInt(style(), m_rootElementStyle, zoomFactor); + int blur = item->blur ? item->blur->computeLengthInt(style(), m_rootElementStyle, zoomFactor) : 0; + Color color; + if (item->color) + color = getColorFromPrimitiveValue(item->color.get()); + + // -webkit-shadow does should not have a spread or style + ASSERT(!item->spread); + ASSERT(!item->style); + + ShadowData* shadowData = new ShadowData(x, y, blur, 0, Normal, color.isValid() ? color : Color::transparent); + svgstyle->setShadow(shadowData); + return; + } default: // If you crash here, it's because you added a css property and are not handling it // in either this switch statement or the one in CSSStyleSelector::applyProperty diff --git a/src/3rdparty/webkit/WebCore/dom/Document.cpp b/src/3rdparty/webkit/WebCore/dom/Document.cpp index 475a8c1..4eb44f7 100644 --- a/src/3rdparty/webkit/WebCore/dom/Document.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Document.cpp @@ -58,6 +58,7 @@ #include "FrameLoader.h" #include "FrameTree.h" #include "FrameView.h" +#include "HTMLAllCollection.h" #include "HTMLAnchorElement.h" #include "HTMLBodyElement.h" #include "HTMLCanvasElement.h" @@ -511,6 +512,16 @@ Document::~Document() m_styleSheets->documentDestroyed(); } +Document::JSWrapperCache* Document::createWrapperCache(DOMWrapperWorld* world) +{ + JSWrapperCache* wrapperCache = new JSWrapperCache(); + m_wrapperCacheMap.set(world, wrapperCache); +#if USE(JSC) + world->rememberDocument(this); +#endif + return wrapperCache; +} + void Document::resetLinkColor() { m_linkColor = Color(0, 0, 238); @@ -943,7 +954,7 @@ Element* Document::elementFromPoint(int x, int y) const return 0; float zoomFactor = frame->pageZoomFactor(); - IntPoint point = roundedIntPoint(FloatPoint((x + view()->scrollX()) * zoomFactor, (y + view()->scrollY()) * zoomFactor)); + IntPoint point = roundedIntPoint(FloatPoint(x * zoomFactor + view()->scrollX(), y * zoomFactor + view()->scrollY())); if (!frameView->visibleContentRect().contains(point)) return 0; @@ -973,7 +984,7 @@ PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) return 0; float zoomFactor = frame->pageZoomFactor(); - IntPoint point = roundedIntPoint(FloatPoint((x + view()->scrollX()) * zoomFactor, (y + view()->scrollY()) * zoomFactor)); + IntPoint point = roundedIntPoint(FloatPoint(x * zoomFactor + view()->scrollX(), y * zoomFactor + view()->scrollY())); if (!frameView->visibleContentRect().contains(point)) return 0; @@ -3988,9 +3999,9 @@ PassRefPtr<HTMLCollection> Document::anchors() return HTMLCollection::create(this, DocAnchors); } -PassRefPtr<HTMLCollection> Document::all() +PassRefPtr<HTMLAllCollection> Document::all() { - return HTMLCollection::create(this, DocAll); + return HTMLAllCollection::create(this); } PassRefPtr<HTMLCollection> Document::windowNamedItems(const String &name) diff --git a/src/3rdparty/webkit/WebCore/dom/Document.h b/src/3rdparty/webkit/WebCore/dom/Document.h index 09bba58..0632be1 100644 --- a/src/3rdparty/webkit/WebCore/dom/Document.h +++ b/src/3rdparty/webkit/WebCore/dom/Document.h @@ -71,6 +71,7 @@ namespace WebCore { class HitTestRequest; class HTMLCanvasElement; class HTMLCollection; + class HTMLAllCollection; class HTMLDocument; class HTMLElement; class HTMLFormElement; @@ -79,6 +80,7 @@ namespace WebCore { class HTMLMapElement; class InspectorTimelineAgent; class IntPoint; + class DOMWrapperWorld; class JSNode; class MouseEventWithHitTestResults; class NodeFilter; @@ -315,12 +317,13 @@ public: PassRefPtr<HTMLCollection> links(); PassRefPtr<HTMLCollection> forms(); PassRefPtr<HTMLCollection> anchors(); - PassRefPtr<HTMLCollection> all(); PassRefPtr<HTMLCollection> objects(); PassRefPtr<HTMLCollection> scripts(); PassRefPtr<HTMLCollection> windowNamedItems(const String& name); PassRefPtr<HTMLCollection> documentNamedItems(const String& name); + PassRefPtr<HTMLAllCollection> all(); + // Find first anchor with the given name. // First searches for an element with the given ID, but if that fails, then looks // for an anchor with the given name. ID matching is always case sensitive, but @@ -819,7 +822,15 @@ public: virtual void postTask(PassRefPtr<Task>); // Executes the task on context's thread asynchronously. typedef HashMap<WebCore::Node*, JSNode*> JSWrapperCache; - JSWrapperCache& wrapperCache() { return m_wrapperCache; } + typedef HashMap<DOMWrapperWorld*, JSWrapperCache*> JSWrapperCacheMap; + JSWrapperCacheMap& wrapperCacheMap() { return m_wrapperCacheMap; } + JSWrapperCache* getWrapperCache(DOMWrapperWorld* world) + { + if (JSWrapperCache* wrapperCache = m_wrapperCacheMap.get(world)) + return wrapperCache; + return createWrapperCache(world); + } + JSWrapperCache* createWrapperCache(DOMWrapperWorld*); virtual void finishedParsing(); @@ -1137,7 +1148,7 @@ private: unsigned m_numNodeListCaches; - JSWrapperCache m_wrapperCache; + JSWrapperCacheMap m_wrapperCacheMap; #if ENABLE(DATABASE) RefPtr<DatabaseThread> m_databaseThread; diff --git a/src/3rdparty/webkit/WebCore/dom/Element.cpp b/src/3rdparty/webkit/WebCore/dom/Element.cpp index 621c63a..9edde25 100644 --- a/src/3rdparty/webkit/WebCore/dom/Element.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Element.cpp @@ -1414,7 +1414,7 @@ KURL Element::getURLAttribute(const QualifiedName& name) const ASSERT(isURLAttribute(attribute)); } #endif - return document()->completeURL(getAttribute(name)); + return document()->completeURL(deprecatedParseURL(getAttribute(name))); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp b/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp index ceb5221..694e78a 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp +++ b/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp @@ -192,9 +192,16 @@ bool EventTarget::removeEventListener(const AtomicString& eventType, EventListen // Notify firing events planning to invoke the listener at 'index' that // they have one less listener to invoke. - for (size_t i = 0; i < d->firingEventEndIterators.size(); ++i) { - if (eventType == *d->firingEventEndIterators[i].eventType && index < *d->firingEventEndIterators[i].value) - --*d->firingEventEndIterators[i].value; + for (size_t i = 0; i < d->firingEventIterators.size(); ++i) { + if (eventType != d->firingEventIterators[i].eventType) + continue; + + if (index >= d->firingEventIterators[i].end) + continue; + + --d->firingEventIterators[i].end; + if (index <= d->firingEventIterators[i].iterator) + --d->firingEventIterators[i].iterator; } return true; @@ -232,6 +239,10 @@ bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec) ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; return false; } + + if (!scriptExecutionContext()) + return false; + return dispatchEvent(event); } @@ -259,9 +270,15 @@ bool EventTarget::fireEventListeners(Event* event) RefPtr<EventTarget> protect = this; + // Fire all listeners registered for this event. Don't fire listeners removed + // during event dispatch. Also, don't fire event listeners added during event + // dispatch. Conveniently, all new event listeners will be added after 'end', + // so iterating to 'end' naturally excludes new event listeners. + + size_t i = 0; size_t end = entry.size(); - d->firingEventEndIterators.append(FiringEventEndIterator(&event->type(), &end)); - for (size_t i = 0; i < end; ++i) { + d->firingEventIterators.append(FiringEventIterator(event->type(), i, end)); + for ( ; i < end; ++i) { RegisteredEventListener& registeredListener = entry[i]; if (event->eventPhase() == Event::CAPTURING_PHASE && !registeredListener.useCapture) continue; @@ -271,7 +288,7 @@ bool EventTarget::fireEventListeners(Event* event) // event listeners, even though that violates some versions of the DOM spec. registeredListener.listener->handleEvent(scriptExecutionContext(), event); } - d->firingEventEndIterators.removeLast(); + d->firingEventIterators.removeLast(); return !event->defaultPrevented(); } @@ -298,8 +315,10 @@ void EventTarget::removeAllEventListeners() // Notify firing events planning to invoke the listener at 'index' that // they have one less listener to invoke. - for (size_t i = 0; i < d->firingEventEndIterators.size(); ++i) - *d->firingEventEndIterators[i].value = 0; + for (size_t i = 0; i < d->firingEventIterators.size(); ++i) { + d->firingEventIterators[i].iterator = 0; + d->firingEventIterators[i].end = 0; + } } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/EventTarget.h b/src/3rdparty/webkit/WebCore/dom/EventTarget.h index 2d612e1..9a1975c 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventTarget.h +++ b/src/3rdparty/webkit/WebCore/dom/EventTarget.h @@ -61,24 +61,26 @@ namespace WebCore { typedef int ExceptionCode; - struct FiringEventEndIterator { - FiringEventEndIterator(const AtomicString* eventType, size_t* value) + struct FiringEventIterator { + FiringEventIterator(const AtomicString& eventType, size_t& iterator, size_t& end) : eventType(eventType) - , value(value) + , iterator(iterator) + , end(end) { } - - const AtomicString* eventType; - size_t* value; + + const AtomicString& eventType; + size_t& iterator; + size_t& end; }; - typedef Vector<FiringEventEndIterator, 1> FiringEventEndIteratorVector; + typedef Vector<FiringEventIterator, 1> FiringEventIteratorVector; typedef Vector<RegisteredEventListener, 1> EventListenerVector; typedef HashMap<AtomicString, EventListenerVector> EventListenerMap; struct EventTargetData { EventListenerMap eventListenerMap; - FiringEventEndIteratorVector firingEventEndIterators; + FiringEventIteratorVector firingEventIterators; }; class EventTarget { @@ -209,7 +211,7 @@ namespace WebCore { EventTargetData* d = eventTargetData(); if (!d) return false; - return d->firingEventEndIterators.size() != 0; + return d->firingEventIterators.size() != 0; } inline bool EventTarget::hasEventListeners() diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp index 45d4e23..f7046e3 100644 --- a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp +++ b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp @@ -36,6 +36,10 @@ #include <wtf/MainThread.h> #include <wtf/PassRefPtr.h> +#if USE(JSC) +#include "JSDOMWindow.h" +#endif + namespace WebCore { class ProcessMessagesSoonTask : public ScriptExecutionContext::Task { @@ -195,4 +199,20 @@ ScriptExecutionContext::Task::~Task() { } +#if USE(JSC) +JSC::JSGlobalData* ScriptExecutionContext::globalData() +{ + if (isDocument()) + return JSDOMWindow::commonJSGlobalData(); + +#if ENABLE(WORKERS) + if (isWorkerContext()) + return static_cast<WorkerContext*>(this)->script()->globalData(); +#endif + + ASSERT_NOT_REACHED(); + return 0; +} +#endif + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h index bb78b6f..398afec 100644 --- a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h +++ b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h @@ -104,6 +104,10 @@ namespace WebCore { void removeTimeout(int timeoutId); DOMTimer* findTimeout(int timeoutId); +#if USE(JSC) + JSC::JSGlobalData* globalData(); +#endif + protected: // Explicitly override the security origin for this script context. // Note: It is dangerous to change the security origin of a script context diff --git a/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp b/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp index 49713ba..3d2a549 100644 --- a/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp +++ b/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp @@ -479,12 +479,14 @@ bool SelectElement::appendFormData(SelectElementData& data, Element* element, Fo // We return the first one if it was a combobox select if (!successful && !data.multiple() && data.size() <= 1 && items.size()) { OptionElement* optionElement = toOptionElement(items[0]); - const AtomicString& value = optionElement->value(); - if (value.isNull()) - list.appendData(name, optionElement->text().stripWhiteSpace()); - else - list.appendData(name, value); - successful = true; + if (optionElement) { + const AtomicString& value = optionElement->value(); + if (value.isNull()) + list.appendData(name, optionElement->text().stripWhiteSpace()); + else + list.appendData(name, value); + successful = true; + } } return successful; @@ -874,13 +876,19 @@ void SelectElement::typeAheadFind(SelectElementData& data, Element* element, Key int index = (optionToListIndex(data, element, selected >= 0 ? selected : 0) + searchStartOffset) % itemCount; ASSERT(index >= 0); + // Compute a case-folded copy of the prefix string before beginning the search for + // a matching element. This code uses foldCase to work around the fact that + // String::startWith does not fold non-ASCII characters. This code can be changed + // to use startWith once that is fixed. + String prefixWithCaseFolded(prefix.foldCase()); for (int i = 0; i < itemCount; ++i, index = (index + 1) % itemCount) { OptionElement* optionElement = toOptionElement(items[index]); if (!optionElement || items[index]->disabled()) continue; + // Fold the option string and check if its prefix is equal to the folded prefix. String text = optionElement->textIndentedToRespectGroupLabel(); - if (stripLeadingWhiteSpace(text).startsWith(prefix, false)) { + if (stripLeadingWhiteSpace(text).foldCase().startsWith(prefixWithCaseFolded)) { setSelectedIndex(data, element, listToOptionIndex(data, element, index)); if (!data.usesMenuList()) listBoxOnChange(data, element); diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp index 543927d..30d39e0 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp @@ -79,15 +79,41 @@ bool XMLTokenizer::isWMLDocument() const } #endif -void XMLTokenizer::setCurrentNode(Node* n) +void XMLTokenizer::pushCurrentNode(Node* n) { - bool nodeNeedsReference = n && n != m_doc; - if (nodeNeedsReference) - n->ref(); - if (m_currentNodeIsReferenced) - m_currentNode->deref(); + ASSERT(n); + ASSERT(m_currentNode); + if (n != m_doc) + n->ref(); + m_currentNodeStack.append(m_currentNode); m_currentNode = n; - m_currentNodeIsReferenced = nodeNeedsReference; +} + +void XMLTokenizer::popCurrentNode() +{ + ASSERT(m_currentNode); + ASSERT(m_currentNodeStack.size()); + + if (m_currentNode != m_doc) + m_currentNode->deref(); + + m_currentNode = m_currentNodeStack.last(); + m_currentNodeStack.removeLast(); +} + +void XMLTokenizer::clearCurrentNodeStack() +{ + if (m_currentNode && m_currentNode != m_doc) + m_currentNode->deref(); + m_currentNode = 0; + + if (m_currentNodeStack.size()) { // Aborted parsing. + for (size_t i = m_currentNodeStack.size() - 1; i != 0; --i) + m_currentNodeStack[i]->deref(); + if (m_currentNodeStack[0] && m_currentNodeStack[0] != m_doc) + m_currentNodeStack[0]->deref(); + m_currentNodeStack.clear(); + } } void XMLTokenizer::write(const SegmentedString& s, bool /*appendData*/) @@ -143,7 +169,7 @@ bool XMLTokenizer::enterText() RefPtr<Node> newNode = Text::create(m_doc, ""); if (!m_currentNode->addChild(newNode.get())) return false; - setCurrentNode(newNode.get()); + pushCurrentNode(newNode.get()); return true; } @@ -173,10 +199,7 @@ void XMLTokenizer::exitText() if (m_view && m_currentNode && !m_currentNode->attached()) m_currentNode->attach(); - // FIXME: What's the right thing to do if the parent is really 0? - // Just leaving the current node set to the text node doesn't make much sense. - if (Node* par = m_currentNode->parentNode()) - setCurrentNode(par); + popCurrentNode(); } void XMLTokenizer::end() @@ -190,7 +213,7 @@ void XMLTokenizer::end() m_doc->updateStyleSelector(); } - setCurrentNode(0); + clearCurrentNodeStack(); if (!m_parsingFragment) m_doc->finishedParsing(); } diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h index 019a831..e1ee09f 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h @@ -124,7 +124,10 @@ public: friend bool parseXMLDocumentFragment(const String& chunk, DocumentFragment* fragment, Element* parent); void initializeParserContext(const char* chunk = 0); - void setCurrentNode(Node*); + + void pushCurrentNode(Node*); + void popCurrentNode(); + void clearCurrentNodeStack(); void insertErrorMessageBlock(); @@ -148,7 +151,7 @@ public: Vector<xmlChar> m_bufferedText; #endif Node* m_currentNode; - bool m_currentNodeIsReferenced; + Vector<Node*> m_currentNodeStack; bool m_sawError; bool m_sawXSLTransform; diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp index 6cc0a0c..9aa0961 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp @@ -530,7 +530,6 @@ XMLTokenizer::XMLTokenizer(Document* _doc, FrameView* _view) , m_context(0) , m_pendingCallbacks(new PendingCallbacks) , m_currentNode(_doc) - , m_currentNodeIsReferenced(false) , m_sawError(false) , m_sawXSLTransform(false) , m_sawFirstElement(false) @@ -557,7 +556,6 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) , m_context(0) , m_pendingCallbacks(new PendingCallbacks) , m_currentNode(fragment) - , m_currentNodeIsReferenced(fragment) , m_sawError(false) , m_sawXSLTransform(false) , m_sawFirstElement(false) @@ -576,8 +574,7 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) , m_scriptStartLine(0) , m_parsingFragment(true) { - if (fragment) - fragment->ref(); + fragment->ref(); if (m_doc) m_doc->ref(); @@ -614,7 +611,7 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) XMLTokenizer::~XMLTokenizer() { - setCurrentNode(0); + clearCurrentNodeStack(); if (m_parsingFragment && m_doc) m_doc->deref(); if (m_pendingScript) @@ -801,7 +798,7 @@ void XMLTokenizer::startElementNs(const xmlChar* xmlLocalName, const xmlChar* xm return; } - setCurrentNode(newElement.get()); + pushCurrentNode(newElement.get()); if (m_view && !newElement->attached()) newElement->attach(); @@ -822,22 +819,29 @@ void XMLTokenizer::endElementNs() exitText(); Node* n = m_currentNode; - RefPtr<Node> parent = n->parentNode(); n->finishParsingChildren(); if (!n->isElementNode() || !m_view) { - setCurrentNode(parent.get()); + popCurrentNode(); return; } Element* element = static_cast<Element*>(n); + + // The element's parent may have already been removed from document. + // Parsing continues in this case, but scripts aren't executed. + if (!element->inDocument()) { + popCurrentNode(); + return; + } + ScriptElement* scriptElement = toScriptElement(element); if (!scriptElement) { - setCurrentNode(parent.get()); + popCurrentNode(); return; } - // don't load external scripts for standalone documents (for now) + // Don't load external scripts for standalone documents (for now). ASSERT(!m_pendingScript); m_requestingScript = true; @@ -865,7 +869,7 @@ void XMLTokenizer::endElementNs() m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); } m_requestingScript = false; - setCurrentNode(parent.get()); + popCurrentNode(); } void XMLTokenizer::characters(const xmlChar* s, int len) diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp index 65cbc21..c6e73ba 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp @@ -85,7 +85,6 @@ XMLTokenizer::XMLTokenizer(Document* _doc, FrameView* _view) , m_view(_view) , m_wroteText(false) , m_currentNode(_doc) - , m_currentNodeIsReferenced(false) , m_sawError(false) , m_sawXSLTransform(false) , m_sawFirstElement(false) @@ -114,7 +113,6 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) , m_view(0) , m_wroteText(false) , m_currentNode(fragment) - , m_currentNodeIsReferenced(fragment) , m_sawError(false) , m_sawXSLTransform(false) , m_sawFirstElement(false) @@ -133,8 +131,7 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) , m_scriptStartLine(0) , m_parsingFragment(true) { - if (fragment) - fragment->ref(); + fragment->ref(); if (m_doc) m_doc->ref(); @@ -188,7 +185,7 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement) XMLTokenizer::~XMLTokenizer() { - setCurrentNode(0); + clearCurrentNodeStack(); if (m_parsingFragment && m_doc) m_doc->deref(); if (m_pendingScript) @@ -569,7 +566,7 @@ void XMLTokenizer::parseStartElement() return; } - setCurrentNode(newElement.get()); + pushCurrentNode(newElement.get()); if (m_view && !newElement->attached()) newElement->attach(); @@ -582,18 +579,26 @@ void XMLTokenizer::parseEndElement() exitText(); Node* n = m_currentNode; - RefPtr<Node> parent = n->parentNode(); n->finishParsingChildren(); if (!n->isElementNode() || !m_view) { - setCurrentNode(parent.get()); + if (!m_currentNodeStack.isEmpty()) + popCurrentNode(); return; } Element* element = static_cast<Element*>(n); + + // The element's parent may have already been removed from document. + // Parsing continues in this case, but scripts aren't executed. + if (!element->inDocument()) { + popCurrentNode(); + return; + } + ScriptElement* scriptElement = toScriptElement(element); if (!scriptElement) { - setCurrentNode(parent.get()); + popCurrentNode(); return; } @@ -625,7 +630,7 @@ void XMLTokenizer::parseEndElement() m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); } m_requestingScript = false; - setCurrentNode(parent.get()); + popCurrentNode(); } void XMLTokenizer::parseCharacters() diff --git a/src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp b/src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp index 89d862f..7a8f025 100644 --- a/src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/ApplyStyleCommand.cpp @@ -334,6 +334,38 @@ static void diffTextDecorations(CSSMutableStyleDeclaration* style, int propertID setTextDecorationProperty(style, newTextDecoration.get(), propertID); } +static bool fontWeightIsBold(CSSStyleDeclaration* style) +{ + ASSERT(style); + RefPtr<CSSValue> fontWeight = style->getPropertyCSSValue(CSSPropertyFontWeight); + + if (!fontWeight) + return false; + if (!fontWeight->isPrimitiveValue()) + return false; + + // Because b tag can only bold text, there are only two states in plain html: bold and not bold. + // Collapse all other values to either one of these two states for editing purposes. + switch (static_cast<CSSPrimitiveValue*>(fontWeight.get())->getIdent()) { + case CSSValue100: + case CSSValue200: + case CSSValue300: + case CSSValue400: + case CSSValue500: + case CSSValueNormal: + return false; + case CSSValueBold: + case CSSValue600: + case CSSValue700: + case CSSValue800: + case CSSValue900: + return true; + } + + ASSERT_NOT_REACHED(); // For CSSValueBolder and CSSValueLighter + return false; // Make compiler happy +} + RefPtr<CSSMutableStyleDeclaration> getPropertiesNotInComputedStyle(CSSStyleDeclaration* style, CSSComputedStyleDeclaration* computedStyle) { ASSERT(style); @@ -345,6 +377,9 @@ RefPtr<CSSMutableStyleDeclaration> getPropertiesNotInComputedStyle(CSSStyleDecla diffTextDecorations(result.get(), CSSPropertyTextDecoration, computedTextDecorationsInEffect.get()); diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect, computedTextDecorationsInEffect.get()); + if (fontWeightIsBold(result.get()) == fontWeightIsBold(computedStyle)) + result->removeProperty(CSSPropertyFontWeight); + return result; } @@ -352,7 +387,6 @@ RefPtr<CSSMutableStyleDeclaration> getPropertiesNotInComputedStyle(CSSStyleDecla // e.g. when a user inserts a new paragraph, all properties listed here must be copied to the new paragraph. // FIXME: The current editingStyleProperties contains all inheritableProperties but we may not need to preserve all inheritable properties static const int editingStyleProperties[] = { - CSSPropertyBackgroundColor, // CSS inheritable properties CSSPropertyBorderCollapse, CSSPropertyColor, diff --git a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp index 0496a8f..1617be8 100644 --- a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.cpp @@ -20,7 +20,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -71,7 +71,7 @@ namespace WebCore { using namespace HTMLNames; -CompositeEditCommand::CompositeEditCommand(Document *document) +CompositeEditCommand::CompositeEditCommand(Document *document) : EditCommand(document) { } @@ -396,7 +396,7 @@ void CompositeEditCommand::rebalanceWhitespaceAt(const Position& position) Node* node = position.node(); if (!node || !node->isTextNode()) return; - Text* textNode = static_cast<Text*>(node); + Text* textNode = static_cast<Text*>(node); if (textNode->length() == 0) return; @@ -739,6 +739,129 @@ void CompositeEditCommand::pushPartiallySelectedAnchorElementsDown() setEndingSelection(originalSelection); } +// Clone the paragraph between start and end under blockElement, +// preserving the hierarchy up to outerNode. + +void CompositeEditCommand::cloneParagraphUnderNewElement(Position& start, Position& end, Node* outerNode, Element* blockElement) +{ + // First we clone the outerNode + + RefPtr<Node> lastNode = outerNode->cloneNode(isTableElement(outerNode)); + appendNode(lastNode, blockElement); + + if (start.node() != outerNode) { + Vector<RefPtr<Node> > ancestors; + + // Insert each node from innerNode to outerNode (excluded) in a list. + for (Node* n = start.node(); n && n != outerNode; n = n->parentNode()) + ancestors.append(n); + + // Clone every node between start.node() and outerBlock. + + for (size_t i = ancestors.size(); i != 0; --i) { + Node* item = ancestors[i - 1].get(); + RefPtr<Node> child = item->cloneNode(isTableElement(item)); + appendNode(child, static_cast<Element *>(lastNode.get())); + lastNode = child.release(); + } + } + + // Handle the case of paragraphs with more than one node, + // cloning all the siblings until end.node() is reached. + + if (start.node() != end.node()) { + for (Node* n = start.node()->nextSibling(); n != NULL; n = n->nextSibling()) { + RefPtr<Node> clonedNode = n->cloneNode(true); + insertNodeAfter(clonedNode, lastNode); + lastNode = clonedNode.release(); + if (n == end.node()) + break; + } + } +} + + +// There are bugs in deletion when it removes a fully selected table/list. +// It expands and removes the entire table/list, but will let content +// before and after the table/list collapse onto one line. +// Deleting a paragraph will leave a placeholder. Remove it (and prune +// empty or unrendered parents). + +void CompositeEditCommand::cleanupAfterDeletion() +{ + VisiblePosition caretAfterDelete = endingSelection().visibleStart(); + if (isStartOfParagraph(caretAfterDelete) && isEndOfParagraph(caretAfterDelete)) { + // Note: We want the rightmost candidate. + Position position = caretAfterDelete.deepEquivalent().downstream(); + Node* node = position.node(); + // Normally deletion will leave a br as a placeholder. + if (node->hasTagName(brTag)) + removeNodeAndPruneAncestors(node); + // If the selection to move was empty and in an empty block that + // doesn't require a placeholder to prop itself open (like a bordered + // div or an li), remove it during the move (the list removal code + // expects this behavior). + else if (isBlock(node)) + removeNodeAndPruneAncestors(node); + else if (lineBreakExistsAtPosition(position)) { + // There is a preserved '\n' at caretAfterDelete. + // We can safely assume this is a text node. + Text* textNode = static_cast<Text*>(node); + if (textNode->length() == 1) + removeNodeAndPruneAncestors(node); + else + deleteTextFromNode(textNode, position.deprecatedEditingOffset(), 1); + } + } +} + +// This is a version of moveParagraph that preserves style by keeping the original markup +// It is currently used only by IndentOutdentCommand but it is meant to be used in the +// future by several other commands such as InsertList and the align commands. +// The blockElement parameter is the element to move the paragraph to, +// outerNode is the top element of the paragraph hierarchy. + +void CompositeEditCommand::moveParagraphWithClones(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, Element* blockElement, Node* outerNode) +{ + ASSERT(outerNode); + ASSERT(blockElement); + + VisiblePosition beforeParagraph = startOfParagraphToMove.previous(); + VisiblePosition afterParagraph(endOfParagraphToMove.next()); + + // We upstream() the end and downstream() the start so that we don't include collapsed whitespace in the move. + // When we paste a fragment, spaces after the end and before the start are treated as though they were rendered. + Position start = startOfParagraphToMove.deepEquivalent().downstream(); + Position end = endOfParagraphToMove.deepEquivalent().upstream(); + + cloneParagraphUnderNewElement(start, end, outerNode, blockElement); + + setEndingSelection(VisibleSelection(start, end, DOWNSTREAM)); + deleteSelection(false, false, false, false); + + // There are bugs in deletion when it removes a fully selected table/list. + // It expands and removes the entire table/list, but will let content + // before and after the table/list collapse onto one line. + + cleanupAfterDeletion(); + + // Add a br if pruning an empty block level element caused a collapse. For example: + // foo^ + // <div>bar</div> + // baz + // Imagine moving 'bar' to ^. 'bar' will be deleted and its div pruned. That would + // cause 'baz' to collapse onto the line with 'foobar' unless we insert a br. + // Must recononicalize these two VisiblePositions after the pruning above. + beforeParagraph = VisiblePosition(beforeParagraph.deepEquivalent()); + afterParagraph = VisiblePosition(afterParagraph.deepEquivalent()); + + if (beforeParagraph.isNotNull() && !isTableElement(beforeParagraph.deepEquivalent().node()) && (!isEndOfParagraph(beforeParagraph) || beforeParagraph == afterParagraph)) { + // FIXME: Trim text between beforeParagraph and afterParagraph if they aren't equal. + insertNodeAt(createBreakElement(document()), beforeParagraph.deepEquivalent()); + } +} + + // This moves a paragraph preserving its style. void CompositeEditCommand::moveParagraph(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, const VisiblePosition& destination, bool preserveSelection, bool preserveStyle) { @@ -784,7 +907,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap VisiblePosition afterParagraph(endOfParagraphToMove.next()); // We upstream() the end and downstream() the start so that we don't include collapsed whitespace in the move. - // When we paste a fragment, spaces after the end and before the start are treated as though they were rendered. + // When we paste a fragment, spaces after the end and before the start are treated as though they were rendered. Position start = startOfParagraphToMove.deepEquivalent().downstream(); Position end = endOfParagraphToMove.deepEquivalent().upstream(); @@ -793,7 +916,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap Position endRangeCompliant = rangeCompliantEquivalent(end); RefPtr<Range> range = Range::create(document(), startRangeCompliant.node(), startRangeCompliant.deprecatedEditingOffset(), endRangeCompliant.node(), endRangeCompliant.deprecatedEditingOffset()); - // FIXME: This is an inefficient way to preserve style on nodes in the paragraph to move. It + // FIXME: This is an inefficient way to preserve style on nodes in the paragraph to move. It // shouldn't matter though, since moved paragraphs will usually be quite small. RefPtr<DocumentFragment> fragment = startOfParagraphToMove != endOfParagraphToMove ? createFragmentFromMarkup(document(), createMarkup(range.get(), 0, DoNotAnnotateForInterchange, true), "") : 0; @@ -813,42 +936,14 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap deleteSelection(false, false, false, false); ASSERT(destination.deepEquivalent().node()->inDocument()); - - // There are bugs in deletion when it removes a fully selected table/list. - // It expands and removes the entire table/list, but will let content - // before and after the table/list collapse onto one line. - - // Deleting a paragraph will leave a placeholder. Remove it (and prune - // empty or unrendered parents). - VisiblePosition caretAfterDelete = endingSelection().visibleStart(); - if (isStartOfParagraph(caretAfterDelete) && isEndOfParagraph(caretAfterDelete)) { - // Note: We want the rightmost candidate. - Position position = caretAfterDelete.deepEquivalent().downstream(); - Node* node = position.node(); - // Normally deletion will leave a br as a placeholder. - if (node->hasTagName(brTag)) - removeNodeAndPruneAncestors(node); - // If the selection to move was empty and in an empty block that - // doesn't require a placeholder to prop itself open (like a bordered - // div or an li), remove it during the move (the list removal code - // expects this behavior). - else if (isBlock(node)) - removeNodeAndPruneAncestors(node); - else if (lineBreakExistsAtVisiblePosition(caretAfterDelete)) { - // There is a preserved '\n' at caretAfterDelete. - Text* textNode = static_cast<Text*>(node); - if (textNode->length() == 1) - removeNodeAndPruneAncestors(node); - else - deleteTextFromNode(textNode, position.deprecatedEditingOffset(), 1); - } - } - // Add a br if pruning an empty block level element caused a collapse. For example: + cleanupAfterDeletion(); + + // Add a br if pruning an empty block level element caused a collapse. For example: // foo^ // <div>bar</div> // baz - // Imagine moving 'bar' to ^. 'bar' will be deleted and its div pruned. That would + // Imagine moving 'bar' to ^. 'bar' will be deleted and its div pruned. That would // cause 'baz' to collapse onto the line with 'foobar' unless we insert a br. // Must recononicalize these two VisiblePositions after the pruning above. beforeParagraph = VisiblePosition(beforeParagraph.deepEquivalent()); @@ -912,7 +1007,7 @@ bool CompositeEditCommand::breakOutOfEmptyListItem() removeNodePreservingChildren(listNode->parentNode()); newBlock = createListItemElement(document()); } - // If listNode does NOT appear at the end of the outer list item, then behave as if in a regular paragraph. + // If listNode does NOT appear at the end of the outer list item, then behave as if in a regular paragraph. } else if (blockEnclosingList->hasTagName(olTag) || blockEnclosingList->hasTagName(ulTag)) newBlock = createListItemElement(document()); } @@ -971,7 +1066,7 @@ bool CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph() // to hold the caret before the highest blockquote. insertNodeBefore(br, highestBlockquote); VisiblePosition atBR(Position(br.get(), 0)); - // If the br we inserted collapsed, for example foo<br><blockquote>...</blockquote>, insert + // If the br we inserted collapsed, for example foo<br><blockquote>...</blockquote>, insert // a second one. if (!isStartOfParagraph(atBR)) insertNodeBefore(createBreakElement(document()), br); @@ -1002,7 +1097,7 @@ bool CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph() return true; } -// Operations use this function to avoid inserting content into an anchor when at the start or the end of +// Operations use this function to avoid inserting content into an anchor when at the start or the end of // that anchor, as in NSTextView. // FIXME: This is only an approximation of NSTextViews insertion behavior, which varies depending on how // the caret was made. @@ -1022,7 +1117,7 @@ Position CompositeEditCommand::positionAvoidingSpecialElementBoundary(const Posi if (enclosingAnchor && !isBlock(enclosingAnchor)) { VisiblePosition firstInAnchor(firstDeepEditingPositionForNode(enclosingAnchor)); VisiblePosition lastInAnchor(lastDeepEditingPositionForNode(enclosingAnchor)); - // If visually just after the anchor, insert *inside* the anchor unless it's the last + // If visually just after the anchor, insert *inside* the anchor unless it's the last // VisiblePosition in the document, to match NSTextView. if (visiblePos == lastInAnchor) { // Make sure anchors are pushed down before avoiding them so that we don't diff --git a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.h b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.h index 2c6403e..0cceaaa 100644 --- a/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.h +++ b/src/3rdparty/webkit/WebCore/editing/CompositeEditCommand.h @@ -102,6 +102,9 @@ protected: void moveParagraph(const VisiblePosition&, const VisiblePosition&, const VisiblePosition&, bool preserveSelection = false, bool preserveStyle = true); void moveParagraphs(const VisiblePosition&, const VisiblePosition&, const VisiblePosition&, bool preserveSelection = false, bool preserveStyle = true); + void moveParagraphWithClones(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, Element* blockElement, Node* outerNode); + void cloneParagraphUnderNewElement(Position& start, Position& end, Node* outerNode, Element* blockElement); + void cleanupAfterDeletion(); bool breakOutOfEmptyListItem(); bool breakOutOfEmptyMailBlockquotedParagraph(); diff --git a/src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp b/src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp index abd0174..3379b3c 100644 --- a/src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/EditorCommand.cpp @@ -1291,10 +1291,10 @@ static String valueForeColor(Frame* frame, Event*) // Map of functions +struct CommandEntry { const char* name; EditorInternalCommand command; }; + static const CommandMap& createCommandMap() { - struct CommandEntry { const char* name; EditorInternalCommand command; }; - static const CommandEntry commands[] = { { "AlignCenter", { executeJustifyCenter, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, { "AlignJustified", { executeJustifyFull, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, diff --git a/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp b/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp index 84fa147..808a2f8 100644 --- a/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.cpp @@ -67,37 +67,6 @@ IndentOutdentCommand::IndentOutdentCommand(Document* document, EIndentType typeO { } -// This function is a workaround for moveParagraph's tendency to strip blockquotes. It updates lastBlockquote to point to the -// correct level for the current paragraph, and returns a pointer to a placeholder br where the insertion should be performed. -PassRefPtr<Element> IndentOutdentCommand::prepareBlockquoteLevelForInsertion(const VisiblePosition& currentParagraph, RefPtr<Element>& lastBlockquote) -{ - int currentBlockquoteLevel = 0; - int lastBlockquoteLevel = 0; - Node* node = currentParagraph.deepEquivalent().node(); - while ((node = enclosingNodeWithTag(Position(node->parentNode(), 0), blockquoteTag))) - currentBlockquoteLevel++; - node = lastBlockquote.get(); - while ((node = enclosingNodeWithTag(Position(node->parentNode(), 0), blockquoteTag))) - lastBlockquoteLevel++; - while (currentBlockquoteLevel > lastBlockquoteLevel) { - RefPtr<Element> newBlockquote = createIndentBlockquoteElement(document()); - appendNode(newBlockquote, lastBlockquote); - lastBlockquote = newBlockquote; - lastBlockquoteLevel++; - } - while (currentBlockquoteLevel < lastBlockquoteLevel) { - lastBlockquote = static_cast<Element*>(enclosingNodeWithTag(Position(lastBlockquote->parentNode(), 0), blockquoteTag)); - lastBlockquoteLevel--; - } - RefPtr<Element> placeholder = createBreakElement(document()); - appendNode(placeholder, lastBlockquote); - // Add another br before the placeholder if it collapsed. - VisiblePosition visiblePos(Position(placeholder.get(), 0)); - if (!isStartOfParagraph(visiblePos)) - insertNodeBefore(createBreakElement(document()), placeholder); - return placeholder.release(); -} - bool IndentOutdentCommand::tryIndentingAsListItem(const VisiblePosition& endOfCurrentParagraph) { // If our selection is not inside a list, bail out. @@ -117,13 +86,9 @@ bool IndentOutdentCommand::tryIndentingAsListItem(const VisiblePosition& endOfCu Element* nextList = selectedListItem->nextElementSibling(); RefPtr<Element> newList = document()->createElement(listNode->tagQName(), false); - RefPtr<Element> newListItem = selectedListItem->cloneElementWithoutChildren(); - RefPtr<Element> placeholder = createBreakElement(document()); insertNodeBefore(newList, selectedListItem); - appendNode(newListItem, newList); - appendNode(placeholder, newListItem); - moveParagraph(startOfParagraph(endOfCurrentParagraph), endOfCurrentParagraph, VisiblePosition(Position(placeholder, 0)), true); + moveParagraphWithClones(startOfParagraph(endOfCurrentParagraph), endOfCurrentParagraph, newList.get(), selectedListItem); if (canMergeLists(previousList, newList.get())) mergeIdenticalElements(previousList, newList); @@ -137,25 +102,31 @@ void IndentOutdentCommand::indentIntoBlockquote(const VisiblePosition& endOfCurr { Node* enclosingCell = 0; + Position start = startOfParagraph(endOfCurrentParagraph).deepEquivalent(); + enclosingCell = enclosingNodeOfType(start, &isTableCell); + Node* nodeToSplitTo; + if (enclosingCell) + nodeToSplitTo = enclosingCell; + else if (enclosingList(start.node())) + nodeToSplitTo = enclosingBlock(start.node()); + else + nodeToSplitTo = editableRootForPosition(start); + + RefPtr<Node> outerBlock = splitTreeToNode(start.node(), nodeToSplitTo); + if (!targetBlockquote) { // Create a new blockquote and insert it as a child of the root editable element. We accomplish // this by splitting all parents of the current paragraph up to that point. targetBlockquote = createIndentBlockquoteElement(document()); - Position start = startOfParagraph(endOfCurrentParagraph).deepEquivalent(); - enclosingCell = enclosingNodeOfType(start, &isTableCell); - Node* nodeToSplitTo = enclosingCell ? enclosingCell : editableRootForPosition(start); - RefPtr<Node> startOfNewBlock = splitTreeToNode(start.node(), nodeToSplitTo); - insertNodeBefore(targetBlockquote, startOfNewBlock); + insertNodeBefore(targetBlockquote, outerBlock); } - RefPtr<Element> insertionPoint = prepareBlockquoteLevelForInsertion(endOfCurrentParagraph, targetBlockquote); - + moveParagraphWithClones(startOfParagraph(endOfCurrentParagraph), endOfCurrentParagraph, targetBlockquote.get(), outerBlock.get()); + // Don't put the next paragraph in the blockquote we just created for this paragraph unless // the next paragraph is in the same cell. if (enclosingCell && enclosingCell != enclosingNodeOfType(endOfNextParagraph.deepEquivalent(), &isTableCell)) targetBlockquote = 0; - - moveParagraph(startOfParagraph(endOfCurrentParagraph), endOfCurrentParagraph, VisiblePosition(Position(insertionPoint, 0)), true); } void IndentOutdentCommand::indentRegion() @@ -191,8 +162,6 @@ void IndentOutdentCommand::indentRegion() blockquoteForNextIndent = 0; else indentIntoBlockquote(endOfCurrentParagraph, endOfNextParagraph, blockquoteForNextIndent); - // blockquoteForNextIndent maybe updated - // this is due to the way prepareBlockquoteLevelForInsertion was designed. // Sanity check: Make sure our moveParagraph calls didn't remove endOfNextParagraph.deepEquivalent().node() // If somehow we did, return to prevent crashes. if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent().node()->inDocument()) { diff --git a/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h b/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h index 419f832f..817b4c8 100644 --- a/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h +++ b/src/3rdparty/webkit/WebCore/editing/IndentOutdentCommand.h @@ -49,7 +49,6 @@ private: void indentRegion(); void outdentRegion(); void outdentParagraph(); - PassRefPtr<Element> prepareBlockquoteLevelForInsertion(const VisiblePosition&, RefPtr<Element>&); bool tryIndentingAsListItem(const VisiblePosition&); void indentIntoBlockquote(const VisiblePosition&, const VisiblePosition&, RefPtr<Element>&); diff --git a/src/3rdparty/webkit/WebCore/editing/ReplaceNodeWithSpanCommand.cpp b/src/3rdparty/webkit/WebCore/editing/ReplaceNodeWithSpanCommand.cpp index 21ca924..0874201 100644 --- a/src/3rdparty/webkit/WebCore/editing/ReplaceNodeWithSpanCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/ReplaceNodeWithSpanCommand.cpp @@ -57,7 +57,9 @@ static void swapInNodePreservingAttributesAndChildren(Node* newNode, Node* nodeT parentNode->insertBefore(newNode, nodeToReplace, ec); ASSERT(!ec); - for (Node* child = nodeToReplace->firstChild(); child; child = child->nextSibling()) { + Node* nextChild; + for (Node* child = nodeToReplace->firstChild(); child; child = nextChild) { + nextChild = child->nextSibling(); newNode->appendChild(child, ec); ASSERT(!ec); } diff --git a/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp b/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp index 7d99916..00672f2 100644 --- a/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp +++ b/src/3rdparty/webkit/WebCore/editing/SelectionController.cpp @@ -725,6 +725,8 @@ bool SelectionController::modify(EAlteration alter, int verticalDistance, bool u if (userTriggered) m_frame->setSelectionGranularity(CharacterGranularity); + m_lastChangeWasHorizontalExtension = alter == EXTEND; + return true; } diff --git a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp index 8780c36..919eb24 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp +++ b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp @@ -226,7 +226,7 @@ findProp (register const char *str, register unsigned int len) { enum { - TOTAL_KEYWORDS = 278, + TOTAL_KEYWORDS = 280, MIN_WORD_LENGTH = 3, MAX_WORD_LENGTH = 43, MIN_HASH_VALUE = 6, @@ -241,67 +241,67 @@ findProp (register const char *str, register unsigned int len) {"zoom", CSSPropertyZoom}, #line 23 "CSSPropertyNames.gperf" {"border", CSSPropertyBorder}, -#line 267 "CSSPropertyNames.gperf" +#line 268 "CSSPropertyNames.gperf" {"marker", CSSPropertyMarker}, #line 24 "CSSPropertyNames.gperf" {"border-bottom", CSSPropertyBorderBottom}, -#line 269 "CSSPropertyNames.gperf" +#line 270 "CSSPropertyNames.gperf" {"marker-mid", CSSPropertyMarkerMid}, #line 78 "CSSPropertyNames.gperf" {"margin", CSSPropertyMargin}, -#line 285 "CSSPropertyNames.gperf" +#line 286 "CSSPropertyNames.gperf" {"kerning", CSSPropertyKerning}, -#line 268 "CSSPropertyNames.gperf" +#line 269 "CSSPropertyNames.gperf" {"marker-end", CSSPropertyMarkerEnd}, #line 79 "CSSPropertyNames.gperf" {"margin-bottom", CSSPropertyMarginBottom}, -#line 251 "CSSPropertyNames.gperf" +#line 252 "CSSPropertyNames.gperf" {"mask", CSSPropertyMask}, -#line 272 "CSSPropertyNames.gperf" +#line 273 "CSSPropertyNames.gperf" {"stroke", CSSPropertyStroke}, #line 111 "CSSPropertyNames.gperf" {"size", CSSPropertySize}, #line 144 "CSSPropertyNames.gperf" {"word-break", CSSPropertyWordBreak}, -#line 287 "CSSPropertyNames.gperf" +#line 288 "CSSPropertyNames.gperf" {"writing-mode", CSSPropertyWritingMode}, -#line 162 "CSSPropertyNames.gperf" +#line 163 "CSSPropertyNames.gperf" {"-webkit-binding", CSSPropertyWebkitBinding}, #line 109 "CSSPropertyNames.gperf" {"resize", CSSPropertyResize}, -#line 266 "CSSPropertyNames.gperf" +#line 267 "CSSPropertyNames.gperf" {"image-rendering", CSSPropertyImageRendering}, #line 149 "CSSPropertyNames.gperf" {"-webkit-animation", CSSPropertyWebkitAnimation}, -#line 165 "CSSPropertyNames.gperf" +#line 166 "CSSPropertyNames.gperf" {"-webkit-border-image", CSSPropertyWebkitBorderImage}, -#line 205 "CSSPropertyNames.gperf" +#line 206 "CSSPropertyNames.gperf" {"-webkit-mask", CSSPropertyWebkitMask}, #line 136 "CSSPropertyNames.gperf" {"top", CSSPropertyTop}, #line 142 "CSSPropertyNames.gperf" {"widows", CSSPropertyWidows}, -#line 270 "CSSPropertyNames.gperf" +#line 271 "CSSPropertyNames.gperf" {"marker-start", CSSPropertyMarkerStart}, #line 154 "CSSPropertyNames.gperf" {"-webkit-animation-name", CSSPropertyWebkitAnimationName}, #line 102 "CSSPropertyNames.gperf" {"page", CSSPropertyPage}, -#line 210 "CSSPropertyNames.gperf" +#line 211 "CSSPropertyNames.gperf" {"-webkit-mask-image", CSSPropertyWebkitMaskImage}, #line 43 "CSSPropertyNames.gperf" {"border-top", CSSPropertyBorderTop}, #line 97 "CSSPropertyNames.gperf" {"padding", CSSPropertyPadding}, -#line 240 "CSSPropertyNames.gperf" +#line 241 "CSSPropertyNames.gperf" {"-webkit-transition", CSSPropertyWebkitTransition}, -#line 211 "CSSPropertyNames.gperf" +#line 212 "CSSPropertyNames.gperf" {"-webkit-mask-origin", CSSPropertyWebkitMaskOrigin}, #line 98 "CSSPropertyNames.gperf" {"padding-bottom", CSSPropertyPaddingBottom}, #line 82 "CSSPropertyNames.gperf" {"margin-top", CSSPropertyMarginTop}, -#line 197 "CSSPropertyNames.gperf" +#line 198 "CSSPropertyNames.gperf" {"-webkit-margin-start", CSSPropertyWebkitMarginStart}, #line 55 "CSSPropertyNames.gperf" {"content", CSSPropertyContent}, @@ -309,35 +309,35 @@ findProp (register const char *str, register unsigned int len) {"position", CSSPropertyPosition}, #line 59 "CSSPropertyNames.gperf" {"direction", CSSPropertyDirection}, -#line 218 "CSSPropertyNames.gperf" +#line 219 "CSSPropertyNames.gperf" {"-webkit-mask-size", CSSPropertyWebkitMaskSize}, #line 112 "CSSPropertyNames.gperf" {"src", CSSPropertySrc}, #line 146 "CSSPropertyNames.gperf" {"word-wrap", CSSPropertyWordWrap}, -#line 220 "CSSPropertyNames.gperf" +#line 221 "CSSPropertyNames.gperf" {"-webkit-nbsp-mode", CSSPropertyWebkitNbspMode}, #line 105 "CSSPropertyNames.gperf" {"page-break-inside", CSSPropertyPageBreakInside}, -#line 215 "CSSPropertyNames.gperf" +#line 216 "CSSPropertyNames.gperf" {"-webkit-mask-repeat", CSSPropertyWebkitMaskRepeat}, #line 101 "CSSPropertyNames.gperf" {"padding-top", CSSPropertyPaddingTop}, -#line 221 "CSSPropertyNames.gperf" +#line 222 "CSSPropertyNames.gperf" {"-webkit-padding-start", CSSPropertyWebkitPaddingStart}, #line 151 "CSSPropertyNames.gperf" {"-webkit-animation-direction", CSSPropertyWebkitAnimationDirection}, -#line 212 "CSSPropertyNames.gperf" +#line 213 "CSSPropertyNames.gperf" {"-webkit-mask-position", CSSPropertyWebkitMaskPosition}, -#line 193 "CSSPropertyNames.gperf" +#line 194 "CSSPropertyNames.gperf" {"-webkit-line-break", CSSPropertyWebkitLineBreak}, -#line 277 "CSSPropertyNames.gperf" +#line 278 "CSSPropertyNames.gperf" {"stroke-miterlimit", CSSPropertyStrokeMiterlimit}, -#line 226 "CSSPropertyNames.gperf" +#line 227 "CSSPropertyNames.gperf" {"-webkit-rtl-ordering", CSSPropertyWebkitRtlOrdering}, -#line 276 "CSSPropertyNames.gperf" +#line 277 "CSSPropertyNames.gperf" {"stroke-linejoin", CSSPropertyStrokeLinejoin}, -#line 282 "CSSPropertyNames.gperf" +#line 283 "CSSPropertyNames.gperf" {"dominant-baseline", CSSPropertyDominantBaseline}, #line 51 "CSSPropertyNames.gperf" {"caption-side", CSSPropertyCaptionSide}, @@ -357,25 +357,25 @@ findProp (register const char *str, register unsigned int len) {"word-spacing", CSSPropertyWordSpacing}, #line 31 "CSSPropertyNames.gperf" {"border-color", CSSPropertyBorderColor}, -#line 199 "CSSPropertyNames.gperf" +#line 200 "CSSPropertyNames.gperf" {"-webkit-marquee", CSSPropertyWebkitMarquee}, #line 25 "CSSPropertyNames.gperf" {"border-bottom-color", CSSPropertyBorderBottomColor}, #line 152 "CSSPropertyNames.gperf" {"-webkit-animation-duration", CSSPropertyWebkitAnimationDuration}, -#line 245 "CSSPropertyNames.gperf" +#line 246 "CSSPropertyNames.gperf" {"-webkit-user-drag", CSSPropertyWebkitUserDrag}, -#line 166 "CSSPropertyNames.gperf" +#line 167 "CSSPropertyNames.gperf" {"-webkit-border-radius", CSSPropertyWebkitBorderRadius}, -#line 209 "CSSPropertyNames.gperf" +#line 210 "CSSPropertyNames.gperf" {"-webkit-mask-composite", CSSPropertyWebkitMaskComposite}, -#line 262 "CSSPropertyNames.gperf" +#line 263 "CSSPropertyNames.gperf" {"color-rendering", CSSPropertyColorRendering}, #line 137 "CSSPropertyNames.gperf" {"unicode-bidi", CSSPropertyUnicodeBidi}, #line 53 "CSSPropertyNames.gperf" {"clip", CSSPropertyClip}, -#line 242 "CSSPropertyNames.gperf" +#line 243 "CSSPropertyNames.gperf" {"-webkit-transition-duration", CSSPropertyWebkitTransitionDuration}, #line 157 "CSSPropertyNames.gperf" {"-webkit-appearance", CSSPropertyWebkitAppearance}, @@ -395,33 +395,35 @@ findProp (register const char *str, register unsigned int len) {"background-origin", CSSPropertyBackgroundOrigin}, #line 57 "CSSPropertyNames.gperf" {"counter-reset", CSSPropertyCounterReset}, -#line 257 "CSSPropertyNames.gperf" +#line 258 "CSSPropertyNames.gperf" {"stop-color", CSSPropertyStopColor}, -#line 280 "CSSPropertyNames.gperf" +#line 281 "CSSPropertyNames.gperf" {"alignment-baseline", CSSPropertyAlignmentBaseline}, #line 22 "CSSPropertyNames.gperf" {"background-size", CSSPropertyBackgroundSize}, -#line 202 "CSSPropertyNames.gperf" +#line 203 "CSSPropertyNames.gperf" {"-webkit-marquee-repetition", CSSPropertyWebkitMarqueeRepetition}, -#line 275 "CSSPropertyNames.gperf" +#line 276 "CSSPropertyNames.gperf" {"stroke-linecap", CSSPropertyStrokeLinecap}, #line 161 "CSSPropertyNames.gperf" {"-webkit-background-origin", CSSPropertyWebkitBackgroundOrigin}, #line 72 "CSSPropertyNames.gperf" {"letter-spacing", CSSPropertyLetterSpacing}, -#line 203 "CSSPropertyNames.gperf" +#line 204 "CSSPropertyNames.gperf" {"-webkit-marquee-speed", CSSPropertyWebkitMarqueeSpeed}, -#line 208 "CSSPropertyNames.gperf" +#line 209 "CSSPropertyNames.gperf" {"-webkit-mask-clip", CSSPropertyWebkitMaskClip}, #line 153 "CSSPropertyNames.gperf" {"-webkit-animation-iteration-count", CSSPropertyWebkitAnimationIterationCount}, -#line 200 "CSSPropertyNames.gperf" - {"-webkit-marquee-direction", CSSPropertyWebkitMarqueeDirection}, #line 201 "CSSPropertyNames.gperf" + {"-webkit-marquee-direction", CSSPropertyWebkitMarqueeDirection}, +#line 162 "CSSPropertyNames.gperf" + {"-webkit-background-size", CSSPropertyWebkitBackgroundSize}, +#line 202 "CSSPropertyNames.gperf" {"-webkit-marquee-increment", CSSPropertyWebkitMarqueeIncrement}, #line 19 "CSSPropertyNames.gperf" {"background-repeat", CSSPropertyBackgroundRepeat}, -#line 222 "CSSPropertyNames.gperf" +#line 223 "CSSPropertyNames.gperf" {"-webkit-perspective", CSSPropertyWebkitPerspective}, #line 110 "CSSPropertyNames.gperf" {"right", CSSPropertyRight}, @@ -433,7 +435,7 @@ findProp (register const char *str, register unsigned int len) {"background-position", CSSPropertyBackgroundPosition}, #line 86 "CSSPropertyNames.gperf" {"min-width", CSSPropertyMinWidth}, -#line 223 "CSSPropertyNames.gperf" +#line 224 "CSSPropertyNames.gperf" {"-webkit-perspective-origin", CSSPropertyWebkitPerspectiveOrigin}, #line 37 "CSSPropertyNames.gperf" {"border-right", CSSPropertyBorderRight}, @@ -445,18 +447,20 @@ findProp (register const char *str, register unsigned int len) {"margin-right", CSSPropertyMarginRight}, #line 29 "CSSPropertyNames.gperf" {"border-bottom-width", CSSPropertyBorderBottomWidth}, -#line 252 "CSSPropertyNames.gperf" +#line 253 "CSSPropertyNames.gperf" {"enable-background", CSSPropertyEnableBackground}, -#line 279 "CSSPropertyNames.gperf" +#line 280 "CSSPropertyNames.gperf" {"stroke-width", CSSPropertyStrokeWidth}, -#line 189 "CSSPropertyNames.gperf" +#line 190 "CSSPropertyNames.gperf" {"-webkit-columns", CSSPropertyWebkitColumns}, -#line 194 "CSSPropertyNames.gperf" +#line 195 "CSSPropertyNames.gperf" {"-webkit-line-clamp", CSSPropertyWebkitLineClamp}, -#line 259 "CSSPropertyNames.gperf" +#line 260 "CSSPropertyNames.gperf" {"color-interpolation", CSSPropertyColorInterpolation}, -#line 163 "CSSPropertyNames.gperf" +#line 164 "CSSPropertyNames.gperf" {"-webkit-border-fit", CSSPropertyWebkitBorderFit}, +#line 289 "CSSPropertyNames.gperf" + {"-webkit-shadow", CSSPropertyWebkitShadow}, #line 65 "CSSPropertyNames.gperf" {"font-size", CSSPropertyFontSize}, #line 30 "CSSPropertyNames.gperf" @@ -467,11 +471,11 @@ findProp (register const char *str, register unsigned int len) {"z-index", CSSPropertyZIndex}, #line 139 "CSSPropertyNames.gperf" {"vertical-align", CSSPropertyVerticalAlign}, -#line 181 "CSSPropertyNames.gperf" +#line 182 "CSSPropertyNames.gperf" {"-webkit-column-break-inside", CSSPropertyWebkitColumnBreakInside}, #line 100 "CSSPropertyNames.gperf" {"padding-right", CSSPropertyPaddingRight}, -#line 247 "CSSPropertyNames.gperf" +#line 248 "CSSPropertyNames.gperf" {"-webkit-user-select", CSSPropertyWebkitUserSelect}, #line 48 "CSSPropertyNames.gperf" {"border-top-width", CSSPropertyBorderTopWidth}, @@ -479,49 +483,49 @@ findProp (register const char *str, register unsigned int len) {"text-rendering", CSSPropertyTextRendering}, #line 88 "CSSPropertyNames.gperf" {"orphans", CSSPropertyOrphans}, -#line 174 "CSSPropertyNames.gperf" +#line 175 "CSSPropertyNames.gperf" {"-webkit-box-orient", CSSPropertyWebkitBoxOrient}, -#line 234 "CSSPropertyNames.gperf" +#line 235 "CSSPropertyNames.gperf" {"-webkit-transform", CSSPropertyWebkitTransform}, -#line 183 "CSSPropertyNames.gperf" +#line 184 "CSSPropertyNames.gperf" {"-webkit-column-gap", CSSPropertyWebkitColumnGap}, -#line 196 "CSSPropertyNames.gperf" +#line 197 "CSSPropertyNames.gperf" {"-webkit-margin-collapse", CSSPropertyWebkitMarginCollapse}, #line 160 "CSSPropertyNames.gperf" {"-webkit-background-composite", CSSPropertyWebkitBackgroundComposite}, -#line 195 "CSSPropertyNames.gperf" +#line 196 "CSSPropertyNames.gperf" {"-webkit-margin-bottom-collapse", CSSPropertyWebkitMarginBottomCollapse}, #line 13 "CSSPropertyNames.gperf" {"background-color", CSSPropertyBackgroundColor}, -#line 231 "CSSPropertyNames.gperf" +#line 232 "CSSPropertyNames.gperf" {"-webkit-text-stroke", CSSPropertyWebkitTextStroke}, -#line 271 "CSSPropertyNames.gperf" +#line 272 "CSSPropertyNames.gperf" {"shape-rendering", CSSPropertyShapeRendering}, #line 104 "CSSPropertyNames.gperf" {"page-break-before", CSSPropertyPageBreakBefore}, -#line 235 "CSSPropertyNames.gperf" +#line 236 "CSSPropertyNames.gperf" {"-webkit-transform-origin", CSSPropertyWebkitTransformOrigin}, #line 103 "CSSPropertyNames.gperf" {"page-break-after", CSSPropertyPageBreakAfter}, #line 90 "CSSPropertyNames.gperf" {"outline-color", CSSPropertyOutlineColor}, -#line 207 "CSSPropertyNames.gperf" +#line 208 "CSSPropertyNames.gperf" {"-webkit-mask-box-image", CSSPropertyWebkitMaskBoxImage}, -#line 178 "CSSPropertyNames.gperf" +#line 179 "CSSPropertyNames.gperf" {"-webkit-box-sizing", CSSPropertyWebkitBoxSizing}, #line 71 "CSSPropertyNames.gperf" {"left", CSSPropertyLeft}, -#line 238 "CSSPropertyNames.gperf" +#line 239 "CSSPropertyNames.gperf" {"-webkit-transform-origin-z", CSSPropertyWebkitTransformOriginZ}, #line 68 "CSSPropertyNames.gperf" {"font-variant", CSSPropertyFontVariant}, #line 62 "CSSPropertyNames.gperf" {"float", CSSPropertyFloat}, -#line 253 "CSSPropertyNames.gperf" +#line 254 "CSSPropertyNames.gperf" {"filter", CSSPropertyFilter}, #line 32 "CSSPropertyNames.gperf" {"border-left", CSSPropertyBorderLeft}, -#line 206 "CSSPropertyNames.gperf" +#line 207 "CSSPropertyNames.gperf" {"-webkit-mask-attachment", CSSPropertyWebkitMaskAttachment}, #line 115 "CSSPropertyNames.gperf" {"text-decoration", CSSPropertyTextDecoration}, @@ -529,31 +533,31 @@ findProp (register const char *str, register unsigned int len) {"margin-left", CSSPropertyMarginLeft}, #line 12 "CSSPropertyNames.gperf" {"background-clip", CSSPropertyBackgroundClip}, -#line 198 "CSSPropertyNames.gperf" +#line 199 "CSSPropertyNames.gperf" {"-webkit-margin-top-collapse", CSSPropertyWebkitMarginTopCollapse}, -#line 167 "CSSPropertyNames.gperf" +#line 168 "CSSPropertyNames.gperf" {"-webkit-border-vertical-spacing", CSSPropertyWebkitBorderVerticalSpacing}, -#line 250 "CSSPropertyNames.gperf" +#line 251 "CSSPropertyNames.gperf" {"clip-rule", CSSPropertyClipRule}, -#line 169 "CSSPropertyNames.gperf" +#line 170 "CSSPropertyNames.gperf" {"-webkit-box-direction", CSSPropertyWebkitBoxDirection}, #line 141 "CSSPropertyNames.gperf" {"white-space", CSSPropertyWhiteSpace}, #line 114 "CSSPropertyNames.gperf" {"text-align", CSSPropertyTextAlign}, -#line 216 "CSSPropertyNames.gperf" +#line 217 "CSSPropertyNames.gperf" {"-webkit-mask-repeat-x", CSSPropertyWebkitMaskRepeatX}, #line 159 "CSSPropertyNames.gperf" {"-webkit-background-clip", CSSPropertyWebkitBackgroundClip}, -#line 217 "CSSPropertyNames.gperf" +#line 218 "CSSPropertyNames.gperf" {"-webkit-mask-repeat-y", CSSPropertyWebkitMaskRepeatY}, -#line 168 "CSSPropertyNames.gperf" +#line 169 "CSSPropertyNames.gperf" {"-webkit-box-align", CSSPropertyWebkitBoxAlign}, -#line 213 "CSSPropertyNames.gperf" +#line 214 "CSSPropertyNames.gperf" {"-webkit-mask-position-x", CSSPropertyWebkitMaskPositionX}, #line 99 "CSSPropertyNames.gperf" {"padding-left", CSSPropertyPaddingLeft}, -#line 190 "CSSPropertyNames.gperf" +#line 191 "CSSPropertyNames.gperf" {"-webkit-font-size-delta", CSSPropertyWebkitFontSizeDelta}, #line 27 "CSSPropertyNames.gperf" {"border-bottom-right-radius", CSSPropertyBorderBottomRightRadius}, @@ -561,61 +565,61 @@ findProp (register const char *str, register unsigned int len) {"opacity", CSSPropertyOpacity}, #line 38 "CSSPropertyNames.gperf" {"border-right-color", CSSPropertyBorderRightColor}, -#line 175 "CSSPropertyNames.gperf" +#line 176 "CSSPropertyNames.gperf" {"-webkit-box-pack", CSSPropertyWebkitBoxPack}, -#line 172 "CSSPropertyNames.gperf" +#line 173 "CSSPropertyNames.gperf" {"-webkit-box-lines", CSSPropertyWebkitBoxLines}, #line 42 "CSSPropertyNames.gperf" {"border-style", CSSPropertyBorderStyle}, -#line 214 "CSSPropertyNames.gperf" +#line 215 "CSSPropertyNames.gperf" {"-webkit-mask-position-y", CSSPropertyWebkitMaskPositionY}, #line 94 "CSSPropertyNames.gperf" {"overflow", CSSPropertyOverflow}, #line 28 "CSSPropertyNames.gperf" {"border-bottom-style", CSSPropertyBorderBottomStyle}, -#line 263 "CSSPropertyNames.gperf" +#line 264 "CSSPropertyNames.gperf" {"fill", CSSPropertyFill}, #line 150 "CSSPropertyNames.gperf" {"-webkit-animation-delay", CSSPropertyWebkitAnimationDelay}, -#line 278 "CSSPropertyNames.gperf" +#line 279 "CSSPropertyNames.gperf" {"stroke-opacity", CSSPropertyStrokeOpacity}, #line 123 "CSSPropertyNames.gperf" {"text-overline", CSSPropertyTextOverline}, -#line 182 "CSSPropertyNames.gperf" +#line 183 "CSSPropertyNames.gperf" {"-webkit-column-count", CSSPropertyWebkitColumnCount}, #line 125 "CSSPropertyNames.gperf" {"text-overline-mode", CSSPropertyTextOverlineMode}, #line 46 "CSSPropertyNames.gperf" {"border-top-right-radius", CSSPropertyBorderTopRightRadius}, -#line 241 "CSSPropertyNames.gperf" +#line 242 "CSSPropertyNames.gperf" {"-webkit-transition-delay", CSSPropertyWebkitTransitionDelay}, #line 60 "CSSPropertyNames.gperf" {"display", CSSPropertyDisplay}, #line 93 "CSSPropertyNames.gperf" {"outline-width", CSSPropertyOutlineWidth}, -#line 243 "CSSPropertyNames.gperf" +#line 244 "CSSPropertyNames.gperf" {"-webkit-transition-property", CSSPropertyWebkitTransitionProperty}, #line 47 "CSSPropertyNames.gperf" {"border-top-style", CSSPropertyBorderTopStyle}, -#line 184 "CSSPropertyNames.gperf" +#line 185 "CSSPropertyNames.gperf" {"-webkit-column-rule", CSSPropertyWebkitColumnRule}, #line 140 "CSSPropertyNames.gperf" {"visibility", CSSPropertyVisibility}, -#line 249 "CSSPropertyNames.gperf" +#line 250 "CSSPropertyNames.gperf" {"clip-path", CSSPropertyClipPath}, -#line 258 "CSSPropertyNames.gperf" +#line 259 "CSSPropertyNames.gperf" {"stop-opacity", CSSPropertyStopOpacity}, -#line 248 "CSSPropertyNames.gperf" +#line 249 "CSSPropertyNames.gperf" {"-webkit-variable-declaration-block", CSSPropertyWebkitVariableDeclarationBlock}, -#line 230 "CSSPropertyNames.gperf" +#line 231 "CSSPropertyNames.gperf" {"-webkit-text-size-adjust", CSSPropertyWebkitTextSizeAdjust}, -#line 232 "CSSPropertyNames.gperf" +#line 233 "CSSPropertyNames.gperf" {"-webkit-text-stroke-color", CSSPropertyWebkitTextStrokeColor}, -#line 256 "CSSPropertyNames.gperf" +#line 257 "CSSPropertyNames.gperf" {"lighting-color", CSSPropertyLightingColor}, #line 70 "CSSPropertyNames.gperf" {"height", CSSPropertyHeight}, -#line 254 "CSSPropertyNames.gperf" +#line 255 "CSSPropertyNames.gperf" {"flood-color", CSSPropertyFloodColor}, #line 156 "CSSPropertyNames.gperf" {"-webkit-animation-timing-function", CSSPropertyWebkitAnimationTimingFunction}, @@ -635,21 +639,21 @@ findProp (register const char *str, register unsigned int len) {"border-left-color", CSSPropertyBorderLeftColor}, #line 74 "CSSPropertyNames.gperf" {"list-style", CSSPropertyListStyle}, -#line 164 "CSSPropertyNames.gperf" +#line 165 "CSSPropertyNames.gperf" {"-webkit-border-horizontal-spacing", CSSPropertyWebkitBorderHorizontalSpacing}, -#line 244 "CSSPropertyNames.gperf" +#line 245 "CSSPropertyNames.gperf" {"-webkit-transition-timing-function", CSSPropertyWebkitTransitionTimingFunction}, #line 75 "CSSPropertyNames.gperf" {"list-style-image", CSSPropertyListStyleImage}, #line 40 "CSSPropertyNames.gperf" {"border-right-width", CSSPropertyBorderRightWidth}, -#line 188 "CSSPropertyNames.gperf" +#line 189 "CSSPropertyNames.gperf" {"-webkit-column-width", CSSPropertyWebkitColumnWidth}, #line 20 "CSSPropertyNames.gperf" {"background-repeat-x", CSSPropertyBackgroundRepeatX}, #line 69 "CSSPropertyNames.gperf" {"font-weight", CSSPropertyFontWeight}, -#line 261 "CSSPropertyNames.gperf" +#line 262 "CSSPropertyNames.gperf" {"color-profile", CSSPropertyColorProfile}, #line 45 "CSSPropertyNames.gperf" {"border-top-left-radius", CSSPropertyBorderTopLeftRadius}, @@ -659,21 +663,21 @@ findProp (register const char *str, register unsigned int len) {"background-position-x", CSSPropertyBackgroundPositionX}, #line 84 "CSSPropertyNames.gperf" {"max-width", CSSPropertyMaxWidth}, -#line 224 "CSSPropertyNames.gperf" +#line 225 "CSSPropertyNames.gperf" {"-webkit-perspective-origin-x", CSSPropertyWebkitPerspectiveOriginX}, -#line 180 "CSSPropertyNames.gperf" +#line 181 "CSSPropertyNames.gperf" {"-webkit-column-break-before", CSSPropertyWebkitColumnBreakBefore}, -#line 179 "CSSPropertyNames.gperf" +#line 180 "CSSPropertyNames.gperf" {"-webkit-column-break-after", CSSPropertyWebkitColumnBreakAfter}, #line 18 "CSSPropertyNames.gperf" {"background-position-y", CSSPropertyBackgroundPositionY}, -#line 191 "CSSPropertyNames.gperf" +#line 192 "CSSPropertyNames.gperf" {"-webkit-font-smoothing", CSSPropertyWebkitFontSmoothing}, -#line 173 "CSSPropertyNames.gperf" +#line 174 "CSSPropertyNames.gperf" {"-webkit-box-ordinal-group", CSSPropertyWebkitBoxOrdinalGroup}, -#line 204 "CSSPropertyNames.gperf" +#line 205 "CSSPropertyNames.gperf" {"-webkit-marquee-style", CSSPropertyWebkitMarqueeStyle}, -#line 225 "CSSPropertyNames.gperf" +#line 226 "CSSPropertyNames.gperf" {"-webkit-perspective-origin-y", CSSPropertyWebkitPerspectiveOriginY}, #line 129 "CSSPropertyNames.gperf" {"text-shadow", CSSPropertyTextShadow}, @@ -683,13 +687,13 @@ findProp (register const char *str, register unsigned int len) {"list-style-position", CSSPropertyListStylePosition}, #line 113 "CSSPropertyNames.gperf" {"table-layout", CSSPropertyTableLayout}, -#line 177 "CSSPropertyNames.gperf" +#line 178 "CSSPropertyNames.gperf" {"-webkit-box-shadow", CSSPropertyWebkitBoxShadow}, #line 124 "CSSPropertyNames.gperf" {"text-overline-color", CSSPropertyTextOverlineColor}, #line 61 "CSSPropertyNames.gperf" {"empty-cells", CSSPropertyEmptyCells}, -#line 233 "CSSPropertyNames.gperf" +#line 234 "CSSPropertyNames.gperf" {"-webkit-text-stroke-width", CSSPropertyWebkitTextStrokeWidth}, #line 130 "CSSPropertyNames.gperf" {"text-transform", CSSPropertyTextTransform}, @@ -697,25 +701,25 @@ findProp (register const char *str, register unsigned int len) {"font-stretch", CSSPropertyFontStretch}, #line 92 "CSSPropertyNames.gperf" {"outline-style", CSSPropertyOutlineStyle}, -#line 286 "CSSPropertyNames.gperf" +#line 287 "CSSPropertyNames.gperf" {"text-anchor", CSSPropertyTextAnchor}, -#line 185 "CSSPropertyNames.gperf" +#line 186 "CSSPropertyNames.gperf" {"-webkit-column-rule-color", CSSPropertyWebkitColumnRuleColor}, -#line 273 "CSSPropertyNames.gperf" +#line 274 "CSSPropertyNames.gperf" {"stroke-dasharray", CSSPropertyStrokeDasharray}, #line 35 "CSSPropertyNames.gperf" {"border-left-width", CSSPropertyBorderLeftWidth}, -#line 265 "CSSPropertyNames.gperf" +#line 266 "CSSPropertyNames.gperf" {"fill-rule", CSSPropertyFillRule}, -#line 236 "CSSPropertyNames.gperf" +#line 237 "CSSPropertyNames.gperf" {"-webkit-transform-origin-x", CSSPropertyWebkitTransformOriginX}, -#line 281 "CSSPropertyNames.gperf" +#line 282 "CSSPropertyNames.gperf" {"baseline-shift", CSSPropertyBaselineShift}, #line 132 "CSSPropertyNames.gperf" {"text-underline-color", CSSPropertyTextUnderlineColor}, -#line 237 "CSSPropertyNames.gperf" +#line 238 "CSSPropertyNames.gperf" {"-webkit-transform-origin-y", CSSPropertyWebkitTransformOriginY}, -#line 260 "CSSPropertyNames.gperf" +#line 261 "CSSPropertyNames.gperf" {"color-interpolation-filters", CSSPropertyColorInterpolationFilters}, #line 39 "CSSPropertyNames.gperf" {"border-right-style", CSSPropertyBorderRightStyle}, @@ -727,63 +731,63 @@ findProp (register const char *str, register unsigned int len) {"overflow-x", CSSPropertyOverflowX}, #line 122 "CSSPropertyNames.gperf" {"text-overflow", CSSPropertyTextOverflow}, -#line 176 "CSSPropertyNames.gperf" +#line 177 "CSSPropertyNames.gperf" {"-webkit-box-reflect", CSSPropertyWebkitBoxReflect}, -#line 246 "CSSPropertyNames.gperf" +#line 247 "CSSPropertyNames.gperf" {"-webkit-user-modify", CSSPropertyWebkitUserModify}, -#line 187 "CSSPropertyNames.gperf" +#line 188 "CSSPropertyNames.gperf" {"-webkit-column-rule-width", CSSPropertyWebkitColumnRuleWidth}, #line 96 "CSSPropertyNames.gperf" {"overflow-y", CSSPropertyOverflowY}, -#line 239 "CSSPropertyNames.gperf" +#line 240 "CSSPropertyNames.gperf" {"-webkit-transform-style", CSSPropertyWebkitTransformStyle}, #line 91 "CSSPropertyNames.gperf" {"outline-offset", CSSPropertyOutlineOffset}, #line 135 "CSSPropertyNames.gperf" {"text-underline-width", CSSPropertyTextUnderlineWidth}, -#line 255 "CSSPropertyNames.gperf" +#line 256 "CSSPropertyNames.gperf" {"flood-opacity", CSSPropertyFloodOpacity}, #line 34 "CSSPropertyNames.gperf" {"border-left-style", CSSPropertyBorderLeftStyle}, #line 83 "CSSPropertyNames.gperf" {"max-height", CSSPropertyMaxHeight}, -#line 229 "CSSPropertyNames.gperf" +#line 230 "CSSPropertyNames.gperf" {"-webkit-text-security", CSSPropertyWebkitTextSecurity}, -#line 192 "CSSPropertyNames.gperf" +#line 193 "CSSPropertyNames.gperf" {"-webkit-highlight", CSSPropertyWebkitHighlight}, -#line 264 "CSSPropertyNames.gperf" +#line 265 "CSSPropertyNames.gperf" {"fill-opacity", CSSPropertyFillOpacity}, -#line 274 "CSSPropertyNames.gperf" +#line 275 "CSSPropertyNames.gperf" {"stroke-dashoffset", CSSPropertyStrokeDashoffset}, #line 126 "CSSPropertyNames.gperf" {"text-overline-style", CSSPropertyTextOverlineStyle}, #line 77 "CSSPropertyNames.gperf" {"list-style-type", CSSPropertyListStyleType}, -#line 219 "CSSPropertyNames.gperf" +#line 220 "CSSPropertyNames.gperf" {"-webkit-match-nearest-mail-blockquote-color", CSSPropertyWebkitMatchNearestMailBlockquoteColor}, -#line 186 "CSSPropertyNames.gperf" +#line 187 "CSSPropertyNames.gperf" {"-webkit-column-rule-style", CSSPropertyWebkitColumnRuleStyle}, #line 158 "CSSPropertyNames.gperf" {"-webkit-backface-visibility", CSSPropertyWebkitBackfaceVisibility}, -#line 228 "CSSPropertyNames.gperf" +#line 229 "CSSPropertyNames.gperf" {"-webkit-text-fill-color", CSSPropertyWebkitTextFillColor}, #line 134 "CSSPropertyNames.gperf" {"text-underline-style", CSSPropertyTextUnderlineStyle}, -#line 284 "CSSPropertyNames.gperf" +#line 285 "CSSPropertyNames.gperf" {"glyph-orientation-vertical", CSSPropertyGlyphOrientationVertical}, #line 64 "CSSPropertyNames.gperf" {"font-family", CSSPropertyFontFamily}, -#line 170 "CSSPropertyNames.gperf" +#line 171 "CSSPropertyNames.gperf" {"-webkit-box-flex", CSSPropertyWebkitBoxFlex}, #line 117 "CSSPropertyNames.gperf" {"text-line-through", CSSPropertyTextLineThrough}, #line 119 "CSSPropertyNames.gperf" {"text-line-through-mode", CSSPropertyTextLineThroughMode}, -#line 227 "CSSPropertyNames.gperf" +#line 228 "CSSPropertyNames.gperf" {"-webkit-text-decorations-in-effect", CSSPropertyWebkitTextDecorationsInEffect}, -#line 283 "CSSPropertyNames.gperf" +#line 284 "CSSPropertyNames.gperf" {"glyph-orientation-horizontal", CSSPropertyGlyphOrientationHorizontal}, -#line 171 "CSSPropertyNames.gperf" +#line 172 "CSSPropertyNames.gperf" {"-webkit-box-flex-group", CSSPropertyWebkitBoxFlexGroup}, #line 118 "CSSPropertyNames.gperf" {"text-line-through-color", CSSPropertyTextLineThroughColor}, @@ -825,113 +829,113 @@ findProp (register const char *str, register unsigned int len) -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, 81, -1, 82, 83, -1, -1, 84, 85, -1, -1, -1, 86, -1, 87, 88, -1, -1, - -1, -1, -1, 89, -1, 90, -1, -1, -1, -1, - 91, -1, -1, -1, -1, -1, -1, 92, -1, -1, - -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, - 94, -1, 95, -1, -1, 96, -1, -1, -1, 97, - -1, -1, -1, -1, 98, -1, 99, 100, -1, -1, - -1, -1, 101, -1, 102, -1, -1, 103, -1, 104, - -1, -1, -1, -1, -1, -1, -1, 105, -1, -1, - -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, - 107, -1, -1, 108, 109, -1, -1, -1, 110, -1, - -1, -1, -1, -1, 111, 112, 113, 114, -1, 115, - -1, -1, -1, -1, -1, -1, -1, 116, 117, 118, - -1, 119, -1, -1, 120, -1, -1, 121, 122, -1, - -1, -1, 123, 124, -1, -1, -1, -1, 125, -1, - -1, -1, -1, 126, -1, 127, 128, -1, -1, 129, - 130, -1, 131, -1, 132, -1, 133, -1, 134, -1, - -1, -1, 135, 136, 137, -1, 138, 139, -1, -1, - 140, 141, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 142, -1, 143, -1, -1, -1, -1, -1, -1, - 144, 145, -1, -1, -1, 146, -1, 147, -1, -1, - -1, 148, -1, -1, 149, -1, 150, -1, -1, -1, - -1, 151, -1, -1, -1, 152, 153, -1, 154, -1, + -1, -1, -1, 89, -1, 90, -1, -1, 91, -1, + 92, -1, -1, -1, -1, -1, -1, 93, -1, -1, + -1, -1, -1, -1, 94, -1, -1, -1, -1, -1, + 95, -1, 96, -1, -1, 97, -1, -1, -1, 98, + -1, -1, -1, -1, 99, -1, 100, 101, -1, -1, + -1, -1, 102, -1, 103, -1, -1, 104, -1, 105, + -1, -1, -1, -1, -1, -1, -1, 106, -1, -1, + -1, -1, 107, -1, -1, -1, -1, -1, -1, -1, + 108, -1, -1, 109, 110, -1, -1, -1, 111, 112, + -1, -1, -1, -1, 113, 114, 115, 116, -1, 117, + -1, -1, -1, -1, -1, -1, -1, 118, 119, 120, + -1, 121, -1, -1, 122, -1, -1, 123, 124, -1, + -1, -1, 125, 126, -1, -1, -1, -1, 127, -1, + -1, -1, -1, 128, -1, 129, 130, -1, -1, 131, + 132, -1, 133, -1, 134, -1, 135, -1, 136, -1, + -1, -1, 137, 138, 139, -1, 140, 141, -1, -1, + 142, 143, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 144, -1, 145, -1, -1, -1, -1, -1, -1, + 146, 147, -1, -1, -1, 148, -1, 149, -1, -1, + -1, 150, -1, -1, 151, -1, 152, -1, -1, -1, + -1, 153, -1, -1, -1, 154, 155, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 155, 156, 157, -1, - -1, -1, 158, 159, -1, -1, 160, 161, 162, -1, - -1, 163, 164, -1, -1, -1, -1, 165, 166, -1, - -1, -1, -1, 167, 168, -1, -1, -1, -1, 169, - -1, -1, -1, 170, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 171, -1, -1, -1, 172, -1, - 173, -1, -1, 174, -1, -1, -1, -1, 175, 176, - -1, -1, 177, 178, -1, -1, -1, -1, -1, -1, - -1, -1, 179, -1, -1, -1, 180, -1, -1, 181, - 182, -1, -1, -1, -1, -1, -1, -1, -1, 183, - -1, -1, 184, -1, 185, -1, -1, -1, -1, 186, - 187, -1, -1, -1, 188, -1, -1, -1, -1, -1, - -1, 189, -1, -1, -1, -1, 190, -1, 191, 192, - 193, -1, -1, 194, 195, -1, -1, -1, -1, -1, - 196, 197, 198, -1, -1, 199, -1, -1, -1, -1, - -1, -1, -1, 200, 201, -1, -1, -1, -1, -1, - -1, 202, -1, 203, -1, -1, -1, -1, -1, -1, - 204, -1, -1, -1, 205, -1, 206, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 207, -1, - -1, -1, 208, -1, 209, -1, 210, -1, -1, 211, - -1, -1, -1, 212, -1, -1, -1, 213, -1, -1, - -1, 214, -1, -1, -1, -1, 215, 216, -1, -1, - 217, 218, -1, 219, -1, -1, 220, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 221, -1, -1, 222, - -1, -1, -1, -1, -1, -1, -1, 223, 224, 225, - -1, 226, -1, -1, -1, 227, -1, -1, -1, 228, - -1, -1, 229, -1, -1, -1, -1, -1, 230, -1, - -1, 231, -1, -1, -1, -1, -1, -1, -1, -1, - 232, -1, -1, -1, -1, -1, 233, 234, -1, -1, - -1, -1, -1, -1, 235, -1, -1, -1, -1, -1, - -1, 236, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 237, - 238, 239, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 157, 158, 159, -1, + -1, -1, 160, 161, -1, -1, 162, 163, 164, -1, + -1, 165, 166, -1, -1, -1, -1, 167, 168, -1, + -1, -1, -1, 169, 170, -1, -1, -1, -1, 171, + -1, -1, -1, 172, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 173, -1, -1, -1, 174, -1, + 175, -1, -1, 176, -1, -1, -1, -1, 177, 178, + -1, -1, 179, 180, -1, -1, -1, -1, -1, -1, + -1, -1, 181, -1, -1, -1, 182, -1, -1, 183, + 184, -1, -1, -1, -1, -1, -1, -1, -1, 185, + -1, -1, 186, -1, 187, -1, -1, -1, -1, 188, + 189, -1, -1, -1, 190, -1, -1, -1, -1, -1, + -1, 191, -1, -1, -1, -1, 192, -1, 193, 194, + 195, -1, -1, 196, 197, -1, -1, -1, -1, -1, + 198, 199, 200, -1, -1, 201, -1, -1, -1, -1, + -1, -1, -1, 202, 203, -1, -1, -1, -1, -1, + -1, 204, -1, 205, -1, -1, -1, -1, -1, -1, + 206, -1, -1, -1, 207, -1, 208, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 209, -1, + -1, -1, 210, -1, 211, -1, 212, -1, -1, 213, + -1, -1, -1, 214, -1, -1, -1, 215, -1, -1, + -1, 216, -1, -1, -1, -1, 217, 218, -1, -1, + 219, 220, -1, 221, -1, -1, 222, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 223, -1, -1, 224, + -1, -1, -1, -1, -1, -1, -1, 225, 226, 227, + -1, 228, -1, -1, -1, 229, -1, -1, -1, 230, + -1, -1, 231, -1, -1, -1, -1, -1, 232, -1, + -1, 233, -1, -1, -1, -1, -1, -1, -1, -1, + 234, -1, -1, -1, -1, -1, 235, 236, -1, -1, + -1, -1, -1, -1, 237, -1, -1, -1, -1, -1, + -1, 238, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 239, + 240, 241, -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, 240, -1, -1, -1, -1, -1, 241, -1, - -1, -1, -1, -1, -1, 242, -1, -1, -1, -1, + -1, -1, 242, -1, -1, -1, -1, -1, 243, -1, + -1, -1, -1, -1, -1, 244, -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, 243, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 245, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 244, -1, -1, 245, -1, -1, -1, -1, -1, 246, - -1, -1, -1, -1, 247, 248, -1, -1, -1, -1, - 249, -1, -1, 250, -1, -1, -1, -1, -1, -1, + 246, -1, -1, 247, -1, -1, -1, -1, -1, 248, + -1, -1, -1, -1, 249, 250, -1, -1, -1, -1, + 251, -1, -1, 252, -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, 251, - -1, -1, -1, -1, -1, 252, -1, -1, -1, -1, - -1, -1, -1, 253, -1, -1, -1, -1, -1, -1, - -1, -1, 254, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 253, + -1, -1, -1, -1, -1, 254, -1, -1, -1, -1, + -1, -1, -1, 255, -1, -1, -1, -1, -1, -1, + -1, -1, 256, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 255, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 257, -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, 256, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 258, -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, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 257, -1, -1, -1, -1, 258, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 259, -1, 260, + -1, -1, 259, -1, -1, -1, -1, 260, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 261, -1, 262, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 261, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 262, -1, - 263, -1, -1, -1, -1, -1, -1, 264, -1, -1, - -1, -1, -1, 265, -1, -1, -1, -1, -1, -1, + 263, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 264, -1, + 265, -1, -1, -1, -1, -1, -1, 266, -1, -1, + -1, -1, -1, 267, -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, - 266, -1, -1, -1, -1, -1, 267, -1, -1, -1, + 268, -1, -1, -1, -1, -1, 269, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 268, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 270, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 269, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 271, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 270, -1, -1, -1, -1, 271, -1, -1, + -1, -1, 272, -1, -1, -1, -1, 273, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 274, -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, -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, 273, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 275, -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, @@ -939,10 +943,10 @@ findProp (register const char *str, register unsigned int len) -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, -1, 274, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 276, -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, 275, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 277, -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, -1, -1, -1, -1, -1, @@ -956,7 +960,7 @@ findProp (register const char *str, register unsigned int len) -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, -1, -1, -1, -1, -1, -1, -1, 276, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 278, -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, @@ -976,7 +980,7 @@ findProp (register const char *str, register unsigned int len) -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, -1, -1, 277 + -1, -1, -1, 279 }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) @@ -998,9 +1002,9 @@ findProp (register const char *str, register unsigned int len) } return 0; } -#line 288 "CSSPropertyNames.gperf" +#line 290 "CSSPropertyNames.gperf" -static const char * const propertyNameStrings[278] = { +static const char * const propertyNameStrings[280] = { "background", "background-attachment", "background-clip", @@ -1153,6 +1157,7 @@ static const char * const propertyNameStrings[278] = { "-webkit-background-clip", "-webkit-background-composite", "-webkit-background-origin", +"-webkit-background-size", "-webkit-binding", "-webkit-border-fit", "-webkit-border-horizontal-spacing", @@ -1279,6 +1284,7 @@ static const char * const propertyNameStrings[278] = { "kerning", "text-anchor", "writing-mode", +"-webkit-shadow", }; const char* getPropertyName(CSSPropertyID id) { diff --git a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h index f1332e3..8957af8 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h +++ b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.h @@ -157,136 +157,138 @@ enum CSSPropertyID { CSSPropertyWebkitBackgroundClip = 1150, CSSPropertyWebkitBackgroundComposite = 1151, CSSPropertyWebkitBackgroundOrigin = 1152, - CSSPropertyWebkitBinding = 1153, - CSSPropertyWebkitBorderFit = 1154, - CSSPropertyWebkitBorderHorizontalSpacing = 1155, - CSSPropertyWebkitBorderImage = 1156, - CSSPropertyWebkitBorderRadius = 1157, - CSSPropertyWebkitBorderVerticalSpacing = 1158, - CSSPropertyWebkitBoxAlign = 1159, - CSSPropertyWebkitBoxDirection = 1160, - CSSPropertyWebkitBoxFlex = 1161, - CSSPropertyWebkitBoxFlexGroup = 1162, - CSSPropertyWebkitBoxLines = 1163, - CSSPropertyWebkitBoxOrdinalGroup = 1164, - CSSPropertyWebkitBoxOrient = 1165, - CSSPropertyWebkitBoxPack = 1166, - CSSPropertyWebkitBoxReflect = 1167, - CSSPropertyWebkitBoxShadow = 1168, - CSSPropertyWebkitBoxSizing = 1169, - CSSPropertyWebkitColumnBreakAfter = 1170, - CSSPropertyWebkitColumnBreakBefore = 1171, - CSSPropertyWebkitColumnBreakInside = 1172, - CSSPropertyWebkitColumnCount = 1173, - CSSPropertyWebkitColumnGap = 1174, - CSSPropertyWebkitColumnRule = 1175, - CSSPropertyWebkitColumnRuleColor = 1176, - CSSPropertyWebkitColumnRuleStyle = 1177, - CSSPropertyWebkitColumnRuleWidth = 1178, - CSSPropertyWebkitColumnWidth = 1179, - CSSPropertyWebkitColumns = 1180, - CSSPropertyWebkitFontSizeDelta = 1181, - CSSPropertyWebkitFontSmoothing = 1182, - CSSPropertyWebkitHighlight = 1183, - CSSPropertyWebkitLineBreak = 1184, - CSSPropertyWebkitLineClamp = 1185, - CSSPropertyWebkitMarginBottomCollapse = 1186, - CSSPropertyWebkitMarginCollapse = 1187, - CSSPropertyWebkitMarginStart = 1188, - CSSPropertyWebkitMarginTopCollapse = 1189, - CSSPropertyWebkitMarquee = 1190, - CSSPropertyWebkitMarqueeDirection = 1191, - CSSPropertyWebkitMarqueeIncrement = 1192, - CSSPropertyWebkitMarqueeRepetition = 1193, - CSSPropertyWebkitMarqueeSpeed = 1194, - CSSPropertyWebkitMarqueeStyle = 1195, - CSSPropertyWebkitMask = 1196, - CSSPropertyWebkitMaskAttachment = 1197, - CSSPropertyWebkitMaskBoxImage = 1198, - CSSPropertyWebkitMaskClip = 1199, - CSSPropertyWebkitMaskComposite = 1200, - CSSPropertyWebkitMaskImage = 1201, - CSSPropertyWebkitMaskOrigin = 1202, - CSSPropertyWebkitMaskPosition = 1203, - CSSPropertyWebkitMaskPositionX = 1204, - CSSPropertyWebkitMaskPositionY = 1205, - CSSPropertyWebkitMaskRepeat = 1206, - CSSPropertyWebkitMaskRepeatX = 1207, - CSSPropertyWebkitMaskRepeatY = 1208, - CSSPropertyWebkitMaskSize = 1209, - CSSPropertyWebkitMatchNearestMailBlockquoteColor = 1210, - CSSPropertyWebkitNbspMode = 1211, - CSSPropertyWebkitPaddingStart = 1212, - CSSPropertyWebkitPerspective = 1213, - CSSPropertyWebkitPerspectiveOrigin = 1214, - CSSPropertyWebkitPerspectiveOriginX = 1215, - CSSPropertyWebkitPerspectiveOriginY = 1216, - CSSPropertyWebkitRtlOrdering = 1217, - CSSPropertyWebkitTextDecorationsInEffect = 1218, - CSSPropertyWebkitTextFillColor = 1219, - CSSPropertyWebkitTextSecurity = 1220, - CSSPropertyWebkitTextSizeAdjust = 1221, - CSSPropertyWebkitTextStroke = 1222, - CSSPropertyWebkitTextStrokeColor = 1223, - CSSPropertyWebkitTextStrokeWidth = 1224, - CSSPropertyWebkitTransform = 1225, - CSSPropertyWebkitTransformOrigin = 1226, - CSSPropertyWebkitTransformOriginX = 1227, - CSSPropertyWebkitTransformOriginY = 1228, - CSSPropertyWebkitTransformOriginZ = 1229, - CSSPropertyWebkitTransformStyle = 1230, - CSSPropertyWebkitTransition = 1231, - CSSPropertyWebkitTransitionDelay = 1232, - CSSPropertyWebkitTransitionDuration = 1233, - CSSPropertyWebkitTransitionProperty = 1234, - CSSPropertyWebkitTransitionTimingFunction = 1235, - CSSPropertyWebkitUserDrag = 1236, - CSSPropertyWebkitUserModify = 1237, - CSSPropertyWebkitUserSelect = 1238, - CSSPropertyWebkitVariableDeclarationBlock = 1239, - CSSPropertyClipPath = 1240, - CSSPropertyClipRule = 1241, - CSSPropertyMask = 1242, - CSSPropertyEnableBackground = 1243, - CSSPropertyFilter = 1244, - CSSPropertyFloodColor = 1245, - CSSPropertyFloodOpacity = 1246, - CSSPropertyLightingColor = 1247, - CSSPropertyStopColor = 1248, - CSSPropertyStopOpacity = 1249, - CSSPropertyColorInterpolation = 1250, - CSSPropertyColorInterpolationFilters = 1251, - CSSPropertyColorProfile = 1252, - CSSPropertyColorRendering = 1253, - CSSPropertyFill = 1254, - CSSPropertyFillOpacity = 1255, - CSSPropertyFillRule = 1256, - CSSPropertyImageRendering = 1257, - CSSPropertyMarker = 1258, - CSSPropertyMarkerEnd = 1259, - CSSPropertyMarkerMid = 1260, - CSSPropertyMarkerStart = 1261, - CSSPropertyShapeRendering = 1262, - CSSPropertyStroke = 1263, - CSSPropertyStrokeDasharray = 1264, - CSSPropertyStrokeDashoffset = 1265, - CSSPropertyStrokeLinecap = 1266, - CSSPropertyStrokeLinejoin = 1267, - CSSPropertyStrokeMiterlimit = 1268, - CSSPropertyStrokeOpacity = 1269, - CSSPropertyStrokeWidth = 1270, - CSSPropertyAlignmentBaseline = 1271, - CSSPropertyBaselineShift = 1272, - CSSPropertyDominantBaseline = 1273, - CSSPropertyGlyphOrientationHorizontal = 1274, - CSSPropertyGlyphOrientationVertical = 1275, - CSSPropertyKerning = 1276, - CSSPropertyTextAnchor = 1277, - CSSPropertyWritingMode = 1278, + CSSPropertyWebkitBackgroundSize = 1153, + CSSPropertyWebkitBinding = 1154, + CSSPropertyWebkitBorderFit = 1155, + CSSPropertyWebkitBorderHorizontalSpacing = 1156, + CSSPropertyWebkitBorderImage = 1157, + CSSPropertyWebkitBorderRadius = 1158, + CSSPropertyWebkitBorderVerticalSpacing = 1159, + CSSPropertyWebkitBoxAlign = 1160, + CSSPropertyWebkitBoxDirection = 1161, + CSSPropertyWebkitBoxFlex = 1162, + CSSPropertyWebkitBoxFlexGroup = 1163, + CSSPropertyWebkitBoxLines = 1164, + CSSPropertyWebkitBoxOrdinalGroup = 1165, + CSSPropertyWebkitBoxOrient = 1166, + CSSPropertyWebkitBoxPack = 1167, + CSSPropertyWebkitBoxReflect = 1168, + CSSPropertyWebkitBoxShadow = 1169, + CSSPropertyWebkitBoxSizing = 1170, + CSSPropertyWebkitColumnBreakAfter = 1171, + CSSPropertyWebkitColumnBreakBefore = 1172, + CSSPropertyWebkitColumnBreakInside = 1173, + CSSPropertyWebkitColumnCount = 1174, + CSSPropertyWebkitColumnGap = 1175, + CSSPropertyWebkitColumnRule = 1176, + CSSPropertyWebkitColumnRuleColor = 1177, + CSSPropertyWebkitColumnRuleStyle = 1178, + CSSPropertyWebkitColumnRuleWidth = 1179, + CSSPropertyWebkitColumnWidth = 1180, + CSSPropertyWebkitColumns = 1181, + CSSPropertyWebkitFontSizeDelta = 1182, + CSSPropertyWebkitFontSmoothing = 1183, + CSSPropertyWebkitHighlight = 1184, + CSSPropertyWebkitLineBreak = 1185, + CSSPropertyWebkitLineClamp = 1186, + CSSPropertyWebkitMarginBottomCollapse = 1187, + CSSPropertyWebkitMarginCollapse = 1188, + CSSPropertyWebkitMarginStart = 1189, + CSSPropertyWebkitMarginTopCollapse = 1190, + CSSPropertyWebkitMarquee = 1191, + CSSPropertyWebkitMarqueeDirection = 1192, + CSSPropertyWebkitMarqueeIncrement = 1193, + CSSPropertyWebkitMarqueeRepetition = 1194, + CSSPropertyWebkitMarqueeSpeed = 1195, + CSSPropertyWebkitMarqueeStyle = 1196, + CSSPropertyWebkitMask = 1197, + CSSPropertyWebkitMaskAttachment = 1198, + CSSPropertyWebkitMaskBoxImage = 1199, + CSSPropertyWebkitMaskClip = 1200, + CSSPropertyWebkitMaskComposite = 1201, + CSSPropertyWebkitMaskImage = 1202, + CSSPropertyWebkitMaskOrigin = 1203, + CSSPropertyWebkitMaskPosition = 1204, + CSSPropertyWebkitMaskPositionX = 1205, + CSSPropertyWebkitMaskPositionY = 1206, + CSSPropertyWebkitMaskRepeat = 1207, + CSSPropertyWebkitMaskRepeatX = 1208, + CSSPropertyWebkitMaskRepeatY = 1209, + CSSPropertyWebkitMaskSize = 1210, + CSSPropertyWebkitMatchNearestMailBlockquoteColor = 1211, + CSSPropertyWebkitNbspMode = 1212, + CSSPropertyWebkitPaddingStart = 1213, + CSSPropertyWebkitPerspective = 1214, + CSSPropertyWebkitPerspectiveOrigin = 1215, + CSSPropertyWebkitPerspectiveOriginX = 1216, + CSSPropertyWebkitPerspectiveOriginY = 1217, + CSSPropertyWebkitRtlOrdering = 1218, + CSSPropertyWebkitTextDecorationsInEffect = 1219, + CSSPropertyWebkitTextFillColor = 1220, + CSSPropertyWebkitTextSecurity = 1221, + CSSPropertyWebkitTextSizeAdjust = 1222, + CSSPropertyWebkitTextStroke = 1223, + CSSPropertyWebkitTextStrokeColor = 1224, + CSSPropertyWebkitTextStrokeWidth = 1225, + CSSPropertyWebkitTransform = 1226, + CSSPropertyWebkitTransformOrigin = 1227, + CSSPropertyWebkitTransformOriginX = 1228, + CSSPropertyWebkitTransformOriginY = 1229, + CSSPropertyWebkitTransformOriginZ = 1230, + CSSPropertyWebkitTransformStyle = 1231, + CSSPropertyWebkitTransition = 1232, + CSSPropertyWebkitTransitionDelay = 1233, + CSSPropertyWebkitTransitionDuration = 1234, + CSSPropertyWebkitTransitionProperty = 1235, + CSSPropertyWebkitTransitionTimingFunction = 1236, + CSSPropertyWebkitUserDrag = 1237, + CSSPropertyWebkitUserModify = 1238, + CSSPropertyWebkitUserSelect = 1239, + CSSPropertyWebkitVariableDeclarationBlock = 1240, + CSSPropertyClipPath = 1241, + CSSPropertyClipRule = 1242, + CSSPropertyMask = 1243, + CSSPropertyEnableBackground = 1244, + CSSPropertyFilter = 1245, + CSSPropertyFloodColor = 1246, + CSSPropertyFloodOpacity = 1247, + CSSPropertyLightingColor = 1248, + CSSPropertyStopColor = 1249, + CSSPropertyStopOpacity = 1250, + CSSPropertyColorInterpolation = 1251, + CSSPropertyColorInterpolationFilters = 1252, + CSSPropertyColorProfile = 1253, + CSSPropertyColorRendering = 1254, + CSSPropertyFill = 1255, + CSSPropertyFillOpacity = 1256, + CSSPropertyFillRule = 1257, + CSSPropertyImageRendering = 1258, + CSSPropertyMarker = 1259, + CSSPropertyMarkerEnd = 1260, + CSSPropertyMarkerMid = 1261, + CSSPropertyMarkerStart = 1262, + CSSPropertyShapeRendering = 1263, + CSSPropertyStroke = 1264, + CSSPropertyStrokeDasharray = 1265, + CSSPropertyStrokeDashoffset = 1266, + CSSPropertyStrokeLinecap = 1267, + CSSPropertyStrokeLinejoin = 1268, + CSSPropertyStrokeMiterlimit = 1269, + CSSPropertyStrokeOpacity = 1270, + CSSPropertyStrokeWidth = 1271, + CSSPropertyAlignmentBaseline = 1272, + CSSPropertyBaselineShift = 1273, + CSSPropertyDominantBaseline = 1274, + CSSPropertyGlyphOrientationHorizontal = 1275, + CSSPropertyGlyphOrientationVertical = 1276, + CSSPropertyKerning = 1277, + CSSPropertyTextAnchor = 1278, + CSSPropertyWritingMode = 1279, + CSSPropertyWebkitShadow = 1280, }; const int firstCSSProperty = 1001; -const int numCSSProperties = 278; +const int numCSSProperties = 280; const size_t maxCSSPropertyNameLength = 43; const char* getPropertyName(CSSPropertyID); diff --git a/src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp b/src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp index d472340..bee17ac 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSAbstractWorker.cpp @@ -149,7 +149,7 @@ JSAbstractWorker::JSAbstractWorker(NonNullPassRefPtr<Structure> structure, JSDOM JSAbstractWorker::~JSAbstractWorker() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } void JSAbstractWorker::markChildren(MarkStack& markStack) @@ -199,7 +199,7 @@ void setJSAbstractWorkerOnerror(ExecState* exec, JSObject* thisObject, JSValue v { UNUSED_PARAM(exec); AbstractWorker* imp = static_cast<AbstractWorker*>(static_cast<JSAbstractWorker*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp b/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp index 2f02580..348c086 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSBarInfo.cpp @@ -76,7 +76,7 @@ JSBarInfo::JSBarInfo(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* JSBarInfo::~JSBarInfo() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSBarInfo::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp index 307b17a..8d99056 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSRule.cpp @@ -162,7 +162,7 @@ JSCSSRule::JSCSSRule(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* JSCSSRule::~JSCSSRule() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCSSRule::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp index e02a6ce..0bb58c2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSRuleList.cpp @@ -140,7 +140,7 @@ JSCSSRuleList::JSCSSRuleList(NonNullPassRefPtr<Structure> structure, JSDOMGlobal JSCSSRuleList::~JSCSSRuleList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCSSRuleList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp index 6292b64..5fbf986 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSStyleDeclaration.cpp @@ -154,7 +154,7 @@ JSCSSStyleDeclaration::JSCSSStyleDeclaration(NonNullPassRefPtr<Structure> struct JSCSSStyleDeclaration::~JSCSSStyleDeclaration() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCSSStyleDeclaration::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp index 22f6c30..1cb1b75 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSValue.cpp @@ -145,7 +145,7 @@ JSCSSValue::JSCSSValue(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject JSCSSValue::~JSCSSValue() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCSSValue::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp b/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp index ef1d726..975d56d 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.cpp @@ -147,7 +147,7 @@ JSCSSVariablesDeclaration::JSCSSVariablesDeclaration(NonNullPassRefPtr<Structure JSCSSVariablesDeclaration::~JSCSSVariablesDeclaration() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCSSVariablesDeclaration::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp index aeeeb4f..05be08c 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp @@ -93,7 +93,7 @@ JSCanvasArray::JSCanvasArray(NonNullPassRefPtr<Structure> structure, JSDOMGlobal JSCanvasArray::~JSCanvasArray() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCanvasArray::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp index cf1c0fe..7099ce9 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp @@ -80,7 +80,7 @@ JSCanvasArrayBuffer::JSCanvasArrayBuffer(NonNullPassRefPtr<Structure> structure, JSCanvasArrayBuffer::~JSCanvasArrayBuffer() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCanvasArrayBuffer::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp index 22de482..4d2bfa3 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp @@ -74,7 +74,7 @@ JSCanvasGradient::JSCanvasGradient(NonNullPassRefPtr<Structure> structure, JSDOM JSCanvasGradient::~JSCanvasGradient() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCanvasGradient::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp index 7356770..cfb521b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasPattern.cpp @@ -61,7 +61,7 @@ JSCanvasPattern::JSCanvasPattern(NonNullPassRefPtr<Structure> structure, JSDOMGl JSCanvasPattern::~JSCanvasPattern() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCanvasPattern::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp b/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp index 1d06dfe..07710a1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext.cpp @@ -126,7 +126,7 @@ JSCanvasRenderingContext::JSCanvasRenderingContext(NonNullPassRefPtr<Structure> JSCanvasRenderingContext::~JSCanvasRenderingContext() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCanvasRenderingContext::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp index 175d660..48dccd3 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSClientRect.cpp @@ -130,7 +130,7 @@ JSClientRect::JSClientRect(NonNullPassRefPtr<Structure> structure, JSDOMGlobalOb JSClientRect::~JSClientRect() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSClientRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp b/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp index 143ee8c..ff9d963 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSClientRectList.cpp @@ -141,7 +141,7 @@ JSClientRectList::JSClientRectList(NonNullPassRefPtr<Structure> structure, JSDOM JSClientRectList::~JSClientRectList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSClientRectList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp b/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp index f72e341..8f4a7d4 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSClipboard.cpp @@ -145,7 +145,7 @@ JSClipboard::JSClipboard(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObje JSClipboard::~JSClipboard() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSClipboard::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp b/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp index 4bb40c6..0657890 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSConsole.cpp @@ -104,7 +104,7 @@ JSConsole::JSConsole(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* JSConsole::~JSConsole() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSConsole::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp b/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp index 6919ad2..348bcc6 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCoordinates.cpp @@ -83,7 +83,7 @@ JSCoordinates::JSCoordinates(NonNullPassRefPtr<Structure> structure, JSDOMGlobal JSCoordinates::~JSCoordinates() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCoordinates::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp b/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp index d17a368..7c22959 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSCounter.cpp @@ -128,7 +128,7 @@ JSCounter::JSCounter(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* JSCounter::~JSCounter() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSCounter::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp index 2b65699..17a527e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMApplicationCache.cpp @@ -118,7 +118,7 @@ JSDOMApplicationCache::JSDOMApplicationCache(NonNullPassRefPtr<Structure> struct JSDOMApplicationCache::~JSDOMApplicationCache() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } void JSDOMApplicationCache::markChildren(MarkStack& markStack) @@ -255,7 +255,7 @@ void setJSDOMApplicationCacheOnchecking(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnchecking(globalObject->createJSAttributeEventListener(value)); @@ -265,7 +265,7 @@ void setJSDOMApplicationCacheOnerror(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); @@ -275,7 +275,7 @@ void setJSDOMApplicationCacheOnnoupdate(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnnoupdate(globalObject->createJSAttributeEventListener(value)); @@ -285,7 +285,7 @@ void setJSDOMApplicationCacheOndownloading(ExecState* exec, JSObject* thisObject { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndownloading(globalObject->createJSAttributeEventListener(value)); @@ -295,7 +295,7 @@ void setJSDOMApplicationCacheOnprogress(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnprogress(globalObject->createJSAttributeEventListener(value)); @@ -305,7 +305,7 @@ void setJSDOMApplicationCacheOnupdateready(ExecState* exec, JSObject* thisObject { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnupdateready(globalObject->createJSAttributeEventListener(value)); @@ -315,7 +315,7 @@ void setJSDOMApplicationCacheOncached(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncached(globalObject->createJSAttributeEventListener(value)); @@ -325,7 +325,7 @@ void setJSDOMApplicationCacheOnobsolete(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnobsolete(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp index d625e2b..ff88905 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMCoreException.cpp @@ -185,7 +185,7 @@ JSDOMCoreException::JSDOMCoreException(NonNullPassRefPtr<Structure> structure, J JSDOMCoreException::~JSDOMCoreException() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDOMCoreException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp index 62eef6c..268647b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMImplementation.cpp @@ -148,7 +148,7 @@ JSDOMImplementation::JSDOMImplementation(NonNullPassRefPtr<Structure> structure, JSDOMImplementation::~JSDOMImplementation() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDOMImplementation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp index 4af88cb..ecd336a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMParser.cpp @@ -147,7 +147,7 @@ JSDOMParser::JSDOMParser(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObje JSDOMParser::~JSDOMParser() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDOMParser::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp index 45ec248..e3a69b0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMSelection.cpp @@ -119,7 +119,7 @@ JSDOMSelection::JSDOMSelection(NonNullPassRefPtr<Structure> structure, JSDOMGlob JSDOMSelection::~JSDOMSelection() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDOMSelection::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp index dc53217..12edc42 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp @@ -92,6 +92,7 @@ #include "JSEventSource.h" #include "JSFile.h" #include "JSFileList.h" +#include "JSHTMLAllCollection.h" #include "JSHTMLAnchorElement.h" #include "JSHTMLAppletElement.h" #include "JSHTMLAreaElement.h" @@ -246,7 +247,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSDOMWindow); /* Hash table */ -static const HashTableValue JSDOMWindowTableValues[296] = +static const HashTableValue JSDOMWindowTableValues[297] = { { "screen", DontDelete|ReadOnly, (intptr_t)jsDOMWindowScreen, (intptr_t)0 }, { "history", DontDelete|ReadOnly, (intptr_t)jsDOMWindowHistory, (intptr_t)0 }, @@ -468,6 +469,7 @@ static const HashTableValue JSDOMWindowTableValues[296] = { "HTMLTitleElement", DontDelete, (intptr_t)jsDOMWindowHTMLTitleElementConstructor, (intptr_t)setJSDOMWindowHTMLTitleElementConstructor }, { "HTMLUListElement", DontDelete, (intptr_t)jsDOMWindowHTMLUListElementConstructor, (intptr_t)setJSDOMWindowHTMLUListElementConstructor }, { "HTMLCollection", DontDelete, (intptr_t)jsDOMWindowHTMLCollectionConstructor, (intptr_t)setJSDOMWindowHTMLCollectionConstructor }, + { "HTMLAllCollection", DontDelete, (intptr_t)jsDOMWindowHTMLAllCollectionConstructor, (intptr_t)setJSDOMWindowHTMLAllCollectionConstructor }, { "Image", DontDelete, (intptr_t)jsDOMWindowImageConstructor, (intptr_t)setJSDOMWindowImageConstructor }, { "Option", DontDelete, (intptr_t)jsDOMWindowOptionConstructor, (intptr_t)setJSDOMWindowOptionConstructor }, { "CanvasRenderingContext2D", DontDelete, (intptr_t)jsDOMWindowCanvasRenderingContext2DConstructor, (intptr_t)setJSDOMWindowCanvasRenderingContext2DConstructor }, @@ -666,7 +668,6 @@ JSDOMWindow::JSDOMWindow(NonNullPassRefPtr<Structure> structure, PassRefPtr<DOMW JSDOMWindow::~JSDOMWindow() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } JSValue jsDOMWindowScreen(ExecState* exec, const Identifier&, const PropertySlot& slot) @@ -2846,6 +2847,14 @@ JSValue jsDOMWindowHTMLCollectionConstructor(ExecState* exec, const Identifier&, return JSHTMLCollection::getConstructor(exec, castedThis); } +JSValue jsDOMWindowHTMLAllCollectionConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) +{ + JSDOMWindow* castedThis = static_cast<JSDOMWindow*>(asObject(slot.slotBase())); + if (!castedThis->allowsAccessFrom(exec)) + return jsUndefined(); + return JSHTMLAllCollection::getConstructor(exec, castedThis); +} + JSValue jsDOMWindowImageConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) { JSDOMWindow* castedThis = static_cast<JSDOMWindow*>(asObject(slot.slotBase())); @@ -5261,6 +5270,14 @@ void setJSDOMWindowHTMLCollectionConstructor(ExecState* exec, JSObject* thisObje static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "HTMLCollection"), value); } +void setJSDOMWindowHTMLAllCollectionConstructor(ExecState* exec, JSObject* thisObject, JSValue value) +{ + if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec)) + return; + // Shadowing a built-in constructor + static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "HTMLAllCollection"), value); +} + void setJSDOMWindowImageConstructor(ExecState* exec, JSObject* thisObject, JSValue value) { if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec)) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h index 232c8eb..afc8106 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h @@ -577,6 +577,8 @@ JSC::JSValue jsDOMWindowHTMLUListElementConstructor(JSC::ExecState*, const JSC:: void setJSDOMWindowHTMLUListElementConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowHTMLCollectionConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); void setJSDOMWindowHTMLCollectionConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsDOMWindowHTMLAllCollectionConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); +void setJSDOMWindowHTMLAllCollectionConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowImageConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); void setJSDOMWindowImageConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowOptionConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); diff --git a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp index 586edd1..42b91d1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumn.cpp @@ -157,7 +157,7 @@ JSDataGridColumn::JSDataGridColumn(NonNullPassRefPtr<Structure> structure, JSDOM JSDataGridColumn::~JSDataGridColumn() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDataGridColumn::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp index 08585fe..945c257 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDataGridColumnList.cpp @@ -151,7 +151,7 @@ JSDataGridColumnList::JSDataGridColumnList(NonNullPassRefPtr<Structure> structur JSDataGridColumnList::~JSDataGridColumnList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDataGridColumnList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp b/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp index 5acd5b1..c5ac44d 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDatabase.cpp @@ -95,7 +95,7 @@ JSDatabase::JSDatabase(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject JSDatabase::~JSDatabase() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSDatabase::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDocument.cpp b/src/3rdparty/webkit/WebCore/generated/JSDocument.cpp index 47a2936..1fb3b46 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDocument.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDocument.cpp @@ -304,7 +304,7 @@ JSDocument::JSDocument(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject JSDocument::~JSDocument() { - forgetDOMObject(*Heap::heap(this)->globalData(), static_cast<Document*>(impl())); + forgetDOMObject(this, static_cast<Document*>(impl())); } JSObject* JSDocument::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -1099,7 +1099,7 @@ void setJSDocumentOnabort(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnabort(globalObject->createJSAttributeEventListener(value)); @@ -1109,7 +1109,7 @@ void setJSDocumentOnblur(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnblur(globalObject->createJSAttributeEventListener(value)); @@ -1119,7 +1119,7 @@ void setJSDocumentOnchange(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnchange(globalObject->createJSAttributeEventListener(value)); @@ -1129,7 +1129,7 @@ void setJSDocumentOnclick(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnclick(globalObject->createJSAttributeEventListener(value)); @@ -1139,7 +1139,7 @@ void setJSDocumentOncontextmenu(ExecState* exec, JSObject* thisObject, JSValue v { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncontextmenu(globalObject->createJSAttributeEventListener(value)); @@ -1149,7 +1149,7 @@ void setJSDocumentOndblclick(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndblclick(globalObject->createJSAttributeEventListener(value)); @@ -1159,7 +1159,7 @@ void setJSDocumentOndrag(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndrag(globalObject->createJSAttributeEventListener(value)); @@ -1169,7 +1169,7 @@ void setJSDocumentOndragend(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragend(globalObject->createJSAttributeEventListener(value)); @@ -1179,7 +1179,7 @@ void setJSDocumentOndragenter(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragenter(globalObject->createJSAttributeEventListener(value)); @@ -1189,7 +1189,7 @@ void setJSDocumentOndragleave(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragleave(globalObject->createJSAttributeEventListener(value)); @@ -1199,7 +1199,7 @@ void setJSDocumentOndragover(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragover(globalObject->createJSAttributeEventListener(value)); @@ -1209,7 +1209,7 @@ void setJSDocumentOndragstart(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragstart(globalObject->createJSAttributeEventListener(value)); @@ -1219,7 +1219,7 @@ void setJSDocumentOndrop(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndrop(globalObject->createJSAttributeEventListener(value)); @@ -1229,7 +1229,7 @@ void setJSDocumentOnerror(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); @@ -1239,7 +1239,7 @@ void setJSDocumentOnfocus(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnfocus(globalObject->createJSAttributeEventListener(value)); @@ -1249,7 +1249,7 @@ void setJSDocumentOninput(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOninput(globalObject->createJSAttributeEventListener(value)); @@ -1259,7 +1259,7 @@ void setJSDocumentOninvalid(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOninvalid(globalObject->createJSAttributeEventListener(value)); @@ -1269,7 +1269,7 @@ void setJSDocumentOnkeydown(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeydown(globalObject->createJSAttributeEventListener(value)); @@ -1279,7 +1279,7 @@ void setJSDocumentOnkeypress(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeypress(globalObject->createJSAttributeEventListener(value)); @@ -1289,7 +1289,7 @@ void setJSDocumentOnkeyup(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeyup(globalObject->createJSAttributeEventListener(value)); @@ -1299,7 +1299,7 @@ void setJSDocumentOnload(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnload(globalObject->createJSAttributeEventListener(value)); @@ -1309,7 +1309,7 @@ void setJSDocumentOnmousedown(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousedown(globalObject->createJSAttributeEventListener(value)); @@ -1319,7 +1319,7 @@ void setJSDocumentOnmousemove(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousemove(globalObject->createJSAttributeEventListener(value)); @@ -1329,7 +1329,7 @@ void setJSDocumentOnmouseout(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseout(globalObject->createJSAttributeEventListener(value)); @@ -1339,7 +1339,7 @@ void setJSDocumentOnmouseover(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseover(globalObject->createJSAttributeEventListener(value)); @@ -1349,7 +1349,7 @@ void setJSDocumentOnmouseup(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseup(globalObject->createJSAttributeEventListener(value)); @@ -1359,7 +1359,7 @@ void setJSDocumentOnmousewheel(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousewheel(globalObject->createJSAttributeEventListener(value)); @@ -1369,7 +1369,7 @@ void setJSDocumentOnscroll(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnscroll(globalObject->createJSAttributeEventListener(value)); @@ -1379,7 +1379,7 @@ void setJSDocumentOnselect(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnselect(globalObject->createJSAttributeEventListener(value)); @@ -1389,7 +1389,7 @@ void setJSDocumentOnsubmit(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnsubmit(globalObject->createJSAttributeEventListener(value)); @@ -1399,7 +1399,7 @@ void setJSDocumentOnbeforecut(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforecut(globalObject->createJSAttributeEventListener(value)); @@ -1409,7 +1409,7 @@ void setJSDocumentOncut(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncut(globalObject->createJSAttributeEventListener(value)); @@ -1419,7 +1419,7 @@ void setJSDocumentOnbeforecopy(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforecopy(globalObject->createJSAttributeEventListener(value)); @@ -1429,7 +1429,7 @@ void setJSDocumentOncopy(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncopy(globalObject->createJSAttributeEventListener(value)); @@ -1439,7 +1439,7 @@ void setJSDocumentOnbeforepaste(ExecState* exec, JSObject* thisObject, JSValue v { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforepaste(globalObject->createJSAttributeEventListener(value)); @@ -1449,7 +1449,7 @@ void setJSDocumentOnpaste(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnpaste(globalObject->createJSAttributeEventListener(value)); @@ -1459,7 +1459,7 @@ void setJSDocumentOnreset(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnreset(globalObject->createJSAttributeEventListener(value)); @@ -1469,7 +1469,7 @@ void setJSDocumentOnsearch(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnsearch(globalObject->createJSAttributeEventListener(value)); @@ -1479,7 +1479,7 @@ void setJSDocumentOnselectstart(ExecState* exec, JSObject* thisObject, JSValue v { UNUSED_PARAM(exec); Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnselectstart(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSElement.cpp index 869c23f..3d3187f 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSElement.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSElement.cpp @@ -897,7 +897,7 @@ void setJSElementOnabort(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnabort(globalObject->createJSAttributeEventListener(value)); @@ -907,7 +907,7 @@ void setJSElementOnblur(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnblur(globalObject->createJSAttributeEventListener(value)); @@ -917,7 +917,7 @@ void setJSElementOnchange(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnchange(globalObject->createJSAttributeEventListener(value)); @@ -927,7 +927,7 @@ void setJSElementOnclick(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnclick(globalObject->createJSAttributeEventListener(value)); @@ -937,7 +937,7 @@ void setJSElementOncontextmenu(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncontextmenu(globalObject->createJSAttributeEventListener(value)); @@ -947,7 +947,7 @@ void setJSElementOndblclick(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndblclick(globalObject->createJSAttributeEventListener(value)); @@ -957,7 +957,7 @@ void setJSElementOndrag(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndrag(globalObject->createJSAttributeEventListener(value)); @@ -967,7 +967,7 @@ void setJSElementOndragend(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragend(globalObject->createJSAttributeEventListener(value)); @@ -977,7 +977,7 @@ void setJSElementOndragenter(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragenter(globalObject->createJSAttributeEventListener(value)); @@ -987,7 +987,7 @@ void setJSElementOndragleave(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragleave(globalObject->createJSAttributeEventListener(value)); @@ -997,7 +997,7 @@ void setJSElementOndragover(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragover(globalObject->createJSAttributeEventListener(value)); @@ -1007,7 +1007,7 @@ void setJSElementOndragstart(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragstart(globalObject->createJSAttributeEventListener(value)); @@ -1017,7 +1017,7 @@ void setJSElementOndrop(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndrop(globalObject->createJSAttributeEventListener(value)); @@ -1027,7 +1027,7 @@ void setJSElementOnerror(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); @@ -1037,7 +1037,7 @@ void setJSElementOnfocus(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnfocus(globalObject->createJSAttributeEventListener(value)); @@ -1047,7 +1047,7 @@ void setJSElementOninput(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOninput(globalObject->createJSAttributeEventListener(value)); @@ -1057,7 +1057,7 @@ void setJSElementOninvalid(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOninvalid(globalObject->createJSAttributeEventListener(value)); @@ -1067,7 +1067,7 @@ void setJSElementOnkeydown(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeydown(globalObject->createJSAttributeEventListener(value)); @@ -1077,7 +1077,7 @@ void setJSElementOnkeypress(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeypress(globalObject->createJSAttributeEventListener(value)); @@ -1087,7 +1087,7 @@ void setJSElementOnkeyup(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeyup(globalObject->createJSAttributeEventListener(value)); @@ -1097,7 +1097,7 @@ void setJSElementOnload(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnload(globalObject->createJSAttributeEventListener(value)); @@ -1107,7 +1107,7 @@ void setJSElementOnmousedown(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousedown(globalObject->createJSAttributeEventListener(value)); @@ -1117,7 +1117,7 @@ void setJSElementOnmousemove(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousemove(globalObject->createJSAttributeEventListener(value)); @@ -1127,7 +1127,7 @@ void setJSElementOnmouseout(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseout(globalObject->createJSAttributeEventListener(value)); @@ -1137,7 +1137,7 @@ void setJSElementOnmouseover(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseover(globalObject->createJSAttributeEventListener(value)); @@ -1147,7 +1147,7 @@ void setJSElementOnmouseup(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseup(globalObject->createJSAttributeEventListener(value)); @@ -1157,7 +1157,7 @@ void setJSElementOnmousewheel(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousewheel(globalObject->createJSAttributeEventListener(value)); @@ -1167,7 +1167,7 @@ void setJSElementOnscroll(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnscroll(globalObject->createJSAttributeEventListener(value)); @@ -1177,7 +1177,7 @@ void setJSElementOnselect(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnselect(globalObject->createJSAttributeEventListener(value)); @@ -1187,7 +1187,7 @@ void setJSElementOnsubmit(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnsubmit(globalObject->createJSAttributeEventListener(value)); @@ -1197,7 +1197,7 @@ void setJSElementOnbeforecut(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforecut(globalObject->createJSAttributeEventListener(value)); @@ -1207,7 +1207,7 @@ void setJSElementOncut(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncut(globalObject->createJSAttributeEventListener(value)); @@ -1217,7 +1217,7 @@ void setJSElementOnbeforecopy(ExecState* exec, JSObject* thisObject, JSValue val { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforecopy(globalObject->createJSAttributeEventListener(value)); @@ -1227,7 +1227,7 @@ void setJSElementOncopy(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncopy(globalObject->createJSAttributeEventListener(value)); @@ -1237,7 +1237,7 @@ void setJSElementOnbeforepaste(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforepaste(globalObject->createJSAttributeEventListener(value)); @@ -1247,7 +1247,7 @@ void setJSElementOnpaste(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnpaste(globalObject->createJSAttributeEventListener(value)); @@ -1257,7 +1257,7 @@ void setJSElementOnreset(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnreset(globalObject->createJSAttributeEventListener(value)); @@ -1267,7 +1267,7 @@ void setJSElementOnsearch(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnsearch(globalObject->createJSAttributeEventListener(value)); @@ -1277,7 +1277,7 @@ void setJSElementOnselectstart(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); Element* imp = static_cast<Element*>(static_cast<JSElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnselectstart(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp b/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp index acd952f..67eefd0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSEvent.cpp @@ -199,7 +199,7 @@ JSEvent::JSEvent(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* glob JSEvent::~JSEvent() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp b/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp index 2246c8f..bd25734 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSEventException.cpp @@ -151,7 +151,7 @@ JSEventException::JSEventException(NonNullPassRefPtr<Structure> structure, JSDOM JSEventException::~JSEventException() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSEventException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp b/src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp index dcec14e..526d8af 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSEventSource.cpp @@ -120,7 +120,7 @@ JSEventSource::JSEventSource(NonNullPassRefPtr<Structure> structure, JSDOMGlobal JSEventSource::~JSEventSource() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } void JSEventSource::markChildren(MarkStack& markStack) @@ -205,7 +205,7 @@ void setJSEventSourceOnopen(ExecState* exec, JSObject* thisObject, JSValue value { UNUSED_PARAM(exec); EventSource* imp = static_cast<EventSource*>(static_cast<JSEventSource*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnopen(globalObject->createJSAttributeEventListener(value)); @@ -215,7 +215,7 @@ void setJSEventSourceOnmessage(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); EventSource* imp = static_cast<EventSource*>(static_cast<JSEventSource*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmessage(globalObject->createJSAttributeEventListener(value)); @@ -225,7 +225,7 @@ void setJSEventSourceOnerror(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); EventSource* imp = static_cast<EventSource*>(static_cast<JSEventSource*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSFile.cpp b/src/3rdparty/webkit/WebCore/generated/JSFile.cpp index 2ee62ae..59192af 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSFile.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSFile.cpp @@ -128,7 +128,7 @@ JSFile::JSFile(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* global JSFile::~JSFile() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSFile::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp b/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp index 931aae4..50e1f0a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSFileList.cpp @@ -141,7 +141,7 @@ JSFileList::JSFileList(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject JSFileList::~JSFileList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSFileList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp b/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp index 17a0509..be50fac 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp @@ -92,7 +92,7 @@ JSGeolocation::JSGeolocation(NonNullPassRefPtr<Structure> structure, JSDOMGlobal JSGeolocation::~JSGeolocation() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSGeolocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp b/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp index a77413b..ab42d2b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSGeoposition.cpp @@ -80,7 +80,7 @@ JSGeoposition::JSGeoposition(NonNullPassRefPtr<Structure> structure, JSDOMGlobal JSGeoposition::~JSGeoposition() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSGeoposition::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.cpp new file mode 100644 index 0000000..4a8fc83 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.cpp @@ -0,0 +1,292 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "JSHTMLAllCollection.h" + +#include "AtomicString.h" +#include "HTMLAllCollection.h" +#include "JSNode.h" +#include "JSNodeList.h" +#include "NameNodeList.h" +#include "Node.h" +#include "NodeList.h" +#include <runtime/Error.h> +#include <runtime/JSNumberCell.h> +#include <runtime/PropertyNameArray.h> +#include <wtf/GetPtr.h> + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSHTMLAllCollection); + +/* Hash table */ + +static const HashTableValue JSHTMLAllCollectionTableValues[3] = +{ + { "length", DontDelete|ReadOnly, (intptr_t)jsHTMLAllCollectionLength, (intptr_t)0 }, + { "constructor", DontEnum|ReadOnly, (intptr_t)jsHTMLAllCollectionConstructor, (intptr_t)0 }, + { 0, 0, 0, 0 } +}; + +static JSC_CONST_HASHTABLE HashTable JSHTMLAllCollectionTable = +#if ENABLE(PERFECT_HASH_SIZE) + { 15, JSHTMLAllCollectionTableValues, 0 }; +#else + { 5, 3, JSHTMLAllCollectionTableValues, 0 }; +#endif + +/* Hash table for constructor */ + +static const HashTableValue JSHTMLAllCollectionConstructorTableValues[1] = +{ + { 0, 0, 0, 0 } +}; + +static JSC_CONST_HASHTABLE HashTable JSHTMLAllCollectionConstructorTable = +#if ENABLE(PERFECT_HASH_SIZE) + { 0, JSHTMLAllCollectionConstructorTableValues, 0 }; +#else + { 1, 0, JSHTMLAllCollectionConstructorTableValues, 0 }; +#endif + +class JSHTMLAllCollectionConstructor : public DOMConstructorObject { +public: + JSHTMLAllCollectionConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSHTMLAllCollectionConstructor::createStructure(globalObject->objectPrototype()), globalObject) + { + putDirect(exec->propertyNames().prototype, JSHTMLAllCollectionPrototype::self(exec, globalObject), None); + } + virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); + virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); + virtual const ClassInfo* classInfo() const { return &s_info; } + static const ClassInfo s_info; + + static PassRefPtr<Structure> createStructure(JSValue proto) + { + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); + } + +protected: + static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags; +}; + +const ClassInfo JSHTMLAllCollectionConstructor::s_info = { "HTMLAllCollectionConstructor", 0, &JSHTMLAllCollectionConstructorTable, 0 }; + +bool JSHTMLAllCollectionConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSHTMLAllCollectionConstructor, DOMObject>(exec, &JSHTMLAllCollectionConstructorTable, this, propertyName, slot); +} + +bool JSHTMLAllCollectionConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSHTMLAllCollectionConstructor, DOMObject>(exec, &JSHTMLAllCollectionConstructorTable, this, propertyName, descriptor); +} + +/* Hash table for prototype */ + +static const HashTableValue JSHTMLAllCollectionPrototypeTableValues[4] = +{ + { "item", DontDelete|Function, (intptr_t)jsHTMLAllCollectionPrototypeFunctionItem, (intptr_t)1 }, + { "namedItem", DontDelete|Function, (intptr_t)jsHTMLAllCollectionPrototypeFunctionNamedItem, (intptr_t)1 }, + { "tags", DontDelete|Function, (intptr_t)jsHTMLAllCollectionPrototypeFunctionTags, (intptr_t)1 }, + { 0, 0, 0, 0 } +}; + +static JSC_CONST_HASHTABLE HashTable JSHTMLAllCollectionPrototypeTable = +#if ENABLE(PERFECT_HASH_SIZE) + { 7, JSHTMLAllCollectionPrototypeTableValues, 0 }; +#else + { 8, 7, JSHTMLAllCollectionPrototypeTableValues, 0 }; +#endif + +const ClassInfo JSHTMLAllCollectionPrototype::s_info = { "HTMLAllCollectionPrototype", 0, &JSHTMLAllCollectionPrototypeTable, 0 }; + +JSObject* JSHTMLAllCollectionPrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype<JSHTMLAllCollection>(exec, globalObject); +} + +bool JSHTMLAllCollectionPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticFunctionSlot<JSObject>(exec, &JSHTMLAllCollectionPrototypeTable, this, propertyName, slot); +} + +bool JSHTMLAllCollectionPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticFunctionDescriptor<JSObject>(exec, &JSHTMLAllCollectionPrototypeTable, this, propertyName, descriptor); +} + +const ClassInfo JSHTMLAllCollection::s_info = { "HTMLAllCollection", 0, &JSHTMLAllCollectionTable, 0 }; + +JSHTMLAllCollection::JSHTMLAllCollection(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLAllCollection> impl) + : DOMObjectWithGlobalPointer(structure, globalObject) + , m_impl(impl) +{ +} + +JSHTMLAllCollection::~JSHTMLAllCollection() +{ + forgetDOMObject(this, impl()); +} + +JSObject* JSHTMLAllCollection::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return new (exec) JSHTMLAllCollectionPrototype(JSHTMLAllCollectionPrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSHTMLAllCollection::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSValue proto = prototype(); + if (proto.isObject() && static_cast<JSObject*>(asObject(proto))->hasProperty(exec, propertyName)) + return false; + + const HashEntry* entry = JSHTMLAllCollectionTable.entry(exec, propertyName); + if (entry) { + slot.setCustom(this, entry->propertyGetter()); + return true; + } + bool ok; + unsigned index = propertyName.toUInt32(&ok, false); + if (ok && index < static_cast<HTMLAllCollection*>(impl())->length()) { + slot.setCustomIndex(this, index, indexGetter); + return true; + } + if (canGetItemsForName(exec, static_cast<HTMLAllCollection*>(impl()), propertyName)) { + slot.setCustom(this, nameGetter); + return true; + } + return getStaticValueSlot<JSHTMLAllCollection, Base>(exec, &JSHTMLAllCollectionTable, this, propertyName, slot); +} + +bool JSHTMLAllCollection::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + JSValue proto = prototype(); + if (proto.isObject() && static_cast<JSObject*>(asObject(proto))->hasProperty(exec, propertyName)) + return false; + + const HashEntry* entry = JSHTMLAllCollectionTable.entry(exec, propertyName); + if (entry) { + PropertySlot slot; + slot.setCustom(this, entry->propertyGetter()); + descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes()); + return true; + } + bool ok; + unsigned index = propertyName.toUInt32(&ok, false); + if (ok && index < static_cast<HTMLAllCollection*>(impl())->length()) { + PropertySlot slot; + slot.setCustomIndex(this, index, indexGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly); + return true; + } + if (canGetItemsForName(exec, static_cast<HTMLAllCollection*>(impl()), propertyName)) { + PropertySlot slot; + slot.setCustom(this, nameGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum); + return true; + } + return getStaticValueDescriptor<JSHTMLAllCollection, Base>(exec, &JSHTMLAllCollectionTable, this, propertyName, descriptor); +} + +bool JSHTMLAllCollection::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot) +{ + if (propertyName < static_cast<HTMLAllCollection*>(impl())->length()) { + slot.setCustomIndex(this, propertyName, indexGetter); + return true; + } + return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot); +} + +JSValue jsHTMLAllCollectionLength(ExecState* exec, const Identifier&, const PropertySlot& slot) +{ + JSHTMLAllCollection* castedThis = static_cast<JSHTMLAllCollection*>(asObject(slot.slotBase())); + UNUSED_PARAM(exec); + HTMLAllCollection* imp = static_cast<HTMLAllCollection*>(castedThis->impl()); + return jsNumber(exec, imp->length()); +} + +JSValue jsHTMLAllCollectionConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) +{ + JSHTMLAllCollection* domObject = static_cast<JSHTMLAllCollection*>(asObject(slot.slotBase())); + return JSHTMLAllCollection::getConstructor(exec, domObject->globalObject()); +} +void JSHTMLAllCollection::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +{ + for (unsigned i = 0; i < static_cast<HTMLAllCollection*>(impl())->length(); ++i) + propertyNames.add(Identifier::from(exec, i)); + Base::getOwnPropertyNames(exec, propertyNames); +} + +JSValue JSHTMLAllCollection::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSHTMLAllCollectionConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); +} + +JSValue JSC_HOST_CALL jsHTMLAllCollectionPrototypeFunctionItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSHTMLAllCollection::s_info)) + return throwError(exec, TypeError); + JSHTMLAllCollection* castedThisObj = static_cast<JSHTMLAllCollection*>(asObject(thisValue)); + return castedThisObj->item(exec, args); +} + +JSValue JSC_HOST_CALL jsHTMLAllCollectionPrototypeFunctionNamedItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSHTMLAllCollection::s_info)) + return throwError(exec, TypeError); + JSHTMLAllCollection* castedThisObj = static_cast<JSHTMLAllCollection*>(asObject(thisValue)); + return castedThisObj->namedItem(exec, args); +} + +JSValue JSC_HOST_CALL jsHTMLAllCollectionPrototypeFunctionTags(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +{ + UNUSED_PARAM(args); + if (!thisValue.inherits(&JSHTMLAllCollection::s_info)) + return throwError(exec, TypeError); + JSHTMLAllCollection* castedThisObj = static_cast<JSHTMLAllCollection*>(asObject(thisValue)); + HTMLAllCollection* imp = static_cast<HTMLAllCollection*>(castedThisObj->impl()); + const UString& name = args.at(0).toString(exec); + + + JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->tags(name))); + return result; +} + + +JSValue JSHTMLAllCollection::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) +{ + JSHTMLAllCollection* thisObj = static_cast<JSHTMLAllCollection*>(asObject(slot.slotBase())); + return toJS(exec, thisObj->globalObject(), static_cast<HTMLAllCollection*>(thisObj->impl())->item(slot.index())); +} +JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, HTMLAllCollection* object) +{ + return getDOMObjectWrapper<JSHTMLAllCollection>(exec, globalObject, object); +} +HTMLAllCollection* toHTMLAllCollection(JSC::JSValue value) +{ + return value.inherits(&JSHTMLAllCollection::s_info) ? static_cast<JSHTMLAllCollection*>(asObject(value))->impl() : 0; +} + +} diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.h new file mode 100644 index 0000000..000986e --- /dev/null +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLAllCollection.h @@ -0,0 +1,104 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef JSHTMLAllCollection_h +#define JSHTMLAllCollection_h + +#include "DOMObjectWithSVGContext.h" +#include "JSDOMBinding.h" +#include <runtime/CallData.h> +#include <runtime/JSGlobalObject.h> +#include <runtime/ObjectPrototype.h> + +namespace WebCore { + +class HTMLAllCollection; + +class JSHTMLAllCollection : public DOMObjectWithGlobalPointer { + typedef DOMObjectWithGlobalPointer Base; +public: + JSHTMLAllCollection(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<HTMLAllCollection>); + virtual ~JSHTMLAllCollection(); + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); + virtual bool getOwnPropertySlot(JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags)); + } + + virtual JSC::CallType getCallData(JSC::CallData&); + + virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); + virtual bool toBoolean(JSC::ExecState*) const { return false; }; + static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); + + // Custom functions + JSC::JSValue item(JSC::ExecState*, const JSC::ArgList&); + JSC::JSValue namedItem(JSC::ExecState*, const JSC::ArgList&); + HTMLAllCollection* impl() const { return m_impl.get(); } + +private: + RefPtr<HTMLAllCollection> m_impl; +protected: + static const unsigned StructureFlags = JSC::OverridesGetPropertyNames | JSC::OverridesGetOwnPropertySlot | JSC::MasqueradesAsUndefined | Base::StructureFlags; + static JSC::JSValue indexGetter(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); +private: + static bool canGetItemsForName(JSC::ExecState*, HTMLAllCollection*, const JSC::Identifier&); + static JSC::JSValue nameGetter(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); +}; + +JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, HTMLAllCollection*); +HTMLAllCollection* toHTMLAllCollection(JSC::JSValue); + +class JSHTMLAllCollectionPrototype : public JSC::JSObject { + typedef JSC::JSObject Base; +public: + static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags)); + } + JSHTMLAllCollectionPrototype(NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; +}; + +// Functions + +JSC::JSValue JSC_HOST_CALL jsHTMLAllCollectionPrototypeFunctionItem(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsHTMLAllCollectionPrototypeFunctionNamedItem(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsHTMLAllCollectionPrototypeFunctionTags(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +// Attributes + +JSC::JSValue jsHTMLAllCollectionLength(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); +JSC::JSValue jsHTMLAllCollectionConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); + +} // namespace WebCore + +#endif diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp index 920f152..5e81799 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLBodyElement.cpp @@ -350,7 +350,7 @@ void setJSHTMLBodyElementOnbeforeunload(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast<HTMLBodyElement*>(static_cast<JSHTMLBodyElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforeunload(globalObject->createJSAttributeEventListener(value)); @@ -360,7 +360,7 @@ void setJSHTMLBodyElementOnhashchange(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast<HTMLBodyElement*>(static_cast<JSHTMLBodyElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnhashchange(globalObject->createJSAttributeEventListener(value)); @@ -370,7 +370,7 @@ void setJSHTMLBodyElementOnmessage(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast<HTMLBodyElement*>(static_cast<JSHTMLBodyElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmessage(globalObject->createJSAttributeEventListener(value)); @@ -380,7 +380,7 @@ void setJSHTMLBodyElementOnoffline(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast<HTMLBodyElement*>(static_cast<JSHTMLBodyElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnoffline(globalObject->createJSAttributeEventListener(value)); @@ -390,7 +390,7 @@ void setJSHTMLBodyElementOnonline(ExecState* exec, JSObject* thisObject, JSValue { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast<HTMLBodyElement*>(static_cast<JSHTMLBodyElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnonline(globalObject->createJSAttributeEventListener(value)); @@ -400,7 +400,7 @@ void setJSHTMLBodyElementOnresize(ExecState* exec, JSObject* thisObject, JSValue { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast<HTMLBodyElement*>(static_cast<JSHTMLBodyElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnresize(globalObject->createJSAttributeEventListener(value)); @@ -410,7 +410,7 @@ void setJSHTMLBodyElementOnstorage(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast<HTMLBodyElement*>(static_cast<JSHTMLBodyElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnstorage(globalObject->createJSAttributeEventListener(value)); @@ -420,7 +420,7 @@ void setJSHTMLBodyElementOnunload(ExecState* exec, JSObject* thisObject, JSValue { UNUSED_PARAM(exec); HTMLBodyElement* imp = static_cast<HTMLBodyElement*>(static_cast<JSHTMLBodyElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnunload(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp index 63c0d93..213b3c5 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.cpp @@ -24,10 +24,7 @@ #include "AtomicString.h" #include "HTMLCollection.h" #include "JSNode.h" -#include "JSNodeList.h" -#include "NameNodeList.h" #include "Node.h" -#include "NodeList.h" #include <runtime/Error.h> #include <runtime/JSNumberCell.h> #include <runtime/PropertyNameArray.h> @@ -104,11 +101,10 @@ bool JSHTMLCollectionConstructor::getOwnPropertyDescriptor(ExecState* exec, cons /* Hash table for prototype */ -static const HashTableValue JSHTMLCollectionPrototypeTableValues[4] = +static const HashTableValue JSHTMLCollectionPrototypeTableValues[3] = { { "item", DontDelete|Function, (intptr_t)jsHTMLCollectionPrototypeFunctionItem, (intptr_t)1 }, { "namedItem", DontDelete|Function, (intptr_t)jsHTMLCollectionPrototypeFunctionNamedItem, (intptr_t)1 }, - { "tags", DontDelete|Function, (intptr_t)jsHTMLCollectionPrototypeFunctionTags, (intptr_t)1 }, { 0, 0, 0, 0 } }; @@ -116,7 +112,7 @@ static JSC_CONST_HASHTABLE HashTable JSHTMLCollectionPrototypeTable = #if ENABLE(PERFECT_HASH_SIZE) { 7, JSHTMLCollectionPrototypeTableValues, 0 }; #else - { 8, 7, JSHTMLCollectionPrototypeTableValues, 0 }; + { 5, 3, JSHTMLCollectionPrototypeTableValues, 0 }; #endif const ClassInfo JSHTMLCollectionPrototype::s_info = { "HTMLCollectionPrototype", 0, &JSHTMLCollectionPrototypeTable, 0 }; @@ -146,7 +142,7 @@ JSHTMLCollection::JSHTMLCollection(NonNullPassRefPtr<Structure> structure, JSDOM JSHTMLCollection::~JSHTMLCollection() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSHTMLCollection::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -260,20 +256,6 @@ JSValue JSC_HOST_CALL jsHTMLCollectionPrototypeFunctionNamedItem(ExecState* exec return castedThisObj->namedItem(exec, args); } -JSValue JSC_HOST_CALL jsHTMLCollectionPrototypeFunctionTags(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) -{ - UNUSED_PARAM(args); - if (!thisValue.inherits(&JSHTMLCollection::s_info)) - return throwError(exec, TypeError); - JSHTMLCollection* castedThisObj = static_cast<JSHTMLCollection*>(asObject(thisValue)); - HTMLCollection* imp = static_cast<HTMLCollection*>(castedThisObj->impl()); - const UString& name = args.at(0).toString(exec); - - - JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->tags(name))); - return result; -} - JSValue JSHTMLCollection::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) { diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.h b/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.h index 447f620..e14a2c2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.h +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLCollection.h @@ -92,7 +92,6 @@ protected: JSC::JSValue JSC_HOST_CALL jsHTMLCollectionPrototypeFunctionItem(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); JSC::JSValue JSC_HOST_CALL jsHTMLCollectionPrototypeFunctionNamedItem(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsHTMLCollectionPrototypeFunctionTags(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); // Attributes JSC::JSValue jsHTMLCollectionLength(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); diff --git a/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp b/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp index f336c76..9e506a0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSHTMLFrameSetElement.cpp @@ -300,7 +300,7 @@ void setJSHTMLFrameSetElementOnbeforeunload(ExecState* exec, JSObject* thisObjec { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast<HTMLFrameSetElement*>(static_cast<JSHTMLFrameSetElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforeunload(globalObject->createJSAttributeEventListener(value)); @@ -310,7 +310,7 @@ void setJSHTMLFrameSetElementOnhashchange(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast<HTMLFrameSetElement*>(static_cast<JSHTMLFrameSetElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnhashchange(globalObject->createJSAttributeEventListener(value)); @@ -320,7 +320,7 @@ void setJSHTMLFrameSetElementOnmessage(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast<HTMLFrameSetElement*>(static_cast<JSHTMLFrameSetElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmessage(globalObject->createJSAttributeEventListener(value)); @@ -330,7 +330,7 @@ void setJSHTMLFrameSetElementOnoffline(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast<HTMLFrameSetElement*>(static_cast<JSHTMLFrameSetElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnoffline(globalObject->createJSAttributeEventListener(value)); @@ -340,7 +340,7 @@ void setJSHTMLFrameSetElementOnonline(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast<HTMLFrameSetElement*>(static_cast<JSHTMLFrameSetElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnonline(globalObject->createJSAttributeEventListener(value)); @@ -350,7 +350,7 @@ void setJSHTMLFrameSetElementOnresize(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast<HTMLFrameSetElement*>(static_cast<JSHTMLFrameSetElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnresize(globalObject->createJSAttributeEventListener(value)); @@ -360,7 +360,7 @@ void setJSHTMLFrameSetElementOnstorage(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast<HTMLFrameSetElement*>(static_cast<JSHTMLFrameSetElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnstorage(globalObject->createJSAttributeEventListener(value)); @@ -370,7 +370,7 @@ void setJSHTMLFrameSetElementOnunload(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); HTMLFrameSetElement* imp = static_cast<HTMLFrameSetElement*>(static_cast<JSHTMLFrameSetElement*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnunload(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp b/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp index 5331441..02be6ba 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSHistory.cpp @@ -92,7 +92,7 @@ JSHistory::JSHistory(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* JSHistory::~JSHistory() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSHistory::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp b/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp index a21fb87..1de3c43 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSImageData.cpp @@ -126,7 +126,7 @@ JSImageData::JSImageData(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObje JSImageData::~JSImageData() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSImageData::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp b/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp index 8da82cc..f72baaa 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSInspectorBackend.cpp @@ -214,7 +214,7 @@ JSInspectorBackend::JSInspectorBackend(NonNullPassRefPtr<Structure> structure, J JSInspectorBackend::~JSInspectorBackend() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSInspectorBackend::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp b/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp index 798d540..2acd1af 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSJavaScriptCallFrame.cpp @@ -101,7 +101,7 @@ JSJavaScriptCallFrame::JSJavaScriptCallFrame(NonNullPassRefPtr<Structure> struct JSJavaScriptCallFrame::~JSJavaScriptCallFrame() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSJavaScriptCallFrame::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp b/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp index ca21205..bb4d56c 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSLocation.cpp @@ -108,7 +108,7 @@ JSLocation::JSLocation(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject JSLocation::~JSLocation() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSLocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp b/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp index b7d4c19..93cde9f 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp @@ -138,7 +138,7 @@ JSMedia::JSMedia(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* glob JSMedia::~JSMedia() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMedia::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp b/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp index 97e35e0..534a585 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMediaError.cpp @@ -146,7 +146,7 @@ JSMediaError::JSMediaError(NonNullPassRefPtr<Structure> structure, JSDOMGlobalOb JSMediaError::~JSMediaError() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMediaError::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp b/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp index 93a17b4..e7b758e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMediaList.cpp @@ -142,7 +142,7 @@ JSMediaList::JSMediaList(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObje JSMediaList::~JSMediaList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMediaList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp b/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp index 4fdac64..8ba6f01 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMessageChannel.cpp @@ -87,7 +87,7 @@ JSMessageChannel::JSMessageChannel(NonNullPassRefPtr<Structure> structure, JSDOM JSMessageChannel::~JSMessageChannel() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMessageChannel::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp b/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp index 28e1492..a65091c 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMessagePort.cpp @@ -158,7 +158,7 @@ JSMessagePort::JSMessagePort(NonNullPassRefPtr<Structure> structure, JSDOMGlobal JSMessagePort::~JSMessagePort() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMessagePort::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -202,7 +202,7 @@ void setJSMessagePortOnmessage(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); MessagePort* imp = static_cast<MessagePort*>(static_cast<JSMessagePort*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmessage(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp b/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp index f797df2..c91aaeb 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMimeType.cpp @@ -131,7 +131,7 @@ JSMimeType::JSMimeType(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject JSMimeType::~JSMimeType() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMimeType::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp b/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp index 0384539..3c7b740 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSMimeTypeArray.cpp @@ -142,7 +142,7 @@ JSMimeTypeArray::JSMimeTypeArray(NonNullPassRefPtr<Structure> structure, JSDOMGl JSMimeTypeArray::~JSMimeTypeArray() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSMimeTypeArray::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp b/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp index e3cc8d2..e9c79a1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNamedNodeMap.cpp @@ -147,7 +147,7 @@ JSNamedNodeMap::JSNamedNodeMap(NonNullPassRefPtr<Structure> structure, JSDOMGlob JSNamedNodeMap::~JSNamedNodeMap() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSNamedNodeMap::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp b/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp index 6dcda62..1c8e190 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNavigator.cpp @@ -108,7 +108,7 @@ JSNavigator::JSNavigator(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObje JSNavigator::~JSNavigator() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSNavigator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNode.cpp b/src/3rdparty/webkit/WebCore/generated/JSNode.cpp index e132829..e3a2006 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNode.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNode.cpp @@ -221,7 +221,7 @@ JSNode::JSNode(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* global JSNode::~JSNode() { impl()->invalidateEventListeners(); - forgetDOMNode(impl()->document(), impl()); + forgetDOMNode(this, impl(), impl()->document()); } JSObject* JSNode::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp b/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp index 141a060..22726f6 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNodeFilter.cpp @@ -167,7 +167,7 @@ JSNodeFilter::JSNodeFilter(NonNullPassRefPtr<Structure> structure, JSDOMGlobalOb JSNodeFilter::~JSNodeFilter() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSNodeFilter::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp b/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp index cf85e40..8570d24 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNodeIterator.cpp @@ -148,7 +148,7 @@ JSNodeIterator::JSNodeIterator(NonNullPassRefPtr<Structure> structure, JSDOMGlob JSNodeIterator::~JSNodeIterator() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSNodeIterator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp b/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp index 01ee9ac..3f3131e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSNodeList.cpp @@ -142,7 +142,7 @@ JSNodeList::JSNodeList(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject JSNodeList::~JSNodeList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSNodeList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp b/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp index 035a352..1c7b6ec 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp @@ -147,7 +147,7 @@ JSPlugin::JSPlugin(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* gl JSPlugin::~JSPlugin() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSPlugin::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp b/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp index bd0b579..38a9346 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSPluginArray.cpp @@ -143,7 +143,7 @@ JSPluginArray::JSPluginArray(NonNullPassRefPtr<Structure> structure, JSDOMGlobal JSPluginArray::~JSPluginArray() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSPluginArray::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp b/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp index e178bd9..fffa0c1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSPositionError.cpp @@ -146,7 +146,7 @@ JSPositionError::JSPositionError(NonNullPassRefPtr<Structure> structure, JSDOMGl JSPositionError::~JSPositionError() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSPositionError::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp b/src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp index 0dff99a..e45ce66 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSRGBColor.cpp @@ -128,7 +128,7 @@ JSRGBColor::JSRGBColor(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject JSRGBColor::~JSRGBColor() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSRGBColor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSRange.cpp b/src/3rdparty/webkit/WebCore/generated/JSRange.cpp index cc59119..bc9979b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSRange.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSRange.cpp @@ -194,7 +194,7 @@ JSRange::JSRange(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* glob JSRange::~JSRange() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSRange::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp b/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp index 2f8e618..bbb172d 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSRangeException.cpp @@ -145,7 +145,7 @@ JSRangeException::JSRangeException(NonNullPassRefPtr<Structure> structure, JSDOM JSRangeException::~JSRangeException() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSRangeException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSRect.cpp index 37c4669..e57d688 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSRect.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSRect.cpp @@ -129,7 +129,7 @@ JSRect::JSRect(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* global JSRect::~JSRect() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp index a318e1d..79fdc89 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSQLError.cpp @@ -83,7 +83,7 @@ JSSQLError::JSSQLError(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject JSSQLError::~JSSQLError() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSQLError::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp index 223de95..fa85ad6 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSet.cpp @@ -84,7 +84,7 @@ JSSQLResultSet::JSSQLResultSet(NonNullPassRefPtr<Structure> structure, JSDOMGlob JSSQLResultSet::~JSSQLResultSet() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSQLResultSet::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp index dddf0c4..090e4f7 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSQLResultSetRowList.cpp @@ -92,7 +92,7 @@ JSSQLResultSetRowList::JSSQLResultSetRowList(NonNullPassRefPtr<Structure> struct JSSQLResultSetRowList::~JSSQLResultSetRowList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSQLResultSetRowList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp b/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp index c2c0e54..e165dad 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSQLTransaction.cpp @@ -76,7 +76,7 @@ JSSQLTransaction::JSSQLTransaction(NonNullPassRefPtr<Structure> structure, JSDOM JSSQLTransaction::~JSSQLTransaction() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSQLTransaction::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp index 220f4a6..e6d4795 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAngle.cpp @@ -156,7 +156,7 @@ JSSVGAngle::JSSVGAngle(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject JSSVGAngle::~JSSVGAngle() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAngle::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp index c09ce1c..599f5ca 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedAngle.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedAngle::JSSVGAnimatedAngle(NonNullPassRefPtr<Structure> structure, J JSSVGAnimatedAngle::~JSSVGAnimatedAngle() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedAngle::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp index fb3f4c8..131b358 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedBoolean.cpp @@ -79,7 +79,7 @@ JSSVGAnimatedBoolean::JSSVGAnimatedBoolean(NonNullPassRefPtr<Structure> structur JSSVGAnimatedBoolean::~JSSVGAnimatedBoolean() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedBoolean::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp index 8fbe43e..6a27988 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedEnumeration.cpp @@ -80,7 +80,7 @@ JSSVGAnimatedEnumeration::JSSVGAnimatedEnumeration(NonNullPassRefPtr<Structure> JSSVGAnimatedEnumeration::~JSSVGAnimatedEnumeration() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedEnumeration::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp index f52a51b..86c388b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedInteger.cpp @@ -80,7 +80,7 @@ JSSVGAnimatedInteger::JSSVGAnimatedInteger(NonNullPassRefPtr<Structure> structur JSSVGAnimatedInteger::~JSSVGAnimatedInteger() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedInteger::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp index 50826a7..f5fff5e 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLength.cpp @@ -80,7 +80,7 @@ JSSVGAnimatedLength::JSSVGAnimatedLength(NonNullPassRefPtr<Structure> structure, JSSVGAnimatedLength::~JSSVGAnimatedLength() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedLength::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp index b0c3743..5525640 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedLengthList.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedLengthList::JSSVGAnimatedLengthList(NonNullPassRefPtr<Structure> st JSSVGAnimatedLengthList::~JSSVGAnimatedLengthList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedLengthList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp index ef16117..69f1490 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumber.cpp @@ -80,7 +80,7 @@ JSSVGAnimatedNumber::JSSVGAnimatedNumber(NonNullPassRefPtr<Structure> structure, JSSVGAnimatedNumber::~JSSVGAnimatedNumber() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedNumber::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp index af11dbd..0fa8afa 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedNumberList.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedNumberList::JSSVGAnimatedNumberList(NonNullPassRefPtr<Structure> st JSSVGAnimatedNumberList::~JSSVGAnimatedNumberList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedNumberList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp index 53f0b60..b64ee3a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedPreserveAspectRatio.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedPreserveAspectRatio::JSSVGAnimatedPreserveAspectRatio(NonNullPassRe JSSVGAnimatedPreserveAspectRatio::~JSSVGAnimatedPreserveAspectRatio() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedPreserveAspectRatio::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp index 432a4d5..0db579b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedRect.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedRect::JSSVGAnimatedRect(NonNullPassRefPtr<Structure> structure, JSD JSSVGAnimatedRect::~JSSVGAnimatedRect() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp index c3ccd92..a26a070 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedString.cpp @@ -82,7 +82,7 @@ JSSVGAnimatedString::JSSVGAnimatedString(NonNullPassRefPtr<Structure> structure, JSSVGAnimatedString::~JSSVGAnimatedString() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedString::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp index 52b2395..62c3121 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGAnimatedTransformList.cpp @@ -81,7 +81,7 @@ JSSVGAnimatedTransformList::JSSVGAnimatedTransformList(NonNullPassRefPtr<Structu JSSVGAnimatedTransformList::~JSSVGAnimatedTransformList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGAnimatedTransformList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp index 10d375d..1bb0736 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstance.cpp @@ -153,7 +153,7 @@ JSSVGElementInstance::JSSVGElementInstance(NonNullPassRefPtr<Structure> structur JSSVGElementInstance::~JSSVGElementInstance() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGElementInstance::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -724,7 +724,7 @@ void setJSSVGElementInstanceOnabort(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnabort(globalObject->createJSAttributeEventListener(value)); @@ -734,7 +734,7 @@ void setJSSVGElementInstanceOnblur(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnblur(globalObject->createJSAttributeEventListener(value)); @@ -744,7 +744,7 @@ void setJSSVGElementInstanceOnchange(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnchange(globalObject->createJSAttributeEventListener(value)); @@ -754,7 +754,7 @@ void setJSSVGElementInstanceOnclick(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnclick(globalObject->createJSAttributeEventListener(value)); @@ -764,7 +764,7 @@ void setJSSVGElementInstanceOncontextmenu(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncontextmenu(globalObject->createJSAttributeEventListener(value)); @@ -774,7 +774,7 @@ void setJSSVGElementInstanceOndblclick(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndblclick(globalObject->createJSAttributeEventListener(value)); @@ -784,7 +784,7 @@ void setJSSVGElementInstanceOnerror(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); @@ -794,7 +794,7 @@ void setJSSVGElementInstanceOnfocus(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnfocus(globalObject->createJSAttributeEventListener(value)); @@ -804,7 +804,7 @@ void setJSSVGElementInstanceOninput(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOninput(globalObject->createJSAttributeEventListener(value)); @@ -814,7 +814,7 @@ void setJSSVGElementInstanceOnkeydown(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeydown(globalObject->createJSAttributeEventListener(value)); @@ -824,7 +824,7 @@ void setJSSVGElementInstanceOnkeypress(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeypress(globalObject->createJSAttributeEventListener(value)); @@ -834,7 +834,7 @@ void setJSSVGElementInstanceOnkeyup(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnkeyup(globalObject->createJSAttributeEventListener(value)); @@ -844,7 +844,7 @@ void setJSSVGElementInstanceOnload(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnload(globalObject->createJSAttributeEventListener(value)); @@ -854,7 +854,7 @@ void setJSSVGElementInstanceOnmousedown(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousedown(globalObject->createJSAttributeEventListener(value)); @@ -864,7 +864,7 @@ void setJSSVGElementInstanceOnmousemove(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousemove(globalObject->createJSAttributeEventListener(value)); @@ -874,7 +874,7 @@ void setJSSVGElementInstanceOnmouseout(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseout(globalObject->createJSAttributeEventListener(value)); @@ -884,7 +884,7 @@ void setJSSVGElementInstanceOnmouseover(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseover(globalObject->createJSAttributeEventListener(value)); @@ -894,7 +894,7 @@ void setJSSVGElementInstanceOnmouseup(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmouseup(globalObject->createJSAttributeEventListener(value)); @@ -904,7 +904,7 @@ void setJSSVGElementInstanceOnmousewheel(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmousewheel(globalObject->createJSAttributeEventListener(value)); @@ -914,7 +914,7 @@ void setJSSVGElementInstanceOnbeforecut(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforecut(globalObject->createJSAttributeEventListener(value)); @@ -924,7 +924,7 @@ void setJSSVGElementInstanceOncut(ExecState* exec, JSObject* thisObject, JSValue { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncut(globalObject->createJSAttributeEventListener(value)); @@ -934,7 +934,7 @@ void setJSSVGElementInstanceOnbeforecopy(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforecopy(globalObject->createJSAttributeEventListener(value)); @@ -944,7 +944,7 @@ void setJSSVGElementInstanceOncopy(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOncopy(globalObject->createJSAttributeEventListener(value)); @@ -954,7 +954,7 @@ void setJSSVGElementInstanceOnbeforepaste(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnbeforepaste(globalObject->createJSAttributeEventListener(value)); @@ -964,7 +964,7 @@ void setJSSVGElementInstanceOnpaste(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnpaste(globalObject->createJSAttributeEventListener(value)); @@ -974,7 +974,7 @@ void setJSSVGElementInstanceOndragenter(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragenter(globalObject->createJSAttributeEventListener(value)); @@ -984,7 +984,7 @@ void setJSSVGElementInstanceOndragover(ExecState* exec, JSObject* thisObject, JS { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragover(globalObject->createJSAttributeEventListener(value)); @@ -994,7 +994,7 @@ void setJSSVGElementInstanceOndragleave(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragleave(globalObject->createJSAttributeEventListener(value)); @@ -1004,7 +1004,7 @@ void setJSSVGElementInstanceOndrop(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndrop(globalObject->createJSAttributeEventListener(value)); @@ -1014,7 +1014,7 @@ void setJSSVGElementInstanceOndragstart(ExecState* exec, JSObject* thisObject, J { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragstart(globalObject->createJSAttributeEventListener(value)); @@ -1024,7 +1024,7 @@ void setJSSVGElementInstanceOndrag(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndrag(globalObject->createJSAttributeEventListener(value)); @@ -1034,7 +1034,7 @@ void setJSSVGElementInstanceOndragend(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOndragend(globalObject->createJSAttributeEventListener(value)); @@ -1044,7 +1044,7 @@ void setJSSVGElementInstanceOnreset(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnreset(globalObject->createJSAttributeEventListener(value)); @@ -1054,7 +1054,7 @@ void setJSSVGElementInstanceOnresize(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnresize(globalObject->createJSAttributeEventListener(value)); @@ -1064,7 +1064,7 @@ void setJSSVGElementInstanceOnscroll(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnscroll(globalObject->createJSAttributeEventListener(value)); @@ -1074,7 +1074,7 @@ void setJSSVGElementInstanceOnsearch(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnsearch(globalObject->createJSAttributeEventListener(value)); @@ -1084,7 +1084,7 @@ void setJSSVGElementInstanceOnselect(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnselect(globalObject->createJSAttributeEventListener(value)); @@ -1094,7 +1094,7 @@ void setJSSVGElementInstanceOnselectstart(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnselectstart(globalObject->createJSAttributeEventListener(value)); @@ -1104,7 +1104,7 @@ void setJSSVGElementInstanceOnsubmit(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnsubmit(globalObject->createJSAttributeEventListener(value)); @@ -1114,7 +1114,7 @@ void setJSSVGElementInstanceOnunload(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); SVGElementInstance* imp = static_cast<SVGElementInstance*>(static_cast<JSSVGElementInstance*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnunload(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp index 8bc5bc0..893cc76 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGElementInstanceList.cpp @@ -94,7 +94,7 @@ JSSVGElementInstanceList::JSSVGElementInstanceList(NonNullPassRefPtr<Structure> JSSVGElementInstanceList::~JSSVGElementInstanceList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGElementInstanceList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp index 039182f..8906774 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGException.cpp @@ -150,7 +150,7 @@ JSSVGException::JSSVGException(NonNullPassRefPtr<Structure> structure, JSDOMGlob JSSVGException::~JSSVGException() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp index f97df89..0bcf836 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGLength.cpp @@ -169,7 +169,7 @@ JSSVGLength::JSSVGLength(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObje JSSVGLength::~JSSVGLength() { JSSVGDynamicPODTypeWrapperCache<SVGLength, SVGAnimatedLength>::forgetWrapper(m_impl.get()); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGLength::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp index 952a5f0..a984bd1 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGLengthList.cpp @@ -100,7 +100,7 @@ JSSVGLengthList::JSSVGLengthList(NonNullPassRefPtr<Structure> structure, JSDOMGl JSSVGLengthList::~JSSVGLengthList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGLengthList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp index ba8dfe8..d46ce6f 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGMatrix.cpp @@ -107,7 +107,7 @@ JSSVGMatrix::JSSVGMatrix(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObje JSSVGMatrix::~JSSVGMatrix() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGMatrix::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp index 2bfe658..8ba2042 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGNumber.cpp @@ -79,7 +79,7 @@ JSSVGNumber::JSSVGNumber(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObje JSSVGNumber::~JSSVGNumber() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGNumber::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp index dc6f5a4..fa0e3cf 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGNumberList.cpp @@ -99,7 +99,7 @@ JSSVGNumberList::JSSVGNumberList(NonNullPassRefPtr<Structure> structure, JSDOMGl JSSVGNumberList::~JSSVGNumberList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGNumberList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp index 2f1ecbd..767098b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSeg.cpp @@ -181,7 +181,7 @@ JSSVGPathSeg::JSSVGPathSeg(NonNullPassRefPtr<Structure> structure, JSDOMGlobalOb JSSVGPathSeg::~JSSVGPathSeg() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGPathSeg::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp index 0043533..9a35c1b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPathSegList.cpp @@ -99,7 +99,7 @@ JSSVGPathSegList::JSSVGPathSegList(NonNullPassRefPtr<Structure> structure, JSDOM JSSVGPathSegList::~JSSVGPathSegList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGPathSegList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp index e4c2415..67c35e2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPoint.cpp @@ -94,7 +94,7 @@ JSSVGPoint::JSSVGPoint(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject JSSVGPoint::~JSSVGPoint() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGPoint::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp index 4a22ff9..6968c80 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPointList.cpp @@ -98,7 +98,7 @@ JSSVGPointList::JSSVGPointList(NonNullPassRefPtr<Structure> structure, JSDOMGlob JSSVGPointList::~JSSVGPointList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGPointList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp index 0f3329c..578cd34 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGPreserveAspectRatio.cpp @@ -167,7 +167,7 @@ JSSVGPreserveAspectRatio::JSSVGPreserveAspectRatio(NonNullPassRefPtr<Structure> JSSVGPreserveAspectRatio::~JSSVGPreserveAspectRatio() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGPreserveAspectRatio::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp index 8360b4b..e60a309 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGRect.cpp @@ -83,7 +83,7 @@ JSSVGRect::JSSVGRect(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* JSSVGRect::~JSSVGRect() { JSSVGDynamicPODTypeWrapperCache<FloatRect, SVGAnimatedRect>::forgetWrapper(m_impl.get()); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGRect::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp index b484fbf..1793c23 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGRenderingIntent.cpp @@ -148,7 +148,7 @@ JSSVGRenderingIntent::JSSVGRenderingIntent(NonNullPassRefPtr<Structure> structur JSSVGRenderingIntent::~JSSVGRenderingIntent() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGRenderingIntent::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp index d4a6935..591ca64 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGStringList.cpp @@ -100,7 +100,7 @@ JSSVGStringList::JSSVGStringList(NonNullPassRefPtr<Structure> structure, JSDOMGl JSSVGStringList::~JSSVGStringList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGStringList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp index 82cddb6..2f51e56 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTransform.cpp @@ -162,7 +162,7 @@ JSSVGTransform::JSSVGTransform(NonNullPassRefPtr<Structure> structure, JSDOMGlob JSSVGTransform::~JSSVGTransform() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGTransform::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp index 51c0cca..8ce9342 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGTransformList.cpp @@ -103,7 +103,7 @@ JSSVGTransformList::JSSVGTransformList(NonNullPassRefPtr<Structure> structure, J JSSVGTransformList::~JSSVGTransformList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGTransformList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp b/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp index 452fc9c..fb3321a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSSVGUnitTypes.cpp @@ -142,7 +142,7 @@ JSSVGUnitTypes::JSSVGUnitTypes(NonNullPassRefPtr<Structure> structure, JSDOMGlob JSSVGUnitTypes::~JSSVGUnitTypes() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSSVGUnitTypes::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp b/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp index 574f44c..7ccffa3 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSScreen.cpp @@ -84,7 +84,7 @@ JSScreen::JSScreen(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* gl JSScreen::~JSScreen() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSScreen::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp b/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp index 998b8cf..e0ae01b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSStorage.cpp @@ -147,7 +147,7 @@ JSStorage::JSStorage(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* JSStorage::~JSStorage() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSStorage::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp b/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp index ae7011d..b84ab6b 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSStyleSheet.cpp @@ -136,7 +136,7 @@ JSStyleSheet::JSStyleSheet(NonNullPassRefPtr<Structure> structure, JSDOMGlobalOb JSStyleSheet::~JSStyleSheet() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSStyleSheet::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp b/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp index 5d07cc1..db3d083 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSStyleSheetList.cpp @@ -141,7 +141,7 @@ JSStyleSheetList::JSStyleSheetList(NonNullPassRefPtr<Structure> structure, JSDOM JSStyleSheetList::~JSStyleSheetList() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSStyleSheetList::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp b/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp index 627ad3b..940498a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSTextMetrics.cpp @@ -125,7 +125,7 @@ JSTextMetrics::JSTextMetrics(NonNullPassRefPtr<Structure> structure, JSDOMGlobal JSTextMetrics::~JSTextMetrics() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSTextMetrics::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp b/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp index 825ca1b..1306ccb 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSTimeRanges.cpp @@ -93,7 +93,7 @@ JSTimeRanges::JSTimeRanges(NonNullPassRefPtr<Structure> structure, JSDOMGlobalOb JSTimeRanges::~JSTimeRanges() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSTimeRanges::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp b/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp index a26425e..10645db 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSTreeWalker.cpp @@ -151,7 +151,7 @@ JSTreeWalker::JSTreeWalker(NonNullPassRefPtr<Structure> structure, JSDOMGlobalOb JSTreeWalker::~JSTreeWalker() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSTreeWalker::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp b/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp index b355874..7616c58 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp @@ -84,7 +84,7 @@ JSValidityState::JSValidityState(NonNullPassRefPtr<Structure> structure, JSDOMGl JSValidityState::~JSValidityState() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSValidityState::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp b/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp index a084949..94ad1c5 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSVoidCallback.cpp @@ -73,7 +73,7 @@ JSVoidCallback::JSVoidCallback(NonNullPassRefPtr<Structure> structure, JSDOMGlob JSVoidCallback::~JSVoidCallback() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSVoidCallback::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp index bcf8286..0bb2267 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitCSSMatrix.cpp @@ -120,7 +120,7 @@ JSWebKitCSSMatrix::JSWebKitCSSMatrix(NonNullPassRefPtr<Structure> structure, JSD JSWebKitCSSMatrix::~JSWebKitCSSMatrix() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSWebKitCSSMatrix::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp index 255df0a..ea88682 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWebKitPoint.cpp @@ -78,7 +78,7 @@ JSWebKitPoint::JSWebKitPoint(NonNullPassRefPtr<Structure> structure, JSDOMGlobal JSWebKitPoint::~JSWebKitPoint() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSWebKitPoint::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp b/src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp index ea8ff3d..7e48815 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWebSocket.cpp @@ -122,7 +122,7 @@ JSWebSocket::JSWebSocket(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObje JSWebSocket::~JSWebSocket() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } void JSWebSocket::markChildren(MarkStack& markStack) @@ -215,7 +215,7 @@ void setJSWebSocketOnopen(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); WebSocket* imp = static_cast<WebSocket*>(static_cast<JSWebSocket*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnopen(globalObject->createJSAttributeEventListener(value)); @@ -225,7 +225,7 @@ void setJSWebSocketOnmessage(ExecState* exec, JSObject* thisObject, JSValue valu { UNUSED_PARAM(exec); WebSocket* imp = static_cast<WebSocket*>(static_cast<JSWebSocket*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmessage(globalObject->createJSAttributeEventListener(value)); @@ -235,7 +235,7 @@ void setJSWebSocketOnclose(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); WebSocket* imp = static_cast<WebSocket*>(static_cast<JSWebSocket*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnclose(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorker.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorker.cpp index 42cc502..14153e2 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorker.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWorker.cpp @@ -129,7 +129,7 @@ void setJSWorkerOnmessage(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); Worker* imp = static_cast<Worker*>(static_cast<JSWorker*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnmessage(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp index e29cb32..5b7b105 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerContext.cpp @@ -129,7 +129,6 @@ JSWorkerContext::JSWorkerContext(NonNullPassRefPtr<Structure> structure, PassRef JSWorkerContext::~JSWorkerContext() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); } bool JSWorkerContext::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp index e24d0d6..6046aa6 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerLocation.cpp @@ -156,7 +156,7 @@ JSWorkerLocation::JSWorkerLocation(NonNullPassRefPtr<Structure> structure, JSDOM JSWorkerLocation::~JSWorkerLocation() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSWorkerLocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp b/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp index 8efab1e..29c2364 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSWorkerNavigator.cpp @@ -93,7 +93,7 @@ JSWorkerNavigator::JSWorkerNavigator(NonNullPassRefPtr<Structure> structure, JSD JSWorkerNavigator::~JSWorkerNavigator() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSWorkerNavigator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp index 9927f5e..d81c689 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequest.cpp @@ -137,7 +137,7 @@ JSXMLHttpRequest::JSXMLHttpRequest(NonNullPassRefPtr<Structure> structure, JSDOM JSXMLHttpRequest::~JSXMLHttpRequest() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXMLHttpRequest::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -294,7 +294,7 @@ void setJSXMLHttpRequestOnabort(ExecState* exec, JSObject* thisObject, JSValue v { UNUSED_PARAM(exec); XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(static_cast<JSXMLHttpRequest*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnabort(globalObject->createJSAttributeEventListener(value)); @@ -304,7 +304,7 @@ void setJSXMLHttpRequestOnerror(ExecState* exec, JSObject* thisObject, JSValue v { UNUSED_PARAM(exec); XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(static_cast<JSXMLHttpRequest*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); @@ -314,7 +314,7 @@ void setJSXMLHttpRequestOnload(ExecState* exec, JSObject* thisObject, JSValue va { UNUSED_PARAM(exec); XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(static_cast<JSXMLHttpRequest*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnload(globalObject->createJSAttributeEventListener(value)); @@ -324,7 +324,7 @@ void setJSXMLHttpRequestOnloadstart(ExecState* exec, JSObject* thisObject, JSVal { UNUSED_PARAM(exec); XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(static_cast<JSXMLHttpRequest*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnloadstart(globalObject->createJSAttributeEventListener(value)); @@ -334,7 +334,7 @@ void setJSXMLHttpRequestOnprogress(ExecState* exec, JSObject* thisObject, JSValu { UNUSED_PARAM(exec); XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(static_cast<JSXMLHttpRequest*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnprogress(globalObject->createJSAttributeEventListener(value)); @@ -344,7 +344,7 @@ void setJSXMLHttpRequestOnreadystatechange(ExecState* exec, JSObject* thisObject { UNUSED_PARAM(exec); XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(static_cast<JSXMLHttpRequest*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnreadystatechange(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp index 30e0d72..6de17c7 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestException.cpp @@ -153,7 +153,7 @@ JSXMLHttpRequestException::JSXMLHttpRequestException(NonNullPassRefPtr<Structure JSXMLHttpRequestException::~JSXMLHttpRequestException() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXMLHttpRequestException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp index bc5fff9..9ca7972 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXMLHttpRequestUpload.cpp @@ -158,7 +158,7 @@ JSXMLHttpRequestUpload::JSXMLHttpRequestUpload(NonNullPassRefPtr<Structure> stru JSXMLHttpRequestUpload::~JSXMLHttpRequestUpload() { impl()->invalidateEventListeners(); - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXMLHttpRequestUpload::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -250,7 +250,7 @@ void setJSXMLHttpRequestUploadOnabort(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(static_cast<JSXMLHttpRequestUpload*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnabort(globalObject->createJSAttributeEventListener(value)); @@ -260,7 +260,7 @@ void setJSXMLHttpRequestUploadOnerror(ExecState* exec, JSObject* thisObject, JSV { UNUSED_PARAM(exec); XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(static_cast<JSXMLHttpRequestUpload*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnerror(globalObject->createJSAttributeEventListener(value)); @@ -270,7 +270,7 @@ void setJSXMLHttpRequestUploadOnload(ExecState* exec, JSObject* thisObject, JSVa { UNUSED_PARAM(exec); XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(static_cast<JSXMLHttpRequestUpload*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnload(globalObject->createJSAttributeEventListener(value)); @@ -280,7 +280,7 @@ void setJSXMLHttpRequestUploadOnloadstart(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(static_cast<JSXMLHttpRequestUpload*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnloadstart(globalObject->createJSAttributeEventListener(value)); @@ -290,7 +290,7 @@ void setJSXMLHttpRequestUploadOnprogress(ExecState* exec, JSObject* thisObject, { UNUSED_PARAM(exec); XMLHttpRequestUpload* imp = static_cast<XMLHttpRequestUpload*>(static_cast<JSXMLHttpRequestUpload*>(thisObject)->impl()); - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext()); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec); if (!globalObject) return; imp->setOnprogress(globalObject->createJSAttributeEventListener(value)); diff --git a/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp b/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp index e6cdd6b..2fd7e29 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXMLSerializer.cpp @@ -147,7 +147,7 @@ JSXMLSerializer::JSXMLSerializer(NonNullPassRefPtr<Structure> structure, JSDOMGl JSXMLSerializer::~JSXMLSerializer() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXMLSerializer::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp index e25be26..aa8840a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathEvaluator.cpp @@ -158,7 +158,7 @@ JSXPathEvaluator::JSXPathEvaluator(NonNullPassRefPtr<Structure> structure, JSDOM JSXPathEvaluator::~JSXPathEvaluator() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXPathEvaluator::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp index 3894ac2..fb6a00a 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathException.cpp @@ -148,7 +148,7 @@ JSXPathException::JSXPathException(NonNullPassRefPtr<Structure> structure, JSDOM JSXPathException::~JSXPathException() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXPathException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp index 9464146..af059df 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathExpression.cpp @@ -141,7 +141,7 @@ JSXPathExpression::JSXPathExpression(NonNullPassRefPtr<Structure> structure, JSD JSXPathExpression::~JSXPathExpression() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXPathExpression::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp index c3bdef1..7ba29c0 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathNSResolver.cpp @@ -79,7 +79,7 @@ JSXPathNSResolver::JSXPathNSResolver(NonNullPassRefPtr<Structure> structure, JSD JSXPathNSResolver::~JSXPathNSResolver() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXPathNSResolver::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp b/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp index 337f473..d70ad29 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXPathResult.cpp @@ -171,7 +171,7 @@ JSXPathResult::JSXPathResult(NonNullPassRefPtr<Structure> structure, JSDOMGlobal JSXPathResult::~JSXPathResult() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXPathResult::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp b/src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp index 7dcd9c9..add8a84 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSXSLTProcessor.cpp @@ -86,7 +86,7 @@ JSXSLTProcessor::JSXSLTProcessor(NonNullPassRefPtr<Structure> structure, JSDOMGl JSXSLTProcessor::~JSXSLTProcessor() { - forgetDOMObject(*Heap::heap(this)->globalData(), impl()); + forgetDOMObject(this, impl()); } JSObject* JSXSLTProcessor::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/src/3rdparty/webkit/WebCore/generated/WebKitVersion.h b/src/3rdparty/webkit/WebCore/generated/WebKitVersion.h index 11e6af2..568670b 100644 --- a/src/3rdparty/webkit/WebCore/generated/WebKitVersion.h +++ b/src/3rdparty/webkit/WebCore/generated/WebKitVersion.h @@ -31,6 +31,6 @@ #define WebKitVersion_h #define WEBKIT_MAJOR_VERSION 532 -#define WEBKIT_MINOR_VERSION 3 +#define WEBKIT_MINOR_VERSION 4 #endif //WebKitVersion_h diff --git a/src/3rdparty/webkit/WebCore/history/qt/HistoryItemQt.cpp b/src/3rdparty/webkit/WebCore/history/qt/HistoryItemQt.cpp index 098a786..c5fb069 100644 --- a/src/3rdparty/webkit/WebCore/history/qt/HistoryItemQt.cpp +++ b/src/3rdparty/webkit/WebCore/history/qt/HistoryItemQt.cpp @@ -23,10 +23,13 @@ #include "CString.h" #include "FormData.h" -bool WebCore::HistoryItem::restoreState(QDataStream& in, int /*version*/) +bool WebCore::HistoryItem::restoreState(QDataStream& in, int version) { - // there is no different version right now - // switch (version) { + // we only support version 1 for now + + if (version != 1) + return false; + WebCore::String url; WebCore::String title; WebCore::String altTitle; @@ -87,10 +90,12 @@ bool WebCore::HistoryItem::restoreState(QDataStream& in, int /*version*/) return in.status() == QDataStream::Ok; } -QDataStream& WebCore::HistoryItem::saveState(QDataStream& out, int /*version*/) const +QDataStream& WebCore::HistoryItem::saveState(QDataStream& out, int version) const { - // there is no different version right now - // switch (version) { + // we only support version 1 for now. + if (version != 1) + return out; + out << urlString() << title() << alternateTitle() << lastVisitedTime(); out << originalURLString() << referrer() << target() << parent(); out << lastVisitWasHTTPNonGet() << lastVisitWasFailure() << isTargetItem(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.cpp b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.cpp new file mode 100644 index 0000000..dbfed28 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "HTMLAllCollection.h" + +#include "Node.h" + +namespace WebCore { + +PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(PassRefPtr<Node> base) +{ + return adoptRef(new HTMLAllCollection(base)); +} + +HTMLAllCollection::HTMLAllCollection(PassRefPtr<Node> base) + : HTMLCollection(base, DocAll) +{ +} + +HTMLAllCollection::~HTMLAllCollection() +{ +} + +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollection.h b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.h index da3a758..1dd3ede 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollection.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,49 +10,35 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSHTMLAllCollection_h -#define JSHTMLAllCollection_h +#ifndef HTMLAllCollection_h +#define HTMLAllCollection_h #include "HTMLCollection.h" -#include "JSHTMLCollection.h" namespace WebCore { - class HTMLCollection; +class HTMLAllCollection : public HTMLCollection { +public: + static PassRefPtr<HTMLAllCollection> create(PassRefPtr<Node>); + virtual ~HTMLAllCollection(); - class JSHTMLAllCollection : public JSHTMLCollection { - public: - JSHTMLAllCollection(NonNullPassRefPtr<JSC::Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLCollection> collection) - : JSHTMLCollection(structure, globalObject, collection) - { - } - - static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue proto) - { - return JSC::Structure::create(proto, JSC::TypeInfo(JSC::ObjectType, StructureFlags)); - } - - static const JSC::ClassInfo s_info; - protected: - static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::MasqueradesAsUndefined | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames | JSHTMLCollection::StructureFlags; - - private: - virtual bool toBoolean(JSC::ExecState*) const { return false; } - }; +private: + HTMLAllCollection(PassRefPtr<Node>); +}; } // namespace WebCore -#endif // JSHTMLAllCollection_h +#endif // HTMLAllCollection_h diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.idl b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.idl new file mode 100644 index 0000000..d36f41e --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.idl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + + interface [ + GenerateConstructor, + HasIndexGetter, + HasNameGetter, + CustomCall, + MasqueradesAsUndefined + ] HTMLAllCollection { + readonly attribute unsigned long length; + [Custom] Node item(in unsigned long index); + [Custom] Node namedItem(in DOMString name); + + // FIXME: This should return an HTMLAllCollection. + NodeList tags(in DOMString name); + }; + +} diff --git a/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp index 335b20f..7bae6e3 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp @@ -172,10 +172,11 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type) if (m_context && !m_context->is3d()) return 0; if (!m_context) { - m_context = new CanvasRenderingContext3D(this); - - // Need to make sure a RenderLayer and compositing layer get created for the Canvas - setNeedsStyleRecalc(SyntheticStyleChange); + m_context = CanvasRenderingContext3D::create(this); + if (m_context) { + // Need to make sure a RenderLayer and compositing layer get created for the Canvas + setNeedsStyleRecalc(SyntheticStyleChange); + } } return m_context.get(); } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLCollection.h b/src/3rdparty/webkit/WebCore/html/HTMLCollection.h index b04bcbc..eea1777 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLCollection.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLCollection.h @@ -64,6 +64,7 @@ public: protected: HTMLCollection(PassRefPtr<Node> base, CollectionType, CollectionCache*); + HTMLCollection(PassRefPtr<Node> base, CollectionType); CollectionCache* info() const { return m_info; } void resetCollectionInfo() const; @@ -71,8 +72,6 @@ protected: mutable bool m_idsDone; // for nextNamedItem() private: - HTMLCollection(PassRefPtr<Node> base, CollectionType); - virtual Element* itemAfter(Element*) const; virtual unsigned calcLength() const; virtual void updateNameCache() const; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLCollection.idl b/src/3rdparty/webkit/WebCore/html/HTMLCollection.idl index 1ba5ec7..45d1127 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLCollection.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLCollection.idl @@ -34,8 +34,9 @@ module html { [Custom] Node item(in unsigned long index); [Custom] Node namedItem(in DOMString name); - // Extensions +#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C NodeList tags(in DOMString name); +#endif }; } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDocument.idl b/src/3rdparty/webkit/WebCore/html/HTMLDocument.idl index 3dd7a07..d250741 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDocument.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLDocument.idl @@ -39,7 +39,7 @@ module html { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // FIXME: This should eventually be available (if they are wanted) for all languages. - attribute [Custom, Deletable] HTMLCollection all; + attribute [Custom, Deletable] HTMLAllCollection all; #endif void clear(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp index ed3405a..f25c908 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp @@ -1549,9 +1549,16 @@ void HTMLInputElement::defaultEventHandler(Event* evt) if (r && r->isTextField()) toRenderTextControl(r)->setEdited(false); } - // Form may never have been present, or may have been destroyed by the change event. - if (form()) - form()->submitClick(evt); + + RefPtr<HTMLFormElement> formForSubmission = form(); + // If there is no form and the element is an <isindex>, then create a temporary form just to be used for submission. + if (!formForSubmission && inputType() == ISINDEX) + formForSubmission = createTemporaryFormForIsIndex(); + + // Form may never have been present, or may have been destroyed by code responding to the change event. + if (formForSubmission) + formForSubmission->submitClick(evt); + evt->setDefaultHandled(); return; } @@ -1569,6 +1576,19 @@ void HTMLInputElement::defaultEventHandler(Event* evt) HTMLFormControlElementWithState::defaultEventHandler(evt); } +PassRefPtr<HTMLFormElement> HTMLInputElement::createTemporaryFormForIsIndex() +{ + RefPtr<HTMLFormElement> form = new HTMLFormElement(formTag, document()); + form->registerFormElement(this); + form->setMethod("GET"); + if (!document()->baseURL().isEmpty()) { + // We treat the href property of the <base> element as the form action, as per section 7.5 + // "Queries and Indexes" of the HTML 2.0 spec. <http://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.5>. + form->setAction(document()->baseURL().string()); + } + return form.release(); +} + bool HTMLInputElement::isURLAttribute(Attribute *attr) const { return (attr->name() == srcAttr); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h index 799d92c..0e2da32 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h @@ -256,6 +256,8 @@ private: virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); } virtual bool isRequiredFormControl() const; + PassRefPtr<HTMLFormElement> createTemporaryFormForIsIndex(); + #if ENABLE(DATALIST) HTMLDataListElement* dataList() const; #endif diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp index 11ca3ba..729aceb 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp @@ -247,16 +247,12 @@ void HTMLMediaElement::insertedIntoDocument() scheduleLoad(); } -void HTMLMediaElement::willRemove() -{ - if (m_isFullscreen) - exitFullscreen(); - HTMLElement::willRemove(); -} void HTMLMediaElement::removedFromDocument() { if (m_networkState > NETWORK_EMPTY) pause(); + if (m_isFullscreen) + exitFullscreen(); HTMLElement::removedFromDocument(); } @@ -1678,6 +1674,9 @@ void HTMLMediaElement::userCancelledLoad() void HTMLMediaElement::documentWillBecomeInactive() { + if (m_isFullscreen) + exitFullscreen(); + m_inActiveDocument = false; userCancelledLoad(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h index 0005e07..405f013 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h @@ -57,7 +57,6 @@ public: virtual bool rendererIsNeeded(RenderStyle*); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual void insertedIntoDocument(); - virtual void willRemove(); virtual void removedFromDocument(); virtual void attach(); virtual void recalcStyle(StyleChange); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl b/src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl index 5f85fcb..a7e191a 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl @@ -21,7 +21,6 @@ module html { // FIXME: The W3C spec says that HTMLOptionsCollection should not have a parent class. - interface [ GenerateNativeConverter, HasCustomIndexSetter, @@ -36,9 +35,9 @@ module html { raises (DOMException); [Custom] void remove(in unsigned long index); -#if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT - Node item(in unsigned long index); - Node namedItem(in DOMString name); +#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C + Node item(in unsigned long index); + Node namedItem(in DOMString name); #endif }; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp index 33af997..91285d9 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp @@ -416,13 +416,13 @@ HTMLTokenizer::State HTMLTokenizer::parseNonHTMLText(SegmentedString& src, State return state; } - + HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state) { // We are inside a <script> bool doScriptExec = false; int startLine = m_currentScriptTagStartLineNumber + 1; // Script line numbers are 1 based, HTMLTokenzier line numbers are 0 based - + // Reset m_currentScriptTagStartLineNumber to indicate that we've finished parsing the current script element m_currentScriptTagStartLineNumber = 0; @@ -551,7 +551,13 @@ HTMLTokenizer::State HTMLTokenizer::scriptExecution(const ScriptSourceCode& sour if (m_fragment || !m_doc->frame()) return state; m_executingScript++; - + +#if ENABLE(INSPECTOR) + InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent(); + if (timelineAgent) + timelineAgent->willEvaluateScriptTag(sourceCode.url().isNull() ? String() : sourceCode.url().string(), sourceCode.startLine()); +#endif + SegmentedString* savedPrependingSrc = m_currentPrependingSrc; SegmentedString prependingSrc; m_currentPrependingSrc = &prependingSrc; @@ -608,7 +614,12 @@ HTMLTokenizer::State HTMLTokenizer::scriptExecution(const ScriptSourceCode& sour } m_currentPrependingSrc = savedPrependingSrc; - + +#if ENABLE(INSPECTOR) + if (timelineAgent) + timelineAgent->didEvaluateScriptTag(); +#endif + return state; } @@ -1613,7 +1624,7 @@ inline bool HTMLTokenizer::continueProcessing(int& processedCount, double startT processedCount++; return true; } - + void HTMLTokenizer::write(const SegmentedString& str, bool appendData) { if (!m_buffer) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.h index 9ac9e57..f752377 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.h +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.h @@ -38,6 +38,7 @@ namespace WebCore { CanvasRenderingContext(HTMLCanvasElement*); virtual ~CanvasRenderingContext() { } + // Ref and deref the m_canvas void ref(); void deref(); @@ -46,7 +47,7 @@ namespace WebCore { virtual bool is2d() const { return false; } virtual bool is3d() const { return false; } - protected: + private: HTMLCanvasElement* m_canvas; }; diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 5e25b93..3341901 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -165,10 +165,10 @@ void CanvasRenderingContext2D::setStrokeStyle(PassRefPtr<CanvasStyle> style) if (!style) return; - if (m_canvas->originClean()) { + if (canvas()->originClean()) { if (CanvasPattern* pattern = style->canvasPattern()) { if (!pattern->originClean()) - m_canvas->setOriginTainted(); + canvas()->setOriginTainted(); } } @@ -189,10 +189,10 @@ void CanvasRenderingContext2D::setFillStyle(PassRefPtr<CanvasStyle> style) if (!style) return; - if (m_canvas->originClean()) { + if (canvas()->originClean()) { if (CanvasPattern* pattern = style->canvasPattern()) { if (!pattern->originClean()) - m_canvas->setOriginTainted(); + canvas()->setOriginTainted(); } } @@ -447,7 +447,7 @@ void CanvasRenderingContext2D::setTransform(float m11, float m12, float m21, flo if (!ctm.isInvertible()) return; c->concatCTM(c->getCTM().inverse()); - c->concatCTM(m_canvas->baseTransform()); + c->concatCTM(canvas()->baseTransform()); state().m_transform.multiply(ctm.inverse()); m_path.transform(ctm); @@ -630,7 +630,7 @@ void CanvasRenderingContext2D::rect(float x, float y, float width, float height) #if ENABLE(DASHBOARD_SUPPORT) void CanvasRenderingContext2D::clearPathForDashboardBackwardCompatibilityMode() { - if (Settings* settings = m_canvas->document()->settings()) + if (Settings* settings = canvas()->document()->settings()) if (settings->usesDashboardBackwardCompatibilityMode()) m_path.clear(); } @@ -935,8 +935,8 @@ static inline FloatRect normalizeRect(const FloatRect& rect) void CanvasRenderingContext2D::checkOrigin(const KURL& url) { - if (m_canvas->document()->securityOrigin()->taintsCanvas(url)) - m_canvas->setOriginTainted(); + if (canvas()->document()->securityOrigin()->taintsCanvas(url)) + canvas()->setOriginTainted(); } void CanvasRenderingContext2D::checkOrigin(const String& url) @@ -986,11 +986,11 @@ void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec if (!cachedImage) return; - if (m_canvas->originClean()) + if (canvas()->originClean()) checkOrigin(cachedImage->response().url()); - if (m_canvas->originClean() && !cachedImage->image()->hasSingleSecurityOrigin()) - m_canvas->setOriginTainted(); + if (canvas()->originClean() && !cachedImage->image()->hasSingleSecurityOrigin()) + canvas()->setOriginTainted(); FloatRect sourceRect = c->roundToDevicePixels(srcRect); FloatRect destRect = c->roundToDevicePixels(dstRect); @@ -1012,14 +1012,14 @@ void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, drawImage(canvas, FloatRect(0, 0, canvas->width(), canvas->height()), FloatRect(x, y, width, height), ec); } -void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, const FloatRect& srcRect, +void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode& ec) { - ASSERT(canvas); + ASSERT(sourceCanvas); ec = 0; - FloatRect srcCanvasRect = FloatRect(FloatPoint(), canvas->size()); + FloatRect srcCanvasRect = FloatRect(FloatPoint(), sourceCanvas->size()); if (!srcCanvasRect.contains(normalizeRect(srcRect)) || srcRect.width() == 0 || srcRect.height() == 0) { ec = INDEX_SIZE_ERR; return; @@ -1038,12 +1038,12 @@ void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, const FloatR FloatRect destRect = c->roundToDevicePixels(dstRect); // FIXME: Do this through platform-independent GraphicsContext API. - ImageBuffer* buffer = canvas->buffer(); + ImageBuffer* buffer = sourceCanvas->buffer(); if (!buffer) return; - if (!canvas->originClean()) - m_canvas->setOriginTainted(); + if (!sourceCanvas->originClean()) + canvas()->setOriginTainted(); c->drawImage(buffer->image(), destRect, sourceRect, state().m_globalComposite); willDraw(destRect); // This call comes after drawImage, since the buffer we draw into may be our own, and we need to make sure it is dirty. @@ -1088,11 +1088,11 @@ void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRec if (!state().m_invertibleCTM) return; - if (m_canvas->originClean()) + if (canvas()->originClean()) checkOrigin(video->currentSrc()); - if (m_canvas->originClean() && !video->hasSingleSecurityOrigin()) - m_canvas->setOriginTainted(); + if (canvas()->originClean() && !video->hasSingleSecurityOrigin()) + canvas()->setOriginTainted(); FloatRect sourceRect = c->roundToDevicePixels(srcRect); FloatRect destRect = c->roundToDevicePixels(dstRect); @@ -1121,11 +1121,11 @@ void CanvasRenderingContext2D::drawImageFromRect(HTMLImageElement* image, if (!cachedImage) return; - if (m_canvas->originClean()) + if (canvas()->originClean()) checkOrigin(cachedImage->response().url()); - if (m_canvas->originClean() && !cachedImage->image()->hasSingleSecurityOrigin()) - m_canvas->setOriginTainted(); + if (canvas()->originClean() && !cachedImage->image()->hasSingleSecurityOrigin()) + canvas()->setOriginTainted(); GraphicsContext* c = drawingContext(); if (!c) @@ -1155,7 +1155,7 @@ void CanvasRenderingContext2D::setCompositeOperation(const String& operation) void CanvasRenderingContext2D::prepareGradientForDashboard(CanvasGradient* gradient) const { #if ENABLE(DASHBOARD_SUPPORT) - if (Settings* settings = m_canvas->document()->settings()) + if (Settings* settings = canvas()->document()->settings()) if (settings->usesDashboardBackwardCompatibilityMode()) gradient->setDashboardCompatibilityMode(); #else @@ -1205,7 +1205,7 @@ PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLImageEleme if (!cachedImage || !image->cachedImage()->image()) return CanvasPattern::create(Image::nullImage(), repeatX, repeatY, true); - bool originClean = !m_canvas->document()->securityOrigin()->taintsCanvas(KURL(KURL(), cachedImage->url())); + bool originClean = !canvas()->document()->securityOrigin()->taintsCanvas(KURL(KURL(), cachedImage->url())); return CanvasPattern::create(cachedImage->image(), repeatX, repeatY, originClean); } @@ -1253,12 +1253,12 @@ void CanvasRenderingContext2D::willDraw(const FloatRect& r, unsigned options) // we'd have to keep the clip path around. } - m_canvas->willDraw(dirtyRect); + canvas()->willDraw(dirtyRect); } GraphicsContext* CanvasRenderingContext2D::drawingContext() const { - return m_canvas->drawingContext(); + return canvas()->drawingContext(); } static PassRefPtr<ImageData> createEmptyImageData(const IntSize& size) @@ -1276,7 +1276,7 @@ PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float return 0; } FloatSize unscaledSize(sw, sh); - IntSize scaledSize = m_canvas->convertLogicalToDevice(unscaledSize); + IntSize scaledSize = canvas()->convertLogicalToDevice(unscaledSize); if (scaledSize.width() < 1) scaledSize.setWidth(1); if (scaledSize.height() < 1) @@ -1287,18 +1287,18 @@ PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(float sx, float sy, float sw, float sh, ExceptionCode& ec) const { - if (!m_canvas->originClean()) { + if (!canvas()->originClean()) { ec = SECURITY_ERR; return 0; } FloatRect unscaledRect(sx, sy, sw, sh); - IntRect scaledRect = m_canvas->convertLogicalToDevice(unscaledRect); + IntRect scaledRect = canvas()->convertLogicalToDevice(unscaledRect); if (scaledRect.width() < 1) scaledRect.setWidth(1); if (scaledRect.height() < 1) scaledRect.setHeight(1); - ImageBuffer* buffer = m_canvas ? m_canvas->buffer() : 0; + ImageBuffer* buffer = canvas() ? canvas()->buffer() : 0; if (!buffer) return createEmptyImageData(scaledRect.size()); return buffer->getUnmultipliedImageData(scaledRect); @@ -1326,7 +1326,7 @@ void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, return; } - ImageBuffer* buffer = m_canvas->buffer(); + ImageBuffer* buffer = canvas()->buffer(); if (!buffer) return; @@ -1363,7 +1363,7 @@ String CanvasRenderingContext2D::font() const void CanvasRenderingContext2D::setFont(const String& newFont) { RefPtr<CSSMutableStyleDeclaration> tempDecl = CSSMutableStyleDeclaration::create(); - CSSParser parser(!m_canvas->document()->inCompatMode()); // Use the parse mode of the canvas' document when parsing CSS. + CSSParser parser(!canvas()->document()->inCompatMode()); // Use the parse mode of the canvas' document when parsing CSS. String declarationText("font: "); declarationText += newFont; @@ -1377,11 +1377,11 @@ void CanvasRenderingContext2D::setFont(const String& newFont) // Map the <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work // relative to the canvas. RefPtr<RenderStyle> newStyle = RenderStyle::create(); - if (m_canvas->computedStyle()) - newStyle->setFontDescription(m_canvas->computedStyle()->fontDescription()); + if (canvas()->computedStyle()) + newStyle->setFontDescription(canvas()->computedStyle()->fontDescription()); // Now map the font property into the style. - CSSStyleSelector* styleSelector = m_canvas->document()->styleSelector(); + CSSStyleSelector* styleSelector = canvas()->document()->styleSelector(); styleSelector->applyPropertyToStyle(CSSPropertyFont, tempDecl->getPropertyCSSValue(CSSPropertyFont).get(), newStyle.get()); state().m_font = newStyle->font(); @@ -1455,8 +1455,8 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo // FIXME: Handle maxWidth. // FIXME: Need to turn off font smoothing. - bool rtl = m_canvas->computedStyle() ? m_canvas->computedStyle()->direction() == RTL : false; - bool override = m_canvas->computedStyle() ? m_canvas->computedStyle()->unicodeBidi() == Override : false; + bool rtl = canvas()->computedStyle() ? canvas()->computedStyle()->direction() == RTL : false; + bool override = canvas()->computedStyle() ? canvas()->computedStyle()->unicodeBidi() == Override : false; unsigned length = text.length(); const UChar* string = text.characters(); @@ -1508,11 +1508,11 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo textRect.inflate(c->strokeThickness() / 2); if (fill) - m_canvas->willDraw(textRect); + canvas()->willDraw(textRect); else { // When stroking text, pointy miters can extend outside of textRect, so we // punt and dirty the whole canvas. - m_canvas->willDraw(FloatRect(0, 0, m_canvas->width(), m_canvas->height())); + canvas()->willDraw(FloatRect(0, 0, canvas()->width(), canvas()->height())); } #if PLATFORM(CG) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp index 9cca57b..612b4c3 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp @@ -42,12 +42,23 @@ namespace WebCore { -CanvasRenderingContext3D::CanvasRenderingContext3D(HTMLCanvasElement* canvas) - : CanvasRenderingContext(canvas) +PassOwnPtr<CanvasRenderingContext3D> CanvasRenderingContext3D::create(HTMLCanvasElement* canvas) +{ + OwnPtr<GraphicsContext3D> context(GraphicsContext3D::create()); + if (!context) + return 0; + + return new CanvasRenderingContext3D(canvas, context.release()); +} + +CanvasRenderingContext3D::CanvasRenderingContext3D(HTMLCanvasElement* passedCanvas, PassOwnPtr<GraphicsContext3D> context) + : CanvasRenderingContext(passedCanvas) + , m_context(context) , m_needsUpdate(true) , m_markedCanvasDirty(false) { - m_context.reshape(m_canvas->width(), m_canvas->height()); + ASSERT(m_context); + m_context->reshape(canvas()->width(), canvas()->height()); } CanvasRenderingContext3D::~CanvasRenderingContext3D() @@ -58,14 +69,14 @@ CanvasRenderingContext3D::~CanvasRenderingContext3D() void CanvasRenderingContext3D::markContextChanged() { #if USE(ACCELERATED_COMPOSITING) - if (m_canvas->renderBox() && m_canvas->renderBox()->hasLayer()) { - m_canvas->renderBox()->layer()->rendererContentChanged(); + if (canvas()->renderBox() && canvas()->renderBox()->hasLayer()) { + canvas()->renderBox()->layer()->rendererContentChanged(); } else { #endif if (!m_markedCanvasDirty) { // Make sure the canvas's image buffer is allocated. - m_canvas->buffer(); - m_canvas->willDraw(FloatRect(0, 0, m_canvas->width(), m_canvas->height())); + canvas()->buffer(); + canvas()->willDraw(FloatRect(0, 0, canvas()->width(), canvas()->height())); m_markedCanvasDirty = true; } #if USE(ACCELERATED_COMPOSITING) @@ -76,7 +87,7 @@ void CanvasRenderingContext3D::markContextChanged() void CanvasRenderingContext3D::beginPaint() { if (m_markedCanvasDirty) { - m_context.beginPaint(this); + m_context->beginPaint(this); } } @@ -84,7 +95,7 @@ void CanvasRenderingContext3D::endPaint() { if (m_markedCanvasDirty) { m_markedCanvasDirty = false; - m_context.endPaint(); + m_context->endPaint(); } } @@ -92,18 +103,18 @@ void CanvasRenderingContext3D::reshape(int width, int height) { if (m_needsUpdate) { #if USE(ACCELERATED_COMPOSITING) - if (m_canvas->renderBox() && m_canvas->renderBox()->hasLayer()) - m_canvas->renderBox()->layer()->rendererContentChanged(); + if (canvas()->renderBox() && canvas()->renderBox()->hasLayer()) + canvas()->renderBox()->layer()->rendererContentChanged(); #endif m_needsUpdate = false; } - m_context.reshape(width, height); + m_context->reshape(width, height); } int CanvasRenderingContext3D::sizeInBytes(int type, ExceptionCode& ec) { - int result = m_context.sizeInBytes(type); + int result = m_context->sizeInBytes(type); if (result <= 0) { ec = SYNTAX_ERR; } @@ -112,7 +123,7 @@ int CanvasRenderingContext3D::sizeInBytes(int type, ExceptionCode& ec) void CanvasRenderingContext3D::activeTexture(unsigned long texture) { - m_context.activeTexture(texture); + m_context->activeTexture(texture); cleanupAfterGraphicsCall(false); } @@ -120,7 +131,7 @@ void CanvasRenderingContext3D::attachShader(CanvasProgram* program, CanvasShader { if (!program || !shader) return; - m_context.attachShader(program, shader); + m_context->attachShader(program, shader); cleanupAfterGraphicsCall(false); } @@ -128,94 +139,94 @@ void CanvasRenderingContext3D::bindAttribLocation(CanvasProgram* program, unsign { if (!program) return; - m_context.bindAttribLocation(program, index, name); + m_context->bindAttribLocation(program, index, name); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bindBuffer(unsigned long target, CanvasBuffer* buffer) { - m_context.bindBuffer(target, buffer); + m_context->bindBuffer(target, buffer); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bindFramebuffer(unsigned long target, CanvasFramebuffer* buffer) { - m_context.bindFramebuffer(target, buffer); + m_context->bindFramebuffer(target, buffer); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bindRenderbuffer(unsigned long target, CanvasRenderbuffer* renderbuffer) { - m_context.bindRenderbuffer(target, renderbuffer); + m_context->bindRenderbuffer(target, renderbuffer); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bindTexture(unsigned long target, CanvasTexture* texture) { - m_context.bindTexture(target, texture); + m_context->bindTexture(target, texture); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::blendColor(double red, double green, double blue, double alpha) { - m_context.blendColor(red, green, blue, alpha); + m_context->blendColor(red, green, blue, alpha); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::blendEquation( unsigned long mode ) { - m_context.blendEquation(mode); + m_context->blendEquation(mode); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha) { - m_context.blendEquationSeparate(modeRGB, modeAlpha); + m_context->blendEquationSeparate(modeRGB, modeAlpha); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::blendFunc(unsigned long sfactor, unsigned long dfactor) { - m_context.blendFunc(sfactor, dfactor); + m_context->blendFunc(sfactor, dfactor); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha) { - m_context.blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); + m_context->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bufferData(unsigned long target, int size, unsigned long usage) { - m_context.bufferData(target, size, usage); + m_context->bufferData(target, size, usage); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bufferData(unsigned long target, CanvasArray* data, unsigned long usage) { - m_context.bufferData(target, data, usage); + m_context->bufferData(target, data, usage); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bufferSubData(unsigned long target, long offset, CanvasArray* data) { - m_context.bufferSubData(target, offset, data); + m_context->bufferSubData(target, offset, data); cleanupAfterGraphicsCall(false); } unsigned long CanvasRenderingContext3D::checkFramebufferStatus(unsigned long target) { - return m_context.checkFramebufferStatus(target); + return m_context->checkFramebufferStatus(target); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::clear(unsigned long mask) { - m_context.clear(mask); + m_context->clear(mask); cleanupAfterGraphicsCall(true); } @@ -229,43 +240,43 @@ void CanvasRenderingContext3D::clearColor(double r, double g, double b, double a b = 0; if (isnan(a)) a = 1; - m_context.clearColor(r, g, b, a); + m_context->clearColor(r, g, b, a); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::clearDepth(double depth) { - m_context.clearDepth(depth); + m_context->clearDepth(depth); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::clearStencil(long s) { - m_context.clearStencil(s); + m_context->clearStencil(s); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::colorMask(bool red, bool green, bool blue, bool alpha) { - m_context.colorMask(red, green, blue, alpha); + m_context->colorMask(red, green, blue, alpha); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::compileShader(CanvasShader* shader) { - m_context.compileShader(shader); + m_context->compileShader(shader); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border) { - m_context.copyTexImage2D(target, level, internalformat, x, y, width, height, border); + m_context->copyTexImage2D(target, level, internalformat, x, y, width, height, border); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height) { - m_context.copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); cleanupAfterGraphicsCall(false); } @@ -319,7 +330,7 @@ PassRefPtr<CanvasShader> CanvasRenderingContext3D::createShader(unsigned long ty void CanvasRenderingContext3D::cullFace(unsigned long mode) { - m_context.cullFace(mode); + m_context->cullFace(mode); cleanupAfterGraphicsCall(false); } @@ -373,19 +384,19 @@ void CanvasRenderingContext3D::deleteTexture(CanvasTexture* texture) void CanvasRenderingContext3D::depthFunc(unsigned long func) { - m_context.depthFunc(func); + m_context->depthFunc(func); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::depthMask(bool flag) { - m_context.depthMask(flag); + m_context->depthMask(flag); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::depthRange(double zNear, double zFar) { - m_context.depthRange(zNear, zFar); + m_context->depthRange(zNear, zFar); cleanupAfterGraphicsCall(false); } @@ -394,58 +405,58 @@ void CanvasRenderingContext3D::detachShader(CanvasProgram* program, CanvasShader if (!program || !shader) return; - m_context.detachShader(program, shader); + m_context->detachShader(program, shader); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::disable(unsigned long cap) { - m_context.disable(cap); + m_context->disable(cap); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::disableVertexAttribArray(unsigned long index) { - m_context.disableVertexAttribArray(index); + m_context->disableVertexAttribArray(index); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::drawArrays(unsigned long mode, long first, long count) { - m_context.drawArrays(mode, first, count); + m_context->drawArrays(mode, first, count); cleanupAfterGraphicsCall(true); } void CanvasRenderingContext3D::drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset) { - m_context.drawElements(mode, count, type, offset); + m_context->drawElements(mode, count, type, offset); cleanupAfterGraphicsCall(true); } void CanvasRenderingContext3D::enable(unsigned long cap) { - m_context.enable(cap); + m_context->enable(cap); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::enableVertexAttribArray(unsigned long index) { - m_context.enableVertexAttribArray(index); + m_context->enableVertexAttribArray(index); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::finish() { - m_context.finish(); + m_context->finish(); cleanupAfterGraphicsCall(true); } void CanvasRenderingContext3D::flush() { - m_context.flush(); + m_context->flush(); cleanupAfterGraphicsCall(true); } @@ -454,7 +465,7 @@ void CanvasRenderingContext3D::framebufferRenderbuffer(unsigned long target, uns if (!buffer) return; - m_context.framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer); + m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer); cleanupAfterGraphicsCall(false); } @@ -463,26 +474,26 @@ void CanvasRenderingContext3D::framebufferTexture2D(unsigned long target, unsign if (!texture) return; - m_context.framebufferTexture2D(target, attachment, textarget, texture, level); + m_context->framebufferTexture2D(target, attachment, textarget, texture, level); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::frontFace(unsigned long mode) { - m_context.frontFace(mode); + m_context->frontFace(mode); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::generateMipmap(unsigned long target) { - m_context.generateMipmap(target); + m_context->generateMipmap(target); cleanupAfterGraphicsCall(false); } PassRefPtr<CanvasActiveInfo> CanvasRenderingContext3D::getActiveAttrib(CanvasProgram* program, unsigned long index, ExceptionCode& ec) { ActiveInfo info; - if (!program || program->context() != this || !m_context.getActiveAttrib(program, index, info)) { + if (!program || program->context() != this || !m_context->getActiveAttrib(program, index, info)) { ec = INDEX_SIZE_ERR; return 0; } @@ -492,7 +503,7 @@ PassRefPtr<CanvasActiveInfo> CanvasRenderingContext3D::getActiveAttrib(CanvasPro PassRefPtr<CanvasActiveInfo> CanvasRenderingContext3D::getActiveUniform(CanvasProgram* program, unsigned long index, ExceptionCode& ec) { ActiveInfo info; - if (!program || program->context() != this || !m_context.getActiveUniform(program, index, info)) { + if (!program || program->context() != this || !m_context->getActiveUniform(program, index, info)) { ec = INDEX_SIZE_ERR; return 0; } @@ -501,251 +512,251 @@ PassRefPtr<CanvasActiveInfo> CanvasRenderingContext3D::getActiveUniform(CanvasPr int CanvasRenderingContext3D::getAttribLocation(CanvasProgram* program, const String& name) { - return m_context.getAttribLocation(program, name); + return m_context->getAttribLocation(program, name); } bool CanvasRenderingContext3D::getBoolean(unsigned long pname) { - bool result = m_context.getBoolean(pname); + bool result = m_context->getBoolean(pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasUnsignedByteArray> CanvasRenderingContext3D::getBooleanv(unsigned long pname) { - RefPtr<CanvasUnsignedByteArray> array = m_context.getBooleanv(pname); + RefPtr<CanvasUnsignedByteArray> array = m_context->getBooleanv(pname); cleanupAfterGraphicsCall(false); return array; } int CanvasRenderingContext3D::getBufferParameteri(unsigned long target, unsigned long pname) { - int result = m_context.getBufferParameteri(target, pname); + int result = m_context->getBufferParameteri(target, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getBufferParameteriv(unsigned long target, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getBufferParameteriv(target, pname); + RefPtr<CanvasIntArray> array = m_context->getBufferParameteriv(target, pname); cleanupAfterGraphicsCall(false); return array; } unsigned long CanvasRenderingContext3D::getError() { - return m_context.getError(); + return m_context->getError(); } float CanvasRenderingContext3D::getFloat(unsigned long pname) { - float result = m_context.getFloat(pname); + float result = m_context->getFloat(pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasFloatArray> CanvasRenderingContext3D::getFloatv(unsigned long pname) { - RefPtr<CanvasFloatArray> array = m_context.getFloatv(pname); + RefPtr<CanvasFloatArray> array = m_context->getFloatv(pname); cleanupAfterGraphicsCall(false); return array; } int CanvasRenderingContext3D::getFramebufferAttachmentParameteri(unsigned long target, unsigned long attachment, unsigned long pname) { - int result = m_context.getFramebufferAttachmentParameteri(target, attachment, pname); + int result = m_context->getFramebufferAttachmentParameteri(target, attachment, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getFramebufferAttachmentParameteriv(target, attachment, pname); + RefPtr<CanvasIntArray> array = m_context->getFramebufferAttachmentParameteriv(target, attachment, pname); cleanupAfterGraphicsCall(false); return array; } int CanvasRenderingContext3D::getInteger(unsigned long pname) { - float result = m_context.getInteger(pname); + float result = m_context->getInteger(pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getIntegerv(unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getIntegerv(pname); + RefPtr<CanvasIntArray> array = m_context->getIntegerv(pname); cleanupAfterGraphicsCall(false); return array; } int CanvasRenderingContext3D::getProgrami(CanvasProgram* program, unsigned long pname) { - int result = m_context.getProgrami(program, pname); + int result = m_context->getProgrami(program, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getProgramiv(CanvasProgram* program, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getProgramiv(program, pname); + RefPtr<CanvasIntArray> array = m_context->getProgramiv(program, pname); cleanupAfterGraphicsCall(false); return array; } String CanvasRenderingContext3D::getProgramInfoLog(CanvasProgram* program) { - String s = m_context.getProgramInfoLog(program); + String s = m_context->getProgramInfoLog(program); cleanupAfterGraphicsCall(false); return s; } int CanvasRenderingContext3D::getRenderbufferParameteri(unsigned long target, unsigned long pname) { - int result = m_context.getRenderbufferParameteri(target, pname); + int result = m_context->getRenderbufferParameteri(target, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getRenderbufferParameteriv(unsigned long target, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getRenderbufferParameteriv(target, pname); + RefPtr<CanvasIntArray> array = m_context->getRenderbufferParameteriv(target, pname); cleanupAfterGraphicsCall(false); return array; } int CanvasRenderingContext3D::getShaderi(CanvasShader* shader, unsigned long pname) { - int result = m_context.getShaderi(shader, pname); + int result = m_context->getShaderi(shader, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getShaderiv(CanvasShader* shader, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getShaderiv(shader, pname); + RefPtr<CanvasIntArray> array = m_context->getShaderiv(shader, pname); cleanupAfterGraphicsCall(false); return array; } String CanvasRenderingContext3D::getShaderInfoLog(CanvasShader* shader) { - String s = m_context.getShaderInfoLog(shader); + String s = m_context->getShaderInfoLog(shader); cleanupAfterGraphicsCall(false); return s; } String CanvasRenderingContext3D::getShaderSource(CanvasShader* shader) { - String s = m_context.getShaderSource(shader); + String s = m_context->getShaderSource(shader); cleanupAfterGraphicsCall(false); return s; } String CanvasRenderingContext3D::getString(unsigned long name) { - return m_context.getString(name); + return m_context->getString(name); } float CanvasRenderingContext3D::getTexParameterf(unsigned long target, unsigned long pname) { - float result = m_context.getTexParameterf(target, pname); + float result = m_context->getTexParameterf(target, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasFloatArray> CanvasRenderingContext3D::getTexParameterfv(unsigned long target, unsigned long pname) { - RefPtr<CanvasFloatArray> array = m_context.getTexParameterfv(target, pname); + RefPtr<CanvasFloatArray> array = m_context->getTexParameterfv(target, pname); cleanupAfterGraphicsCall(false); return array; } int CanvasRenderingContext3D::getTexParameteri(unsigned long target, unsigned long pname) { - int result = m_context.getTexParameteri(target, pname); + int result = m_context->getTexParameteri(target, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getTexParameteriv(unsigned long target, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getTexParameteriv(target, pname); + RefPtr<CanvasIntArray> array = m_context->getTexParameteriv(target, pname); cleanupAfterGraphicsCall(false); return array; } float CanvasRenderingContext3D::getUniformf(CanvasProgram* program, long location) { - float result = m_context.getUniformf(program, location); + float result = m_context->getUniformf(program, location); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasFloatArray> CanvasRenderingContext3D::getUniformfv(CanvasProgram* program, long location) { - RefPtr<CanvasFloatArray> array = m_context.getUniformfv(program, location); + RefPtr<CanvasFloatArray> array = m_context->getUniformfv(program, location); cleanupAfterGraphicsCall(false); return array; } long CanvasRenderingContext3D::getUniformi(CanvasProgram* program, long location) { - long result = m_context.getUniformi(program, location); + long result = m_context->getUniformi(program, location); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getUniformiv(CanvasProgram* program, long location) { - RefPtr<CanvasIntArray> array = m_context.getUniformiv(program, location); + RefPtr<CanvasIntArray> array = m_context->getUniformiv(program, location); cleanupAfterGraphicsCall(false); return array; } long CanvasRenderingContext3D::getUniformLocation(CanvasProgram* program, const String& name) { - return m_context.getUniformLocation(program, name); + return m_context->getUniformLocation(program, name); } float CanvasRenderingContext3D::getVertexAttribf(unsigned long index, unsigned long pname) { - float result = m_context.getVertexAttribf(index, pname); + float result = m_context->getVertexAttribf(index, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasFloatArray> CanvasRenderingContext3D::getVertexAttribfv(unsigned long index, unsigned long pname) { - RefPtr<CanvasFloatArray> array = m_context.getVertexAttribfv(index, pname); + RefPtr<CanvasFloatArray> array = m_context->getVertexAttribfv(index, pname); cleanupAfterGraphicsCall(false); return array; } long CanvasRenderingContext3D::getVertexAttribi(unsigned long index, unsigned long pname) { - long result = m_context.getVertexAttribi(index, pname); + long result = m_context->getVertexAttribi(index, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getVertexAttribiv(unsigned long index, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getVertexAttribiv(index, pname); + RefPtr<CanvasIntArray> array = m_context->getVertexAttribiv(index, pname); cleanupAfterGraphicsCall(false); return array; } long CanvasRenderingContext3D::getVertexAttribOffset(unsigned long index, unsigned long pname) { - long result = m_context.getVertexAttribOffset(index, pname); + long result = m_context->getVertexAttribOffset(index, pname); cleanupAfterGraphicsCall(false); return result; } void CanvasRenderingContext3D::hint(unsigned long target, unsigned long mode) { - m_context.hint(target, mode); + m_context->hint(target, mode); cleanupAfterGraphicsCall(false); } @@ -754,42 +765,42 @@ bool CanvasRenderingContext3D::isBuffer(CanvasBuffer* buffer) if (!buffer) return false; - return m_context.isBuffer(buffer); + return m_context->isBuffer(buffer); } bool CanvasRenderingContext3D::isEnabled(unsigned long cap) { - return m_context.isEnabled(cap); + return m_context->isEnabled(cap); } bool CanvasRenderingContext3D::isFramebuffer(CanvasFramebuffer* framebuffer) { - return m_context.isFramebuffer(framebuffer); + return m_context->isFramebuffer(framebuffer); } bool CanvasRenderingContext3D::isProgram(CanvasProgram* program) { - return m_context.isProgram(program); + return m_context->isProgram(program); } bool CanvasRenderingContext3D::isRenderbuffer(CanvasRenderbuffer* renderbuffer) { - return m_context.isRenderbuffer(renderbuffer); + return m_context->isRenderbuffer(renderbuffer); } bool CanvasRenderingContext3D::isShader(CanvasShader* shader) { - return m_context.isShader(shader); + return m_context->isShader(shader); } bool CanvasRenderingContext3D::isTexture(CanvasTexture* texture) { - return m_context.isTexture(texture); + return m_context->isTexture(texture); } void CanvasRenderingContext3D::lineWidth(double width) { - m_context.lineWidth((float) width); + m_context->lineWidth((float) width); cleanupAfterGraphicsCall(false); } @@ -798,92 +809,92 @@ void CanvasRenderingContext3D::linkProgram(CanvasProgram* program) if (!program) return; - m_context.linkProgram(program); + m_context->linkProgram(program); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::pixelStorei(unsigned long pname, long param) { - m_context.pixelStorei(pname, param); + m_context->pixelStorei(pname, param); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::polygonOffset(double factor, double units) { - m_context.polygonOffset((float) factor, (float) units); + m_context->polygonOffset((float) factor, (float) units); cleanupAfterGraphicsCall(false); } PassRefPtr<CanvasArray> CanvasRenderingContext3D::readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type) { - RefPtr<CanvasArray> array = m_context.readPixels(x, y, width, height, format, type); + RefPtr<CanvasArray> array = m_context->readPixels(x, y, width, height, format, type); cleanupAfterGraphicsCall(false); return array; } void CanvasRenderingContext3D::releaseShaderCompiler() { - m_context.releaseShaderCompiler(); + m_context->releaseShaderCompiler(); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height) { - m_context.renderbufferStorage(target, internalformat, width, height); + m_context->renderbufferStorage(target, internalformat, width, height); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::sampleCoverage(double value, bool invert) { - m_context.sampleCoverage((float) value, invert); + m_context->sampleCoverage((float) value, invert); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::scissor(long x, long y, unsigned long width, unsigned long height) { - m_context.scissor(x, y, width, height); + m_context->scissor(x, y, width, height); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::shaderSource(CanvasShader* shader, const String& string) { - m_context.shaderSource(shader, string); + m_context->shaderSource(shader, string); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::stencilFunc(unsigned long func, long ref, unsigned long mask) { - m_context.stencilFunc(func, ref, mask); + m_context->stencilFunc(func, ref, mask); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask) { - m_context.stencilFuncSeparate(face, func, ref, mask); + m_context->stencilFuncSeparate(face, func, ref, mask); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::stencilMask(unsigned long mask) { - m_context.stencilMask(mask); + m_context->stencilMask(mask); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::stencilMaskSeparate(unsigned long face, unsigned long mask) { - m_context.stencilMaskSeparate(face, mask); + m_context->stencilMaskSeparate(face, mask); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass) { - m_context.stencilOp(fail, zfail, zpass); + m_context->stencilOp(fail, zfail, zpass); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass) { - m_context.stencilOpSeparate(face, fail, zfail, zpass); + m_context->stencilOpSeparate(face, fail, zfail, zpass); cleanupAfterGraphicsCall(false); } @@ -893,7 +904,7 @@ void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, unsig { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texImage2D(target, level, internalformat, width, height, + m_context->texImage2D(target, level, internalformat, width, height, border, format, type, pixels); cleanupAfterGraphicsCall(false); } @@ -904,7 +915,7 @@ void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, unsig { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texImage2D(target, level, internalformat, width, height, + m_context->texImage2D(target, level, internalformat, width, height, border, format, type, pixels); cleanupAfterGraphicsCall(false); } @@ -914,7 +925,7 @@ void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLI { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texImage2D(target, level, image, flipY, premultiplyAlpha); + m_context->texImage2D(target, level, image, flipY, premultiplyAlpha); cleanupAfterGraphicsCall(false); } @@ -923,7 +934,7 @@ void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLC { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texImage2D(target, level, canvas, flipY, premultiplyAlpha); + m_context->texImage2D(target, level, canvas, flipY, premultiplyAlpha); cleanupAfterGraphicsCall(false); } @@ -932,19 +943,19 @@ void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLV { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texImage2D(target, level, video, flipY, premultiplyAlpha); + m_context->texImage2D(target, level, video, flipY, premultiplyAlpha); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::texParameterf(unsigned target, unsigned pname, float param) { - m_context.texParameterf(target, pname, param); + m_context->texParameterf(target, pname, param); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::texParameteri(unsigned target, unsigned pname, int param) { - m_context.texParameteri(target, pname, param); + m_context->texParameteri(target, pname, param); cleanupAfterGraphicsCall(false); } @@ -954,7 +965,7 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); cleanupAfterGraphicsCall(false); } @@ -964,7 +975,7 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); cleanupAfterGraphicsCall(false); } @@ -974,7 +985,7 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texSubImage2D(target, level, xoffset, yoffset, width, height, image, flipY, premultiplyAlpha); + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, image, flipY, premultiplyAlpha); cleanupAfterGraphicsCall(false); } @@ -984,7 +995,7 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texSubImage2D(target, level, xoffset, yoffset, width, height, canvas, flipY, premultiplyAlpha); + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, canvas, flipY, premultiplyAlpha); cleanupAfterGraphicsCall(false); } @@ -994,13 +1005,13 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texSubImage2D(target, level, xoffset, yoffset, width, height, video, flipY, premultiplyAlpha); + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, video, flipY, premultiplyAlpha); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform1f(long location, float x) { - m_context.uniform1f(location, x); + m_context->uniform1f(location, x); cleanupAfterGraphicsCall(false); } @@ -1010,7 +1021,7 @@ void CanvasRenderingContext3D::uniform1fv(long location, CanvasFloatArray* v) if (!v) return; - m_context.uniform1fv(location, v->data(), v->length()); + m_context->uniform1fv(location, v->data(), v->length()); cleanupAfterGraphicsCall(false); } @@ -1020,13 +1031,13 @@ void CanvasRenderingContext3D::uniform1fv(long location, float* v, int size) if (!v) return; - m_context.uniform1fv(location, v, size); + m_context->uniform1fv(location, v, size); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform1i(long location, int x) { - m_context.uniform1i(location, x); + m_context->uniform1i(location, x); cleanupAfterGraphicsCall(false); } @@ -1036,7 +1047,7 @@ void CanvasRenderingContext3D::uniform1iv(long location, CanvasIntArray* v) if (!v) return; - m_context.uniform1iv(location, v->data(), v->length()); + m_context->uniform1iv(location, v->data(), v->length()); cleanupAfterGraphicsCall(false); } @@ -1046,13 +1057,13 @@ void CanvasRenderingContext3D::uniform1iv(long location, int* v, int size) if (!v) return; - m_context.uniform1iv(location, v, size); + m_context->uniform1iv(location, v, size); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform2f(long location, float x, float y) { - m_context.uniform2f(location, x, y); + m_context->uniform2f(location, x, y); cleanupAfterGraphicsCall(false); } @@ -1063,7 +1074,7 @@ void CanvasRenderingContext3D::uniform2fv(long location, CanvasFloatArray* v) return; // FIXME: length needs to be a multiple of 2 - m_context.uniform2fv(location, v->data(), v->length() / 2); + m_context->uniform2fv(location, v->data(), v->length() / 2); cleanupAfterGraphicsCall(false); } @@ -1074,13 +1085,13 @@ void CanvasRenderingContext3D::uniform2fv(long location, float* v, int size) return; // FIXME: length needs to be a multiple of 2 - m_context.uniform2fv(location, v, size / 2); + m_context->uniform2fv(location, v, size / 2); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform2i(long location, int x, int y) { - m_context.uniform2i(location, x, y); + m_context->uniform2i(location, x, y); cleanupAfterGraphicsCall(false); } @@ -1091,7 +1102,7 @@ void CanvasRenderingContext3D::uniform2iv(long location, CanvasIntArray* v) return; // FIXME: length needs to be a multiple of 2 - m_context.uniform2iv(location, v->data(), v->length() / 2); + m_context->uniform2iv(location, v->data(), v->length() / 2); cleanupAfterGraphicsCall(false); } @@ -1102,13 +1113,13 @@ void CanvasRenderingContext3D::uniform2iv(long location, int* v, int size) return; // FIXME: length needs to be a multiple of 2 - m_context.uniform2iv(location, v, size / 2); + m_context->uniform2iv(location, v, size / 2); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform3f(long location, float x, float y, float z) { - m_context.uniform3f(location, x, y, z); + m_context->uniform3f(location, x, y, z); cleanupAfterGraphicsCall(false); } @@ -1119,7 +1130,7 @@ void CanvasRenderingContext3D::uniform3fv(long location, CanvasFloatArray* v) return; // FIXME: length needs to be a multiple of 3 - m_context.uniform3fv(location, v->data(), v->length() / 3); + m_context->uniform3fv(location, v->data(), v->length() / 3); cleanupAfterGraphicsCall(false); } @@ -1130,13 +1141,13 @@ void CanvasRenderingContext3D::uniform3fv(long location, float* v, int size) return; // FIXME: length needs to be a multiple of 3 - m_context.uniform3fv(location, v, size / 3); + m_context->uniform3fv(location, v, size / 3); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform3i(long location, int x, int y, int z) { - m_context.uniform3i(location, x, y, z); + m_context->uniform3i(location, x, y, z); cleanupAfterGraphicsCall(false); } @@ -1147,7 +1158,7 @@ void CanvasRenderingContext3D::uniform3iv(long location, CanvasIntArray* v) return; // FIXME: length needs to be a multiple of 3 - m_context.uniform3iv(location, v->data(), v->length() / 3); + m_context->uniform3iv(location, v->data(), v->length() / 3); cleanupAfterGraphicsCall(false); } @@ -1158,13 +1169,13 @@ void CanvasRenderingContext3D::uniform3iv(long location, int* v, int size) return; // FIXME: length needs to be a multiple of 3 - m_context.uniform3iv(location, v, size / 3); + m_context->uniform3iv(location, v, size / 3); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform4f(long location, float x, float y, float z, float w) { - m_context.uniform4f(location, x, y, z, w); + m_context->uniform4f(location, x, y, z, w); cleanupAfterGraphicsCall(false); } @@ -1175,7 +1186,7 @@ void CanvasRenderingContext3D::uniform4fv(long location, CanvasFloatArray* v) return; // FIXME: length needs to be a multiple of 4 - m_context.uniform4fv(location, v->data(), v->length() / 4); + m_context->uniform4fv(location, v->data(), v->length() / 4); cleanupAfterGraphicsCall(false); } @@ -1186,13 +1197,13 @@ void CanvasRenderingContext3D::uniform4fv(long location, float* v, int size) return; // FIXME: length needs to be a multiple of 4 - m_context.uniform4fv(location, v, size / 4); + m_context->uniform4fv(location, v, size / 4); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform4i(long location, int x, int y, int z, int w) { - m_context.uniform4i(location, x, y, z, w); + m_context->uniform4i(location, x, y, z, w); cleanupAfterGraphicsCall(false); } @@ -1203,7 +1214,7 @@ void CanvasRenderingContext3D::uniform4iv(long location, CanvasIntArray* v) return; // FIXME: length needs to be a multiple of 4 - m_context.uniform4iv(location, v->data(), v->length() / 4); + m_context->uniform4iv(location, v->data(), v->length() / 4); cleanupAfterGraphicsCall(false); } @@ -1214,7 +1225,7 @@ void CanvasRenderingContext3D::uniform4iv(long location, int* v, int size) return; // FIXME: length needs to be a multiple of 4 - m_context.uniform4iv(location, v, size / 4); + m_context->uniform4iv(location, v, size / 4); cleanupAfterGraphicsCall(false); } @@ -1225,7 +1236,7 @@ void CanvasRenderingContext3D::uniformMatrix2fv(long location, bool transpose, C return; // FIXME: length needs to be a multiple of 4 - m_context.uniformMatrix2fv(location, transpose, v->data(), v->length() / 4); + m_context->uniformMatrix2fv(location, transpose, v->data(), v->length() / 4); cleanupAfterGraphicsCall(false); } @@ -1236,7 +1247,7 @@ void CanvasRenderingContext3D::uniformMatrix2fv(long location, bool transpose, f return; // FIXME: length needs to be a multiple of 4 - m_context.uniformMatrix2fv(location, transpose, v, size / 4); + m_context->uniformMatrix2fv(location, transpose, v, size / 4); cleanupAfterGraphicsCall(false); } @@ -1247,7 +1258,7 @@ void CanvasRenderingContext3D::uniformMatrix3fv(long location, bool transpose, C return; // FIXME: length needs to be a multiple of 9 - m_context.uniformMatrix3fv(location, transpose, v->data(), v->length() / 9); + m_context->uniformMatrix3fv(location, transpose, v->data(), v->length() / 9); cleanupAfterGraphicsCall(false); } @@ -1258,7 +1269,7 @@ void CanvasRenderingContext3D::uniformMatrix3fv(long location, bool transpose, f return; // FIXME: length needs to be a multiple of 9 - m_context.uniformMatrix3fv(location, transpose, v, size / 9); + m_context->uniformMatrix3fv(location, transpose, v, size / 9); cleanupAfterGraphicsCall(false); } @@ -1269,7 +1280,7 @@ void CanvasRenderingContext3D::uniformMatrix4fv(long location, bool transpose, C return; // FIXME: length needs to be a multiple of 16 - m_context.uniformMatrix4fv(location, transpose, v->data(), v->length() / 16); + m_context->uniformMatrix4fv(location, transpose, v->data(), v->length() / 16); cleanupAfterGraphicsCall(false); } @@ -1280,32 +1291,32 @@ void CanvasRenderingContext3D::uniformMatrix4fv(long location, bool transpose, f return; // FIXME: length needs to be a multiple of 16 - m_context.uniformMatrix4fv(location, transpose, v, size / 16); + m_context->uniformMatrix4fv(location, transpose, v, size / 16); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::useProgram(CanvasProgram* program) { - m_context.useProgram(program); + m_context->useProgram(program); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::validateProgram(CanvasProgram* program) { - m_context.validateProgram(program); + m_context->validateProgram(program); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib1f(unsigned long indx, float v0) { - m_context.vertexAttrib1f(indx, v0); + m_context->vertexAttrib1f(indx, v0); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib1fv(unsigned long indx, CanvasFloatArray* v) { // FIXME: Need to make sure array is big enough for attribute being set - m_context.vertexAttrib1fv(indx, v->data()); + m_context->vertexAttrib1fv(indx, v->data()); cleanupAfterGraphicsCall(false); } @@ -1314,20 +1325,20 @@ void CanvasRenderingContext3D::vertexAttrib1fv(unsigned long indx, float* v, int // FIXME: Need to make sure array is big enough for attribute being set UNUSED_PARAM(size); - m_context.vertexAttrib1fv(indx, v); + m_context->vertexAttrib1fv(indx, v); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib2f(unsigned long indx, float v0, float v1) { - m_context.vertexAttrib2f(indx, v0, v1); + m_context->vertexAttrib2f(indx, v0, v1); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib2fv(unsigned long indx, CanvasFloatArray* v) { // FIXME: Need to make sure array is big enough for attribute being set - m_context.vertexAttrib2fv(indx, v->data()); + m_context->vertexAttrib2fv(indx, v->data()); cleanupAfterGraphicsCall(false); } @@ -1336,20 +1347,20 @@ void CanvasRenderingContext3D::vertexAttrib2fv(unsigned long indx, float* v, int // FIXME: Need to make sure array is big enough for attribute being set UNUSED_PARAM(size); - m_context.vertexAttrib2fv(indx, v); + m_context->vertexAttrib2fv(indx, v); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib3f(unsigned long indx, float v0, float v1, float v2) { - m_context.vertexAttrib3f(indx, v0, v1, v2); + m_context->vertexAttrib3f(indx, v0, v1, v2); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib3fv(unsigned long indx, CanvasFloatArray* v) { // FIXME: Need to make sure array is big enough for attribute being set - m_context.vertexAttrib3fv(indx, v->data()); + m_context->vertexAttrib3fv(indx, v->data()); cleanupAfterGraphicsCall(false); } @@ -1358,20 +1369,20 @@ void CanvasRenderingContext3D::vertexAttrib3fv(unsigned long indx, float* v, int // FIXME: Need to make sure array is big enough for attribute being set UNUSED_PARAM(size); - m_context.vertexAttrib3fv(indx, v); + m_context->vertexAttrib3fv(indx, v); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib4f(unsigned long indx, float v0, float v1, float v2, float v3) { - m_context.vertexAttrib4f(indx, v0, v1, v2, v3); + m_context->vertexAttrib4f(indx, v0, v1, v2, v3); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib4fv(unsigned long indx, CanvasFloatArray* v) { // FIXME: Need to make sure array is big enough for attribute being set - m_context.vertexAttrib4fv(indx, v->data()); + m_context->vertexAttrib4fv(indx, v->data()); cleanupAfterGraphicsCall(false); } @@ -1380,13 +1391,13 @@ void CanvasRenderingContext3D::vertexAttrib4fv(unsigned long indx, float* v, int // FIXME: Need to make sure array is big enough for attribute being set UNUSED_PARAM(size); - m_context.vertexAttrib4fv(indx, v); + m_context->vertexAttrib4fv(indx, v); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttribPointer(unsigned long indx, long size, unsigned long type, bool normalized, unsigned long stride, unsigned long offset) { - m_context.vertexAttribPointer(indx, size, type, normalized, stride, offset); + m_context->vertexAttribPointer(indx, size, type, normalized, stride, offset); cleanupAfterGraphicsCall(false); } @@ -1400,7 +1411,7 @@ void CanvasRenderingContext3D::viewport(long x, long y, unsigned long width, uns width = 100; if (isnan(height)) height = 100; - m_context.viewport(x, y, width, height); + m_context->viewport(x, y, width, height); cleanupAfterGraphicsCall(false); } diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h index 526281b..70d9b95 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h @@ -51,8 +51,8 @@ class WebKitCSSMatrix; class CanvasRenderingContext3D : public CanvasRenderingContext { public: - CanvasRenderingContext3D(HTMLCanvasElement*); - ~CanvasRenderingContext3D(); + static PassOwnPtr<CanvasRenderingContext3D> create(HTMLCanvasElement*); + virtual ~CanvasRenderingContext3D(); virtual bool is3d() const { return true; } @@ -288,7 +288,7 @@ class WebKitCSSMatrix; void viewport(long x, long y, unsigned long width, unsigned long height); - GraphicsContext3D* graphicsContext3D() { return &m_context; } + GraphicsContext3D* graphicsContext3D() const { return m_context.get(); } void reshape(int width, int height); @@ -300,18 +300,21 @@ class WebKitCSSMatrix; private: friend class CanvasObject; + + CanvasRenderingContext3D(HTMLCanvasElement*, PassOwnPtr<GraphicsContext3D>); + void addObject(CanvasObject*); void detachAndRemoveAllObjects(); void markContextChanged(); void cleanupAfterGraphicsCall(bool changed) { - m_context.checkError(); + m_context->checkError(); if (changed) markContextChanged(); } - GraphicsContext3D m_context; + OwnPtr<GraphicsContext3D> m_context; bool m_needsUpdate; bool m_markedCanvasDirty; // FIXME: I think this is broken -- it does not increment any diff --git a/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp b/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp index 6cfb75e..eb8d49a 100644 --- a/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp @@ -90,7 +90,12 @@ void ConsoleMessage::addToConsole(InspectorFrontend* frontend) jsonObj.set("url", m_url); jsonObj.set("groupLevel", static_cast<int>(m_groupLevel)); jsonObj.set("repeatCount", static_cast<int>(m_repeatCount)); - frontend->addMessageToConsole(jsonObj, m_frames, m_wrappedArguments, m_message); + frontend->addConsoleMessage(jsonObj, m_frames, m_wrappedArguments, m_message); +} + +void ConsoleMessage::updateRepeatCountInConsole(InspectorFrontend* frontend) +{ + frontend->updateConsoleMessageRepeatCount(m_repeatCount); } #endif // ENABLE(INSPECTOR) diff --git a/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h b/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h index d03f2b7..8ed6660 100644 --- a/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h +++ b/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h @@ -49,6 +49,7 @@ namespace WebCore { #if ENABLE(INSPECTOR) void addToConsole(InspectorFrontend* frontend); + void updateRepeatCountInConsole(InspectorFrontend* frontend); #endif void incrementCount() { ++m_repeatCount; }; bool isEqual(ScriptState*, ConsoleMessage* msg) const; diff --git a/src/3rdparty/webkit/WebCore/inspector/DOMDispatchTimelineItem.cpp b/src/3rdparty/webkit/WebCore/inspector/DOMDispatchTimelineItem.cpp deleted file mode 100644 index acff513..0000000 --- a/src/3rdparty/webkit/WebCore/inspector/DOMDispatchTimelineItem.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* -* Copyright (C) 2009 Google Inc. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are -* met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above -* copyright notice, this list of conditions and the following disclaimer -* in the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Google Inc. nor the names of its -* contributors may be used to endorse or promote products derived from -* this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "config.h" -#include "DOMDispatchTimelineItem.h" - -#if ENABLE(INSPECTOR) - -#include "Event.h" -#include "InspectorFrontend.h" - -namespace WebCore { - -DOMDispatchTimelineItem::DOMDispatchTimelineItem(PassOwnPtr<TimelineItem> previous, double startTime, const Event& event) - : TimelineItem(previous, startTime, DOMDispatchTimelineItemType) - , m_eventType(event.type().string()) -{ -} - -ScriptObject DOMDispatchTimelineItem::convertToScriptObject(InspectorFrontend* frontend) -{ - ScriptObject selfObj = TimelineItem::convertToScriptObject(frontend); - ScriptObject dataObj = frontend->newScriptObject(); - dataObj.set("type", m_eventType); - selfObj.set("data", dataObj); - return selfObj; -} - -} // namespace WebCore - -#endif // ENABLE(INSPECTOR) diff --git a/src/3rdparty/webkit/WebCore/inspector/DOMDispatchTimelineItem.h b/src/3rdparty/webkit/WebCore/inspector/DOMDispatchTimelineItem.h deleted file mode 100644 index 384ce25f..0000000 --- a/src/3rdparty/webkit/WebCore/inspector/DOMDispatchTimelineItem.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -* Copyright (C) 2009 Google Inc. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are -* met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above -* copyright notice, this list of conditions and the following disclaimer -* in the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Google Inc. nor the names of its -* contributors may be used to endorse or promote products derived from -* this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef DOMDispatchTimelineItem_h -#define DOMDispatchTimelineItem_h - -#include "TimelineItem.h" -#include "PlatformString.h" - -namespace WebCore { - - class Event; - class InspectorFrontend; - - class DOMDispatchTimelineItem : public TimelineItem { - public: - DOMDispatchTimelineItem(PassOwnPtr<TimelineItem> previous, double startTime, const Event&); - - virtual ~DOMDispatchTimelineItem() { } - - protected: - virtual ScriptObject convertToScriptObject(InspectorFrontend*); - - private: - String m_eventType; - }; - -} // namespace WebCore - -#endif // !defined(DOMDispatchTimelineItem_h) - diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp index a5b8cbf..a6628cd 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp @@ -171,6 +171,8 @@ InspectorController::~InspectorController() s_settingCache = 0; } + releaseDOMAgent(); + m_inspectorBackend->disconnectController(); } @@ -372,13 +374,14 @@ void InspectorController::addConsoleMessage(ScriptState* scriptState, ConsoleMes if (m_previousMessage && m_previousMessage->isEqual(scriptState, consoleMessage)) { m_previousMessage->incrementCount(); delete consoleMessage; + if (windowVisible()) + m_previousMessage->updateRepeatCountInConsole(m_frontend.get()); } else { m_previousMessage = consoleMessage; m_consoleMessages.append(consoleMessage); + if (windowVisible()) + m_previousMessage->addToConsole(m_frontend.get()); } - - if (windowVisible()) - m_previousMessage->addToConsole(m_frontend.get()); } void InspectorController::clearConsoleMessages(bool clearUI) @@ -552,8 +555,10 @@ void InspectorController::setFrontendProxyObject(ScriptState* scriptState, Scrip m_scriptState = scriptState; m_injectedScriptObj = injectedScriptObj; m_frontend.set(new InspectorFrontend(this, scriptState, webInspectorObj)); - m_domAgent = new InspectorDOMAgent(m_frontend.get()); - m_timelineAgent = 0; + releaseDOMAgent(); + m_domAgent = InspectorDOMAgent::create(m_frontend.get()); + if (m_timelineAgent) + m_timelineAgent->resetFrontendProxyObject(m_frontend.get()); } void InspectorController::show() @@ -608,11 +613,7 @@ void InspectorController::close() m_frontend.set(0); m_injectedScriptObj = ScriptObject(); - // m_domAgent is RefPtr. Remove DOM listeners first to ensure that there are - // no references to the DOM agent from the DOM tree. - if (m_domAgent) - m_domAgent->setDocument(0); - m_domAgent = 0; + releaseDOMAgent(); m_timelineAgent = 0; m_scriptState = 0; if (m_page) @@ -642,6 +643,15 @@ void InspectorController::closeWindow() m_client->closeWindow(); } +void InspectorController::releaseDOMAgent() +{ + // m_domAgent is RefPtr. Remove DOM listeners first to ensure that there are + // no references to the DOM agent from the DOM tree. + if (m_domAgent) + m_domAgent->setDocument(0); + m_domAgent = 0; +} + void InspectorController::populateScriptObjects() { ASSERT(m_frontend); @@ -653,7 +663,9 @@ void InspectorController::populateScriptObjects() ResourcesMap::iterator resourcesEnd = m_resources.end(); for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) { it->second->createScriptObject(m_frontend.get()); - m_frontend->addCookieDomain(it->second->frame()->document()->url().host()); + KURL resourceURL = it->second->frame()->document()->url(); + if (resourceURL.protocolInHTTPFamily() || resourceURL.protocolIs("file")) + m_frontend->addCookieDomain(resourceURL.host()); } unsigned messageCount = m_consoleMessages.size(); @@ -982,7 +994,9 @@ void InspectorController::didFinishLoading(DocumentLoader*, unsigned long identi if (windowVisible()) { resource->updateScriptObject(m_frontend.get()); - m_frontend->addCookieDomain(resource->frame()->document()->url().host()); + KURL resourceURL = resource->frame()->document()->url(); + if (resourceURL.protocolInHTTPFamily() || resourceURL.protocolIs("file")) + m_frontend->addCookieDomain(resourceURL.host()); } } @@ -1035,7 +1049,7 @@ void InspectorController::scriptImported(unsigned long identifier, const String& resource->updateScriptObject(m_frontend.get()); } -void InspectorController::enableResourceTracking(bool always) +void InspectorController::enableResourceTracking(bool always, bool reload) { if (!enabled()) return; @@ -1051,7 +1065,8 @@ void InspectorController::enableResourceTracking(bool always) if (m_frontend) m_frontend->resourceTrackingWasEnabled(); - m_inspectedPage->mainFrame()->loader()->reload(); + if (reload) + m_inspectedPage->mainFrame()->loader()->reload(); } void InspectorController::disableResourceTracking(bool always) @@ -1431,7 +1446,7 @@ void InspectorController::startUserInitiatedProfiling(Timer<InspectorController> UString title = getCurrentUserInitiatedProfileName(true); - ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame())->globalExec(); + ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec(); Profiler::profiler()->startProfiling(scriptState, title); addStartProfilingMessageToConsole(title, 0, UString()); @@ -1448,7 +1463,7 @@ void InspectorController::stopUserInitiatedProfiling() UString title = getCurrentUserInitiatedProfileName(); - ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame())->globalExec(); + ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec(); RefPtr<Profile> profile = Profiler::profiler()->stopProfiling(scriptState, title); if (profile) addProfile(profile, 0, UString()); diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorController.h b/src/3rdparty/webkit/WebCore/inspector/InspectorController.h index 8c14532..382d887 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorController.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorController.h @@ -223,7 +223,7 @@ public: void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString); void scriptImported(unsigned long identifier, const String& sourceString); - void enableResourceTracking(bool always = false); + void enableResourceTracking(bool always = false, bool reload = true); void disableResourceTracking(bool always = false); bool resourceTrackingEnabled() const { return m_resourceTrackingEnabled; } void ensureResourceTrackingSettingsLoaded(); @@ -300,6 +300,7 @@ private: void storeLastActivePanel(const String& panelName); void closeWindow(); InspectorDOMAgent* domAgent() { return m_domAgent.get(); } + void releaseDOMAgent(); friend class InspectorFrontend; // Following are used from InspectorFrontend only. We don't want to expose them to the diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h index b9bdb6b..3f736f7 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h @@ -68,6 +68,11 @@ namespace WebCore { class InspectorDOMAgent : public EventListener { public: + static PassRefPtr<InspectorDOMAgent> create(InspectorFrontend* frontend) + { + return adoptRef(new InspectorDOMAgent(frontend)); + } + static const InspectorDOMAgent* cast(const EventListener* listener) { return listener->type() == InspectorDOMAgentType diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp index 2e6dc2b..2c422ac 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp @@ -78,9 +78,9 @@ void InspectorFrontend::didCommitLoad() callSimpleFunction("didCommitLoad"); } -void InspectorFrontend::addMessageToConsole(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<ScriptValue> wrappedArguments, const String& message) +void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<ScriptValue> wrappedArguments, const String& message) { - OwnPtr<ScriptFunctionCall> function(newFunctionCall("addMessageToConsole")); + OwnPtr<ScriptFunctionCall> function(newFunctionCall("addConsoleMessage")); function->appendArgument(messageObj); if (!frames.isEmpty()) { for (unsigned i = 0; i < frames.size(); ++i) @@ -93,6 +93,13 @@ void InspectorFrontend::addMessageToConsole(const ScriptObject& messageObj, cons function->call(); } +void InspectorFrontend::updateConsoleMessageRepeatCount(const int count) +{ + OwnPtr<ScriptFunctionCall> function(newFunctionCall("updateConsoleMessageRepeatCount")); + function->appendArgument(count); + function->call(); +} + void InspectorFrontend::clearConsoleMessages() { callSimpleFunction("clearConsoleMessages"); @@ -207,10 +214,10 @@ void InspectorFrontend::timelineProfilerWasStopped() callSimpleFunction("timelineProfilerWasStopped"); } -void InspectorFrontend::addItemToTimeline(const ScriptObject& itemObj) +void InspectorFrontend::addRecordToTimeline(const ScriptObject& record) { - OwnPtr<ScriptFunctionCall> function(newFunctionCall("addItemToTimeline")); - function->appendArgument(itemObj); + OwnPtr<ScriptFunctionCall> function(newFunctionCall("addRecordToTimeline")); + function->appendArgument(record); function->call(); } diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h index 0883ac2..3cb9b8c 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h @@ -63,7 +63,8 @@ namespace WebCore { ScriptObject newScriptObject(); void didCommitLoad(); - void addMessageToConsole(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<ScriptValue> wrappedArguments, const String& message); + void addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<ScriptValue> wrappedArguments, const String& message); + void updateConsoleMessageRepeatCount(const int count); void clearConsoleMessages(); bool addResource(long long identifier, const ScriptObject& resourceObj); @@ -126,7 +127,7 @@ namespace WebCore { void timelineProfilerWasStarted(); void timelineProfilerWasStopped(); - void addItemToTimeline(const ScriptObject& itemObj); + void addRecordToTimeline(const ScriptObject&); void didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString); void didDispatchOnInjectedScript(int callId, const String& result, bool isException); diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp index 69ab39b..b8bb22b 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp @@ -33,6 +33,7 @@ #if ENABLE(INSPECTOR) +#include "Cache.h" #include "CachedResource.h" #include "DocLoader.h" #include "DocumentLoader.h" @@ -227,6 +228,18 @@ void InspectorResource::releaseScriptObject(InspectorFrontend* frontend, bool ca frontend->removeResource(m_identifier); } +CachedResource* InspectorResource::cachedResource() const +{ + // Try hard to find a corresponding CachedResource. During preloading, DocLoader may not have the resource in document resources set yet, + // but Inspector will already try to fetch data that is only available via CachedResource (and it won't update once the resource is added, + // because m_changes will not have the appropriate bits set). + const String& url = requestURL(); + CachedResource* cachedResource = m_frame->document()->docLoader()->cachedResource(url); + if (!cachedResource) + cachedResource = cache()->resourceForURL(url); + return cachedResource; +} + InspectorResource::Type InspectorResource::type() const { if (!m_xmlHttpResponseText.isNull()) @@ -238,7 +251,7 @@ InspectorResource::Type InspectorResource::type() const if (m_loader->frameLoader() && m_requestURL == m_loader->frameLoader()->iconURL()) return Image; - CachedResource* cachedResource = m_frame->document()->docLoader()->cachedResource(requestURL()); + CachedResource* cachedResource = this->cachedResource(); if (!cachedResource) return Other; @@ -281,13 +294,14 @@ String InspectorResource::sourceString() const return encoding.decode(buffer->data(), buffer->size()); } -PassRefPtr<SharedBuffer> InspectorResource::resourceData(String* textEncodingName) const { +PassRefPtr<SharedBuffer> InspectorResource::resourceData(String* textEncodingName) const +{ if (m_requestURL == m_loader->requestURL()) { *textEncodingName = m_frame->document()->inputEncoding(); return m_loader->mainResourceData(); } - CachedResource* cachedResource = m_frame->document()->docLoader()->cachedResource(requestURL()); + CachedResource* cachedResource = this->cachedResource(); if (!cachedResource) return 0; diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorResource.h b/src/3rdparty/webkit/WebCore/inspector/InspectorResource.h index 880eab7..0335586 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorResource.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorResource.h @@ -145,6 +145,8 @@ namespace WebCore { InspectorResource(long long identifier, DocumentLoader*); Type type() const; + CachedResource* cachedResource() const; + long long m_identifier; RefPtr<DocumentLoader> m_loader; RefPtr<Frame> m_frame; diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.cpp index c3ad075..4f7b736 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.cpp @@ -33,19 +33,16 @@ #if ENABLE(INSPECTOR) -#include "DOMDispatchTimelineItem.h" #include "Event.h" #include "InspectorFrontend.h" -#include "TimelineItem.h" +#include "TimelineRecordFactory.h" #include <wtf/CurrentTime.h> namespace WebCore { InspectorTimelineAgent::InspectorTimelineAgent(InspectorFrontend* frontend) - : m_sessionStartTime(currentTimeInMilliseconds()) - , m_frontend(frontend) - , m_currentTimelineItem(0) + : m_frontend(frontend) { ASSERT(m_frontend); } @@ -56,75 +53,140 @@ InspectorTimelineAgent::~InspectorTimelineAgent() void InspectorTimelineAgent::willDispatchDOMEvent(const Event& event) { - m_currentTimelineItem = new DOMDispatchTimelineItem(m_currentTimelineItem.release(), sessionTimeInMilliseconds(), event); + pushCurrentRecord(TimelineRecordFactory::createDOMDispatchRecord(m_frontend, currentTimeInMilliseconds(), event), DOMDispatchTimelineRecordType); } void InspectorTimelineAgent::didDispatchDOMEvent() { - ASSERT(m_currentTimelineItem->type() == DOMDispatchTimelineItemType); - didCompleteCurrentRecord(); + didCompleteCurrentRecord(DOMDispatchTimelineRecordType); } void InspectorTimelineAgent::willLayout() { - m_currentTimelineItem = new TimelineItem(m_currentTimelineItem.release(), sessionTimeInMilliseconds(), LayoutTimelineItemType); + pushCurrentRecord(TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()), LayoutTimelineRecordType); } void InspectorTimelineAgent::didLayout() { - ASSERT(m_currentTimelineItem->type() == LayoutTimelineItemType); - didCompleteCurrentRecord(); + didCompleteCurrentRecord(LayoutTimelineRecordType); } void InspectorTimelineAgent::willRecalculateStyle() { - m_currentTimelineItem = new TimelineItem(m_currentTimelineItem.release(), sessionTimeInMilliseconds(), RecalculateStylesTimelineItemType); + pushCurrentRecord(TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()), RecalculateStylesTimelineRecordType); } void InspectorTimelineAgent::didRecalculateStyle() { - ASSERT(m_currentTimelineItem->type() == RecalculateStylesTimelineItemType); - didCompleteCurrentRecord(); + didCompleteCurrentRecord(RecalculateStylesTimelineRecordType); } void InspectorTimelineAgent::willPaint() { - m_currentTimelineItem = new TimelineItem(m_currentTimelineItem.release(), sessionTimeInMilliseconds(), PaintTimelineItemType); + pushCurrentRecord(TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()), PaintTimelineRecordType); } void InspectorTimelineAgent::didPaint() { - ASSERT(m_currentTimelineItem->type() == PaintTimelineItemType); - didCompleteCurrentRecord(); + didCompleteCurrentRecord(PaintTimelineRecordType); } void InspectorTimelineAgent::willWriteHTML() { - m_currentTimelineItem = new TimelineItem(m_currentTimelineItem.release(), sessionTimeInMilliseconds(), ParseHTMLTimelineItemType); + pushCurrentRecord(TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()), ParseHTMLTimelineRecordType); } void InspectorTimelineAgent::didWriteHTML() { - ASSERT(m_currentTimelineItem->type() == ParseHTMLTimelineItemType); - didCompleteCurrentRecord(); + didCompleteCurrentRecord(ParseHTMLTimelineRecordType); +} + +void InspectorTimelineAgent::didInstallTimer(int timerId, int timeout, bool singleShot) +{ + addRecordToTimeline(TimelineRecordFactory::createTimerInstallRecord(m_frontend, currentTimeInMilliseconds(), timerId, + timeout, singleShot), TimerInstallTimelineRecordType); +} + +void InspectorTimelineAgent::didRemoveTimer(int timerId) +{ + addRecordToTimeline(TimelineRecordFactory::createGenericTimerRecord(m_frontend, currentTimeInMilliseconds(), timerId), + TimerRemoveTimelineRecordType); +} + +void InspectorTimelineAgent::willFireTimer(int timerId) +{ + pushCurrentRecord(TimelineRecordFactory::createGenericTimerRecord(m_frontend, currentTimeInMilliseconds(), timerId), + TimerFireTimelineRecordType); +} + +void InspectorTimelineAgent::didFireTimer() +{ + didCompleteCurrentRecord(TimerFireTimelineRecordType); +} + +void InspectorTimelineAgent::willChangeXHRReadyState(const String& url, int readyState) +{ + pushCurrentRecord(TimelineRecordFactory::createXHRReadyStateChangeTimelineRecord(m_frontend, currentTimeInMilliseconds(), url, readyState), + XHRReadyStateChangeRecordType); +} + +void InspectorTimelineAgent::didChangeXHRReadyState() +{ + didCompleteCurrentRecord(XHRReadyStateChangeRecordType); +} + +void InspectorTimelineAgent::willLoadXHR(const String& url) +{ + pushCurrentRecord(TimelineRecordFactory::createXHRLoadTimelineRecord(m_frontend, currentTimeInMilliseconds(), url), XHRLoadRecordType); +} + +void InspectorTimelineAgent::didLoadXHR() +{ + didCompleteCurrentRecord(XHRLoadRecordType); +} + +void InspectorTimelineAgent::willEvaluateScriptTag(const String& url, int lineNumber) +{ + pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptTagTimelineRecord(m_frontend, currentTimeInMilliseconds(), url, lineNumber), EvaluateScriptTagTimelineRecordType); +} + +void InspectorTimelineAgent::didEvaluateScriptTag() +{ + didCompleteCurrentRecord(EvaluateScriptTagTimelineRecordType); } void InspectorTimelineAgent::reset() { - m_sessionStartTime = currentTimeInMilliseconds(); - m_currentTimelineItem.set(0); + m_recordStack.clear(); +} + +void InspectorTimelineAgent::resetFrontendProxyObject(InspectorFrontend* frontend) +{ + ASSERT(frontend); + reset(); + m_frontend = frontend; } -void InspectorTimelineAgent::didCompleteCurrentRecord() +void InspectorTimelineAgent::addRecordToTimeline(ScriptObject record, TimelineRecordType type) { - OwnPtr<TimelineItem> item(m_currentTimelineItem.release()); - m_currentTimelineItem = item->releasePrevious(); + record.set("type", type); + if (m_recordStack.isEmpty()) + m_frontend->addRecordToTimeline(record); + else { + TimelineRecordEntry parent = m_recordStack.last(); + parent.children.set(parent.children.length(), record); + } +} - item->setEndTime(sessionTimeInMilliseconds()); - if (m_currentTimelineItem.get()) - m_currentTimelineItem->addChildItem(item.release()); - else - item->addToTimeline(m_frontend); +void InspectorTimelineAgent::didCompleteCurrentRecord(TimelineRecordType type) +{ + ASSERT(!m_recordStack.isEmpty()); + TimelineRecordEntry entry = m_recordStack.last(); + m_recordStack.removeLast(); + ASSERT(entry.type == type); + entry.record.set("children", entry.children); + entry.record.set("endTime", currentTimeInMilliseconds()); + addRecordToTimeline(entry.record, type); } double InspectorTimelineAgent::currentTimeInMilliseconds() @@ -132,9 +194,9 @@ double InspectorTimelineAgent::currentTimeInMilliseconds() return currentTime() * 1000.0; } -double InspectorTimelineAgent::sessionTimeInMilliseconds() +void InspectorTimelineAgent::pushCurrentRecord(ScriptObject record, TimelineRecordType type) { - return currentTimeInMilliseconds() - m_sessionStartTime; + m_recordStack.append(TimelineRecordEntry(record, m_frontend->newScriptArray(), type)); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.h b/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.h index 4095fed..0401977 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.h @@ -31,16 +31,30 @@ #ifndef InspectorTimelineAgent_h #define InspectorTimelineAgent_h +#include "Document.h" +#include "ScriptExecutionContext.h" #include "ScriptObject.h" #include "ScriptArray.h" - -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> +#include <wtf/Vector.h> namespace WebCore { class Event; class InspectorFrontend; - class TimelineItem; + + // Must be kept in sync with TimelineAgent.js + enum TimelineRecordType { + DOMDispatchTimelineRecordType = 0, + LayoutTimelineRecordType = 1, + RecalculateStylesTimelineRecordType = 2, + PaintTimelineRecordType = 3, + ParseHTMLTimelineRecordType = 4, + TimerInstallTimelineRecordType = 5, + TimerRemoveTimelineRecordType = 6, + TimerFireTimelineRecordType = 7, + XHRReadyStateChangeRecordType = 8, + XHRLoadRecordType = 9, + EvaluateScriptTagTimelineRecordType = 10, + }; class InspectorTimelineAgent { public: @@ -48,30 +62,66 @@ namespace WebCore { ~InspectorTimelineAgent(); void reset(); + void resetFrontendProxyObject(InspectorFrontend*); // Methods called from WebCore. void willDispatchDOMEvent(const Event&); void didDispatchDOMEvent(); + void willLayout(); void didLayout(); + void willRecalculateStyle(); void didRecalculateStyle(); + void willPaint(); void didPaint(); - void didWriteHTML(); + void willWriteHTML(); - private: - double sessionTimeInMilliseconds(); + void didWriteHTML(); + + void didInstallTimer(int timerId, int timeout, bool singleShot); + void didRemoveTimer(int timerId); + void willFireTimer(int timerId); + void didFireTimer(); + + void willChangeXHRReadyState(const String&, int); + void didChangeXHRReadyState(); + void willLoadXHR(const String&); + void didLoadXHR(); + void willEvaluateScriptTag(const String&, int); + void didEvaluateScriptTag(); + + static InspectorTimelineAgent* retrieve(ScriptExecutionContext*); + private: + struct TimelineRecordEntry { + TimelineRecordEntry(ScriptObject record, ScriptArray children, TimelineRecordType type) : record(record), children(children), type(type) { } + ScriptObject record; + ScriptArray children; + TimelineRecordType type; + }; + + void pushCurrentRecord(ScriptObject, TimelineRecordType); + static double currentTimeInMilliseconds(); - void didCompleteCurrentRecord(); + void didCompleteCurrentRecord(TimelineRecordType); + + void addRecordToTimeline(ScriptObject, TimelineRecordType); - double m_sessionStartTime; InspectorFrontend* m_frontend; - OwnPtr<TimelineItem> m_currentTimelineItem; + + Vector< TimelineRecordEntry > m_recordStack; }; +inline InspectorTimelineAgent* InspectorTimelineAgent::retrieve(ScriptExecutionContext* context) +{ + if (context->isDocument()) + return static_cast<Document*>(context)->inspectorTimelineAgent(); + return 0; +} + } // namespace WebCore #endif // !defined(InspectorTimelineAgent_h) diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp b/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp index 9225a03..1559d82 100644 --- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "JavaScriptCallFrame.h" +#include "JSDOMBinding.h" #if ENABLE(JAVASCRIPT_DEBUGGER) @@ -105,7 +106,7 @@ JSValue JavaScriptCallFrame::evaluate(const UString& script, JSValue& exception) return jsNull(); JSLock lock(SilenceAssertionsOnly); - return m_debuggerCallFrame.evaluate(script, exception); + return DebuggerCallFrame_evaluateInWorld(m_debuggerCallFrame, script, exception); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/inspector/TimelineItem.cpp b/src/3rdparty/webkit/WebCore/inspector/TimelineItem.cpp deleted file mode 100644 index b368c49..0000000 --- a/src/3rdparty/webkit/WebCore/inspector/TimelineItem.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* -* Copyright (C) 2009 Google Inc. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are -* met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above -* copyright notice, this list of conditions and the following disclaimer -* in the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Google Inc. nor the names of its -* contributors may be used to endorse or promote products derived from -* this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "config.h" -#include "TimelineItem.h" - -#if ENABLE(INSPECTOR) - -#include "InspectorFrontend.h" -#include "ScriptArray.h" -#include "ScriptObject.h" - -namespace WebCore { - -TimelineItem::TimelineItem(PassOwnPtr<TimelineItem> previous, double startTime, TimelineItemType itemType) - : m_startTime(startTime) - , m_endTime(0.0) - , m_itemType(itemType) - , m_previous(previous) -{ -} - -void TimelineItem::addToTimeline(InspectorFrontend* frontend) -{ - frontend->addItemToTimeline(convertToScriptObject(frontend)); -} - -ScriptObject TimelineItem::convertToScriptObject(InspectorFrontend* frontend) -{ - ScriptObject selfObj = frontend->newScriptObject(); - selfObj.set("time", m_startTime); - selfObj.set("type", static_cast<int>(m_itemType)); - selfObj.set("duration", m_endTime - m_startTime); - ScriptArray children = convertChildrenToScriptArray(frontend); - selfObj.set("children", children); - return selfObj; -} - -ScriptArray TimelineItem::convertChildrenToScriptArray(InspectorFrontend* frontend) -{ - ScriptArray children = frontend->newScriptArray(); - for (unsigned i = 0; i < m_children.size(); ++i) - children.set(i, m_children[i]->convertToScriptObject(frontend)); - return children; -} - -void TimelineItem::addChildItem(PassOwnPtr<TimelineItem> timelineItem) -{ - m_children.append(timelineItem); -} - -} // namespace WebCore - -#endif // ENABLE(INSPECTOR) diff --git a/src/3rdparty/webkit/WebCore/inspector/TimelineItem.h b/src/3rdparty/webkit/WebCore/inspector/TimelineItem.h deleted file mode 100644 index 1909230..0000000 --- a/src/3rdparty/webkit/WebCore/inspector/TimelineItem.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -* Copyright (C) 2009 Google Inc. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are -* met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above -* copyright notice, this list of conditions and the following disclaimer -* in the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Google Inc. nor the names of its -* contributors may be used to endorse or promote products derived from -* this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef TimelineItem_h -#define TimelineItem_h - -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/Vector.h> - -namespace WebCore { - - class InspectorFrontend; - class TimelineItem; - class ScriptArray; - class ScriptObject; - - typedef Vector<OwnPtr<TimelineItem> > TimelineItems; - - // Must be kept in sync with TimelineAgent.js - enum TimelineItemType { - DOMDispatchTimelineItemType = 0, - LayoutTimelineItemType = 1, - RecalculateStylesTimelineItemType = 2, - PaintTimelineItemType = 3, - ParseHTMLTimelineItemType = 4, - }; - - class TimelineItem { - public: - TimelineItem(PassOwnPtr<TimelineItem>, double startTime, TimelineItemType); - - virtual ~TimelineItem() { } - - TimelineItem* previous() const { return m_previous.get(); } - - PassOwnPtr<TimelineItem*> releasePrevious() { return m_previous.release(); } - - void addToTimeline(InspectorFrontend*); - - void addChildItem(PassOwnPtr<TimelineItem>); - - void setEndTime(double endTime) { m_endTime = endTime; } - - TimelineItemType type() { return m_itemType; } - protected: - virtual ScriptObject convertToScriptObject(InspectorFrontend*); - - ScriptArray convertChildrenToScriptArray(InspectorFrontend*); - - private: - double m_startTime; - double m_endTime; - TimelineItemType m_itemType; - OwnPtr<TimelineItem> m_previous; - TimelineItems m_children; - }; - -} // namespace WebCore - -#endif // !defined(TimelineItem_h) diff --git a/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.cpp b/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.cpp new file mode 100644 index 0000000..085bcd9 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "TimelineRecordFactory.h" + +#if ENABLE(INSPECTOR) + +#include "Event.h" +#include "InspectorFrontend.h" +#include "ScriptArray.h" +#include "ScriptObject.h" +namespace WebCore { + +// static +ScriptObject TimelineRecordFactory::createGenericRecord(InspectorFrontend* frontend, double startTime) +{ + ScriptObject record = frontend->newScriptObject(); + record.set("startTime", startTime); + return record; +} + +// static +ScriptObject TimelineRecordFactory::createDOMDispatchRecord(InspectorFrontend* frontend, double startTime, const Event& event) +{ + ScriptObject record = createGenericRecord(frontend, startTime); + ScriptObject data = frontend->newScriptObject(); + data.set("type", event.type().string()); + record.set("data", data); + return record; +} + +// static +ScriptObject TimelineRecordFactory::createGenericTimerRecord(InspectorFrontend* frontend, double startTime, int timerId) +{ + ScriptObject record = createGenericRecord(frontend, startTime); + ScriptObject data = frontend->newScriptObject(); + data.set("timerId", timerId); + record.set("data", data); + return record; +} + +// static +ScriptObject TimelineRecordFactory::createTimerInstallRecord(InspectorFrontend* frontend, double startTime, int timerId, int timeout, bool singleShot) +{ + ScriptObject record = createGenericRecord(frontend, startTime); + ScriptObject data = frontend->newScriptObject(); + data.set("timerId", timerId); + data.set("timeout", timeout); + data.set("singleShot", singleShot); + record.set("data", data); + return record; +} + +// static +ScriptObject TimelineRecordFactory::createXHRReadyStateChangeTimelineRecord(InspectorFrontend* frontend, double startTime, const String& url, int readyState) +{ + ScriptObject record = createGenericRecord(frontend, startTime); + ScriptObject data = frontend->newScriptObject(); + data.set("url", url); + data.set("readyState", readyState); + record.set("data", data); + return record; +} + +// static +ScriptObject TimelineRecordFactory::createXHRLoadTimelineRecord(InspectorFrontend* frontend, double startTime, const String& url) +{ + ScriptObject record = createGenericRecord(frontend, startTime); + ScriptObject data = frontend->newScriptObject(); + data.set("url", url); + record.set("data", data); + return record; +} + +// static +ScriptObject TimelineRecordFactory::createEvaluateScriptTagTimelineRecord(InspectorFrontend* frontend, double startTime, const String& url, double lineNumber) +{ + ScriptObject item = createGenericRecord(frontend, startTime); + ScriptObject data = frontend->newScriptObject(); + data.set("url", url); + data.set("lineNumber", lineNumber); + item.set("data", data); + return item; +} + +} // namespace WebCore + +#endif // ENABLE(INSPECTOR) diff --git a/src/3rdparty/webkit/WebCore/dom/HTMLAllCollection.idl b/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.h index dee365f..3d36649 100644 --- a/src/3rdparty/webkit/WebCore/dom/HTMLAllCollection.idl +++ b/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009 Google Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -27,14 +27,37 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#ifndef TimelineRecordFactory_h +#define TimelineRecordFactory_h -module html { +#include "PlatformString.h" - // This interface is used for undetectable HTMLCollections. - // An undetectable HTMLCollection behaves like an HTMLCollection - // when used, but the 'typeof' operator returns undefined and - // ToBoolean returns false. - interface HTMLAllCollection : HTMLCollection { +namespace WebCore { + + class Event; + class InspectorFrontend; + class ScriptObject; + + class TimelineRecordFactory { + public: + static ScriptObject createGenericRecord(InspectorFrontend*, double startTime); + + static ScriptObject createDOMDispatchRecord(InspectorFrontend*, double startTime, const Event&); + + static ScriptObject createGenericTimerRecord(InspectorFrontend*, double startTime, int timerId); + + static ScriptObject createTimerInstallRecord(InspectorFrontend*, double startTime, int timerId, int timeout, bool singleShot); + + static ScriptObject createXHRReadyStateChangeTimelineRecord(InspectorFrontend*, double startTime, const String& url, int readyState); + static ScriptObject createXHRLoadTimelineRecord(InspectorFrontend*, double startTime, const String& url); + + static ScriptObject createEvaluateScriptTagTimelineRecord(InspectorFrontend*, double startTime, const String&, double lineNumber); + + private: + TimelineRecordFactory() { } }; -} +} // namespace WebCore + +#endif // !defined(TimelineRecordFactory_h) diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/AbstractTimelinePanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/AbstractTimelinePanel.js new file mode 100644 index 0000000..75e4062 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/AbstractTimelinePanel.js @@ -0,0 +1,548 @@ +/* + * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.AbstractTimelinePanel = function() +{ + WebInspector.Panel.call(this); + this._items = []; + this._staleItems = []; +} + +WebInspector.AbstractTimelinePanel.prototype = { + get categories() + { + // Should be implemented by the concrete subclasses. + return {}; + }, + + populateSidebar: function() + { + // Should be implemented by the concrete subclasses. + }, + + createItemTreeElement: function(item) + { + // Should be implemented by the concrete subclasses. + }, + + createItemGraph: function(item) + { + // Should be implemented by the concrete subclasses. + }, + + createInterface: function() + { + this._createFilterPanel(); + + this.containerElement = document.createElement("div"); + this.containerElement.id = "resources-container"; + this.containerElement.addEventListener("scroll", this._updateDividersLabelBarPosition.bind(this), false); + this.element.appendChild(this.containerElement); + + this.createSidebar(this.containerElement, this.element); + this.sidebarElement.id = "resources-sidebar"; + this.populateSidebar(); + + this._createGraph(); + }, + + _createFilterPanel: function() + { + this.filterBarElement = document.createElement("div"); + this.filterBarElement.id = "resources-filter"; + this.filterBarElement.className = "scope-bar"; + this.element.appendChild(this.filterBarElement); + + function createFilterElement(category) + { + if (category === "all") + var label = WebInspector.UIString("All"); + else if (this.categories[category]) + var label = this.categories[category].title; + + var categoryElement = document.createElement("li"); + categoryElement.category = category; + categoryElement.addStyleClass(category); + categoryElement.appendChild(document.createTextNode(label)); + categoryElement.addEventListener("click", this._updateFilter.bind(this), false); + this.filterBarElement.appendChild(categoryElement); + + return categoryElement; + } + + this.filterAllElement = createFilterElement.call(this, "all"); + + // Add a divider + var dividerElement = document.createElement("div"); + dividerElement.addStyleClass("divider"); + this.filterBarElement.appendChild(dividerElement); + + for (var category in this.categories) + createFilterElement.call(this, category); + }, + + _showCategory: function(category) + { + var filterClass = "filter-" + category.toLowerCase(); + this.itemsGraphsElement.addStyleClass(filterClass); + this.itemsTreeElement.childrenListElement.addStyleClass(filterClass); + }, + + _hideCategory: function(category) + { + var filterClass = "filter-" + category.toLowerCase(); + this.itemsGraphsElement.removeStyleClass(filterClass); + this.itemsTreeElement.childrenListElement.removeStyleClass(filterClass); + }, + + filter: function(target, selectMultiple) + { + function unselectAll() + { + for (var i = 0; i < this.filterBarElement.childNodes.length; ++i) { + var child = this.filterBarElement.childNodes[i]; + if (!child.category) + continue; + + child.removeStyleClass("selected"); + this._hideCategory(child.category); + } + } + + if (target === this.filterAllElement) { + if (target.hasStyleClass("selected")) { + // We can't unselect All, so we break early here + return; + } + + // If All wasn't selected, and now is, unselect everything else. + unselectAll.call(this); + } else { + // Something other than All is being selected, so we want to unselect All. + if (this.filterAllElement.hasStyleClass("selected")) { + this.filterAllElement.removeStyleClass("selected"); + this._hideCategory("all"); + } + } + + if (!selectMultiple) { + // If multiple selection is off, we want to unselect everything else + // and just select ourselves. + unselectAll.call(this); + + target.addStyleClass("selected"); + this._showCategory(target.category); + return; + } + + if (target.hasStyleClass("selected")) { + // If selectMultiple is turned on, and we were selected, we just + // want to unselect ourselves. + target.removeStyleClass("selected"); + this._hideCategory(target.category); + } else { + // If selectMultiple is turned on, and we weren't selected, we just + // want to select ourselves. + target.addStyleClass("selected"); + this._showCategory(target.category); + } + }, + + _updateFilter: function(e) + { + var isMac = InspectorController.platform().indexOf("mac-") === 0; + var selectMultiple = false; + if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey) + selectMultiple = true; + if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey) + selectMultiple = true; + + this.filter(e.target, selectMultiple); + + // When we are updating our filtering, scroll to the top so we don't end up + // in blank graph under all the resources. + this.containerElement.scrollTop = 0; + }, + + _createGraph: function() + { + this._containerContentElement = document.createElement("div"); + this._containerContentElement.id = "resources-container-content"; + this.containerElement.appendChild(this._containerContentElement); + + this.summaryBar = new WebInspector.SummaryBar(this.categories); + this.summaryBar.element.id = "resources-summary"; + this._containerContentElement.appendChild(this.summaryBar.element); + + this.itemsGraphsElement = document.createElement("div"); + this.itemsGraphsElement.id = "resources-graphs"; + this._containerContentElement.appendChild(this.itemsGraphsElement); + + this.dividersElement = document.createElement("div"); + this.dividersElement.id = "resources-dividers"; + this._containerContentElement.appendChild(this.dividersElement); + + this.eventDividersElement = document.createElement("div"); + this.eventDividersElement.id = "resources-event-dividers"; + this._containerContentElement.appendChild(this.eventDividersElement); + + this.dividersLabelBarElement = document.createElement("div"); + this.dividersLabelBarElement.id = "resources-dividers-label-bar"; + this._containerContentElement.appendChild(this.dividersLabelBarElement); + }, + + updateGraphDividersIfNeeded: function(force) + { + if (!this.visible) { + this.needsRefresh = true; + return false; + } + + if (document.body.offsetWidth <= 0) { + // The stylesheet hasn't loaded yet or the window is closed, + // so we can't calculate what is need. Return early. + return false; + } + + var dividerCount = Math.round(this.dividersElement.offsetWidth / 64); + var slice = this.calculator.boundarySpan / dividerCount; + if (!force && this._currentDividerSlice === slice) + return false; + + this._currentDividerSlice = slice; + + this.dividersElement.removeChildren(); + this.eventDividersElement.removeChildren(); + this.dividersLabelBarElement.removeChildren(); + + for (var i = 1; i <= dividerCount; ++i) { + var divider = document.createElement("div"); + divider.className = "resources-divider"; + if (i === dividerCount) + divider.addStyleClass("last"); + divider.style.left = ((i / dividerCount) * 100) + "%"; + + this.dividersElement.appendChild(divider.cloneNode()); + + var label = document.createElement("div"); + label.className = "resources-divider-label"; + if (!isNaN(slice)) + label.textContent = this.calculator.formatValue(slice * i); + divider.appendChild(label); + + this.dividersLabelBarElement.appendChild(divider); + } + }, + + _updateDividersLabelBarPosition: function() + { + var scrollTop = this.containerElement.scrollTop; + var dividersTop = (scrollTop < this.summaryBar.element.offsetHeight ? this.summaryBar.element.offsetHeight : scrollTop); + this.dividersElement.style.top = scrollTop + "px"; + this.eventDividersElement.style.top = scrollTop + "px"; + this.dividersLabelBarElement.style.top = dividersTop + "px"; + }, + + get needsRefresh() + { + return this._needsRefresh; + }, + + set needsRefresh(x) + { + if (this._needsRefresh === x) + return; + + this._needsRefresh = x; + + if (x) { + if (this.visible && !("_refreshTimeout" in this)) + this._refreshTimeout = setTimeout(this.refresh.bind(this), 500); + } else { + if ("_refreshTimeout" in this) { + clearTimeout(this._refreshTimeout); + delete this._refreshTimeout; + } + } + }, + + refreshIfNeeded: function() + { + if (this.needsRefresh) + this.refresh(); + }, + + show: function() + { + WebInspector.Panel.prototype.show.call(this); + + this._updateDividersLabelBarPosition(); + this.refreshIfNeeded(); + }, + + resize: function() + { + this.updateGraphDividersIfNeeded(); + }, + + updateMainViewWidth: function(width) + { + this._containerContentElement.style.left = width + "px"; + this.updateGraphDividersIfNeeded(); + }, + + refresh: function() + { + this.needsRefresh = false; + + var staleItemsLength = this._staleItems.length; + var boundariesChanged = false; + + for (var i = 0; i < staleItemsLength; ++i) { + var item = this._staleItems[i]; + if (!item._itemTreeElement) { + // Create the timeline tree element and graph. + item._itemTreeElement = this.createItemTreeElement(item); + item._itemTreeElement._itemGraph = this.createItemGraph(item); + + this.itemsTreeElement.appendChild(item._itemTreeElement); + this.itemsGraphsElement.appendChild(item._itemTreeElement._itemGraph.graphElement); + } + + if (item._itemTreeElement.refresh) + item._itemTreeElement.refresh(); + + if (this.calculator.updateBoundaries(item)) + boundariesChanged = true; + } + + if (boundariesChanged) { + // The boundaries changed, so all item graphs are stale. + this._staleItems = this._items; + staleItemsLength = this._staleItems.length; + } + + for (var i = 0; i < staleItemsLength; ++i) + this._staleItems[i]._itemTreeElement._itemGraph.refresh(this.calculator); + + this._staleItems = []; + + this.updateGraphDividersIfNeeded(); + }, + + reset: function() + { + this.containerElement.scrollTop = 0; + + if (this._calculator) + this._calculator.reset(); + + if (this._items) { + var itemsLength = this._items.length; + for (var i = 0; i < itemsLength; ++i) { + var item = this._items[i]; + delete item._itemsTreeElement; + } + } + + this._items = []; + this._staleItems = []; + + this.itemsTreeElement.removeChildren(); + this.itemsGraphsElement.removeChildren(); + + this.updateGraphDividersIfNeeded(true); + }, + + get calculator() + { + return this._calculator; + }, + + set calculator(x) + { + if (!x || this._calculator === x) + return; + + this._calculator = x; + this._calculator.reset(); + + this._staleItems = this._items; + this.refresh(); + }, + + addItem: function(item) + { + this._items.push(item); + this.refreshItem(item); + }, + + removeItem: function(item) + { + this._items.remove(item, true); + + if (item._itemTreeElement) { + this.itemsTreeElement.removeChild(resource._itemTreeElement); + this.itemsGraphsElement.removeChild(resource._itemTreeElement._itemGraph.graphElement); + } + + delete item._itemTreeElement; + this.adjustScrollPosition(); + }, + + refreshItem: function(item) + { + this._staleItems.push(item); + this.needsRefresh = true; + }, + + revealAndSelectItem: function(item) + { + if (item._itemsTreeElement) { + item._itemsTreeElement.reveal(); + item._itemsTreeElement.select(true); + } + }, + + sortItems: function(sortingFunction) + { + var sortedElements = [].concat(this.itemsTreeElement.children); + sortedElements.sort(sortingFunction); + + var sortedElementsLength = sortedElements.length; + for (var i = 0; i < sortedElementsLength; ++i) { + var treeElement = sortedElements[i]; + if (treeElement === this.itemsTreeElement.children[i]) + continue; + + var wasSelected = treeElement.selected; + this.itemsTreeElement.removeChild(treeElement); + this.itemsTreeElement.insertChild(treeElement, i); + if (wasSelected) + treeElement.select(true); + + var graphElement = treeElement._itemGraph.graphElement; + this.itemsGraphsElement.insertBefore(graphElement, this.itemsGraphsElement.children[i]); + } + }, + + adjustScrollPosition: function() + { + // Prevent the container from being scrolled off the end. + if ((this.containerElement.scrollTop + this.containerElement.offsetHeight) > this.sidebarElement.offsetHeight) + this.containerElement.scrollTop = (this.sidebarElement.offsetHeight - this.containerElement.offsetHeight); + } +} + +WebInspector.AbstractTimelinePanel.prototype.__proto__ = WebInspector.Panel.prototype; + +WebInspector.AbstractTimelineCalculator = function() +{ +} + +WebInspector.AbstractTimelineCalculator.prototype = { + computeSummaryValues: function(items) + { + var total = 0; + var categoryValues = {}; + + var itemsLength = items.length; + for (var i = 0; i < itemsLength; ++i) { + var item = items[i]; + var value = this._value(item); + if (typeof value === "undefined") + continue; + if (!(item.category.name in categoryValues)) + categoryValues[item.category.name] = 0; + categoryValues[item.category.name] += value; + total += value; + } + + return {categoryValues: categoryValues, total: total}; + }, + + computeBarGraphPercentages: function(item) + { + return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan) * 100}; + }, + + computeBarGraphLabels: function(item) + { + const label = this.formatValue(this._value(item)); + return {left: label, right: label, tooltip: label}; + }, + + get boundarySpan() + { + return this.maximumBoundary - this.minimumBoundary; + }, + + updateBoundaries: function(item) + { + this.minimumBoundary = 0; + + var value = this._value(item); + if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) { + this.maximumBoundary = value; + return true; + } + return false; + }, + + reset: function() + { + delete this.minimumBoundary; + delete this.maximumBoundary; + }, + + _value: function(item) + { + return 0; + }, + + formatValue: function(value) + { + return value.toString(); + } +} + +WebInspector.AbstractTimelineCategory = function(name, title, color) +{ + this.name = name; + this.title = title; + this.color = color; +} + +WebInspector.AbstractTimelineCategory.prototype = { + toString: function() + { + return this.title; + } +} diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js b/src/3rdparty/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js index 89b4ddc..41a8a3a 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js @@ -29,6 +29,110 @@ // each child still represent the root node. We have to be particularly careful of recursion with this mode // because a root node can represent itself AND an ancestor. +WebInspector.BottomUpProfileDataGridNode = function(/*ProfileView*/ profileView, /*ProfileNode*/ profileNode, /*BottomUpProfileDataGridTree*/ owningTree) +{ + // In bottom up mode, our parents are our children since we display an inverted tree. + // However, we don't want to show the very top parent since it is redundant. + var hasChildren = !!(profileNode.parent && profileNode.parent.parent); + + WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, hasChildren); + + this._remainingNodeInfos = []; +} + +WebInspector.BottomUpProfileDataGridNode.prototype = { + _takePropertiesFromProfileDataGridNode: function(/*ProfileDataGridNode*/ profileDataGridNode) + { + this._save(); + + this.selfTime = profileDataGridNode.selfTime; + this.totalTime = profileDataGridNode.totalTime; + this.numberOfCalls = profileDataGridNode.numberOfCalls; + }, + + // When focusing, we keep just the members of the callstack. + _keepOnlyChild: function(/*ProfileDataGridNode*/ child) + { + this._save(); + + this.removeChildren(); + this.appendChild(child); + }, + + _exclude: function(aCallUID) + { + if (this._remainingNodeInfos) + this._populate(); + + this._save(); + + var children = this.children; + var index = this.children.length; + + while (index--) + children[index]._exclude(aCallUID); + + var child = this.childrenByCallUID[aCallUID]; + + if (child) + this._merge(child, true); + }, + + _merge: function(/*ProfileDataGridNode*/ child, /*Boolean*/ shouldAbsorb) + { + this.selfTime -= child.selfTime; + + WebInspector.ProfileDataGridNode.prototype._merge.call(this, child, shouldAbsorb); + }, + + _sharedPopulate: function() + { + var remainingNodeInfos = this._remainingNodeInfos; + var count = remainingNodeInfos.length; + + for (var index = 0; index < count; ++index) { + var nodeInfo = remainingNodeInfos[index]; + var ancestor = nodeInfo.ancestor; + var focusNode = nodeInfo.focusNode; + var child = this.findChild(ancestor); + + // If we already have this child, then merge the data together. + if (child) { + var totalTimeAccountedFor = nodeInfo.totalTimeAccountedFor; + + child.selfTime += focusNode.selfTime; + child.numberOfCalls += focusNode.numberOfCalls; + + if (!totalTimeAccountedFor) + child.totalTime += focusNode.totalTime; + } else { + // If not, add it as a true ancestor. + // In heavy mode, we take our visual identity from ancestor node... + var child = new WebInspector.BottomUpProfileDataGridNode(this.profileView, ancestor, this.tree); + + if (ancestor !== focusNode) { + // but the actual statistics from the "root" node (bottom of the callstack). + child.selfTime = focusNode.selfTime; + child.totalTime = focusNode.totalTime; + child.numberOfCalls = focusNode.numberOfCalls; + } + + this.appendChild(child); + } + + var parent = ancestor.parent; + if (parent && parent.parent) { + nodeInfo.ancestor = parent; + child._remainingNodeInfos.push(nodeInfo); + } + } + + delete this._remainingNodeInfos; + } +} + +WebInspector.BottomUpProfileDataGridNode.prototype.__proto__ = WebInspector.ProfileDataGridNode.prototype; + WebInspector.BottomUpProfileDataGridTree = function(/*ProfileView*/ aProfileView, /*ProfileNode*/ aProfileNode) { WebInspector.ProfileDataGridTree.call(this, aProfileView, aProfileNode); @@ -139,114 +243,10 @@ WebInspector.BottomUpProfileDataGridTree.prototype = { if (this.lastComparator) this.sort(this.lastComparator, true); - } -} - -WebInspector.BottomUpProfileDataGridTree.prototype.__proto__ = WebInspector.ProfileDataGridTree.prototype; - -WebInspector.BottomUpProfileDataGridNode = function(/*ProfileView*/ profileView, /*ProfileNode*/ profileNode, /*BottomUpProfileDataGridTree*/ owningTree) -{ - // In bottom up mode, our parents are our children since we display an inverted tree. - // However, we don't want to show the very top parent since it is redundant. - var hasChildren = !!(profileNode.parent && profileNode.parent.parent); - - WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, hasChildren); - - this._remainingNodeInfos = []; -} - -WebInspector.BottomUpProfileDataGridNode.prototype = { - _takePropertiesFromProfileDataGridNode: function(/*ProfileDataGridNode*/ profileDataGridNode) - { - this._save(); - - this.selfTime = profileDataGridNode.selfTime; - this.totalTime = profileDataGridNode.totalTime; - this.numberOfCalls = profileDataGridNode.numberOfCalls; - }, - - // When focusing, we keep just the members of the callstack. - _keepOnlyChild: function(/*ProfileDataGridNode*/ child) - { - this._save(); - - this.removeChildren(); - this.appendChild(child); - }, - - _exclude: function(aCallUID) - { - if (this._remainingNodeInfos) - this._populate(); - - this._save(); - - var children = this.children; - var index = this.children.length; - - while (index--) - children[index]._exclude(aCallUID); - - var child = this.childrenByCallUID[aCallUID]; - - if (child) - this._merge(child, true); - }, - - _merge: function(/*ProfileDataGridNode*/ child, /*Boolean*/ shouldAbsorb) - { - this.selfTime -= child.selfTime; - - WebInspector.ProfileDataGridNode.prototype._merge.call(this, child, shouldAbsorb); }, - _populate: function(event) - { - var remainingNodeInfos = this._remainingNodeInfos; - var count = remainingNodeInfos.length; - - for (var index = 0; index < count; ++index) { - var nodeInfo = remainingNodeInfos[index]; - var ancestor = nodeInfo.ancestor; - var focusNode = nodeInfo.focusNode; - var child = this.findChild(ancestor); - - // If we already have this child, then merge the data together. - if (child) { - var totalTimeAccountedFor = nodeInfo.totalTimeAccountedFor; - - child.selfTime += focusNode.selfTime; - child.numberOfCalls += focusNode.numberOfCalls; - - if (!totalTimeAccountedFor) - child.totalTime += focusNode.totalTime; - } else { - // If not, add it as a true ancestor. - // In heavy mode, we take our visual identity from ancestor node... - var child = new WebInspector.BottomUpProfileDataGridNode(this.profileView, ancestor, this.tree); - - if (ancestor !== focusNode) { - // but the actual statistics from the "root" node (bottom of the callstack). - child.selfTime = focusNode.selfTime; - child.totalTime = focusNode.totalTime; - child.numberOfCalls = focusNode.numberOfCalls; - } - - this.appendChild(child); - } - - var parent = ancestor.parent; - if (parent && parent.parent) { - nodeInfo.ancestor = parent; - child._remainingNodeInfos.push(nodeInfo); - } - } - - delete this._remainingNodeInfos; - - if (this.removeEventListener) - this.removeEventListener("populate", this._populate, this); - } + _sharedPopulate: WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate } -WebInspector.BottomUpProfileDataGridNode.prototype.__proto__ = WebInspector.ProfileDataGridNode.prototype; +WebInspector.BottomUpProfileDataGridTree.prototype.__proto__ = WebInspector.ProfileDataGridTree.prototype; + diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Color.js b/src/3rdparty/webkit/WebCore/inspector/front-end/Color.js index 9d9cd76..11d6bad 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/Color.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Color.js @@ -437,7 +437,7 @@ WebInspector.Color.HexTable = { "B0C4DE": [[176, 196, 222], [214, 41, 78], "lightSteelBlue"], "B0E0E6": [[176, 224, 230], [187, 52, 80], "powderBlue"], "B22222": [[178, 34, 34], [0, 68, 42], "fireBrick"], - "B8860B": [[184, 134, 11], [43, 89, 38], "darkGoldenRod"], + "B8860B": [[184, 134, 11], [43, 89, 38], "darkGoldenrod"], "BA55D3": [[186, 85, 211], [288, 59, 58], "mediumOrchid"], "BC8F8F": [[188, 143, 143], [0, 25, 65], "rosyBrown"], "BDB76B": [[189, 183, 107], [56, 38, 58], "darkKhaki"], @@ -451,7 +451,7 @@ WebInspector.Color.HexTable = { "D87093": [[219, 112, 147], [340, 60, 65], "paleVioletRed"], "D8BFD8": [[216, 191, 216], [300, 24, 80], "thistle"], "DA70D6": [[218, 112, 214], [302, 59, 65], "orchid"], - "DAA520": [[218, 165, 32], [43, 74, 49], "goldenRod"], + "DAA520": [[218, 165, 32], [43, 74, 49], "goldenrod"], "DC143C": [[237, 164, 61], [35, 83, 58], "crimson"], "DCDCDC": [[220, 220, 220], [0, 0, 86], "gainsboro"], "DDA0DD": [[221, 160, 221], [300, 47, 75], "plum"], @@ -460,7 +460,7 @@ WebInspector.Color.HexTable = { "E6E6FA": [[230, 230, 250], [240, 67, 94], "lavender"], "E9967A": [[233, 150, 122], [15, 72, 70], "darkSalmon"], "EE82EE": [[238, 130, 238], [300, 76, 72], "violet"], - "EEE8AA": [[238, 232, 170], [55, 67, 80], "paleGoldenRod"], + "EEE8AA": [[238, 232, 170], [55, 67, 80], "paleGoldenrod"], "F08080": [[240, 128, 128], [0, 79, 72], "lightCoral"], "F0E68C": [[240, 230, 140], [54, 77, 75], "khaki"], "F0F8FF": [[240, 248, 255], [208, 100, 97], "aliceBlue"], @@ -475,7 +475,7 @@ WebInspector.Color.HexTable = { "FA8072": [[250, 128, 114], [6, 93, 71], "salmon"], "FAEBD7": [[250, 235, 215], [34, 78, 91], "antiqueWhite"], "FAF0E6": [[250, 240, 230], [30, 67, 94], "linen"], - "FAFAD2": [[250, 250, 210], [60, 80, 90], "lightGoldenRodYellow"], + "FAFAD2": [[250, 250, 210], [60, 80, 90], "lightGoldenrodYellow"], "FDF5E6": [[253, 245, 230], [39, 85, 95], "oldLace"], "FF0000": [[255, 0, 0], [0, 100, 50], "red"], "FF00FF": [[255, 0, 255], [300, 100, 50], "magenta"], diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js index aa0e08c..9317824 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js @@ -94,49 +94,76 @@ WebInspector.ConsoleView = function(drawer) this.warningElement = createFilterElement.call(this, "Warnings"); this.logElement = createFilterElement.call(this, "Logs"); - this.filter(this.allElement); + this.filter(this.allElement, false); } WebInspector.ConsoleView.prototype = { _updateFilter: function(e) { - this.filter(e.target); + var isMac = InspectorController.platform().indexOf("mac-") === 0; + var selectMultiple = false; + if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey) + selectMultiple = true; + if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey) + selectMultiple = true; + + this.filter(e.target, selectMultiple); }, - filter: function(target) + filter: function(target, selectMultiple) { + function unselectAll() + { + this.allElement.removeStyleClass("selected"); + this.errorElement.removeStyleClass("selected"); + this.warningElement.removeStyleClass("selected"); + this.logElement.removeStyleClass("selected"); + + this.messagesElement.removeStyleClass("filter-all"); + this.messagesElement.removeStyleClass("filter-errors"); + this.messagesElement.removeStyleClass("filter-warnings"); + this.messagesElement.removeStyleClass("filter-logs"); + } + + var targetFilterClass = "filter-" + target.category.toLowerCase(); + if (target.category == "All") { if (target.hasStyleClass("selected")) { // We can't unselect all, so we break early here return; } - - this.errorElement.removeStyleClass("selected"); - this.warningElement.removeStyleClass("selected"); - this.logElement.removeStyleClass("selected"); - - document.getElementById("console-messages").removeStyleClass("filter-errors"); - document.getElementById("console-messages").removeStyleClass("filter-warnings"); - document.getElementById("console-messages").removeStyleClass("filter-logs"); + + unselectAll.call(this); } else { // Something other than all is being selected, so we want to unselect all if (this.allElement.hasStyleClass("selected")) { this.allElement.removeStyleClass("selected"); - document.getElementById("console-messages").removeStyleClass("filter-all"); + this.messagesElement.removeStyleClass("filter-all"); } } + if (!selectMultiple) { + // If multiple selection is off, we want to unselect everything else + // and just select ourselves. + unselectAll.call(this); + + target.addStyleClass("selected"); + this.messagesElement.addStyleClass(targetFilterClass); + + return; + } + if (target.hasStyleClass("selected")) { + // If selectMultiple is turned on, and we were selected, we just + // want to unselect ourselves. target.removeStyleClass("selected"); - var newClass = "filter-" + target.category.toLowerCase(); - var filterElement = document.getElementById("console-messages"); - filterElement.removeStyleClass(newClass); + this.messagesElement.removeStyleClass(targetFilterClass); } else { + // If selectMultiple is turned on, and we weren't selected, we just + // want to select ourselves. target.addStyleClass("selected"); - var newClass = "filter-" + target.category.toLowerCase(); - var filterElement = document.getElementById("console-messages"); - filterElement.addStyleClass(newClass); + this.messagesElement.addStyleClass(targetFilterClass); } }, @@ -174,40 +201,7 @@ WebInspector.ConsoleView.prototype = { addMessage: function(msg) { if (msg instanceof WebInspector.ConsoleMessage && !(msg instanceof WebInspector.ConsoleCommandResult)) { - msg.totalRepeatCount = msg.repeatCount; - msg.repeatDelta = msg.repeatCount; - - var messageRepeated = false; - - if (msg.isEqual && msg.isEqual(this.previousMessage)) { - // Because sometimes we get a large number of repeated messages and sometimes - // we get them one at a time, we need to know the difference between how many - // repeats we used to have and how many we have now. - msg.repeatDelta -= this.previousMessage.totalRepeatCount; - - if (!isNaN(this.repeatCountBeforeCommand)) - msg.repeatCount -= this.repeatCountBeforeCommand; - - if (!this.commandSincePreviousMessage) { - // Recreate the previous message element to reset the repeat count. - var messagesElement = this.currentGroup.messagesElement; - messagesElement.removeChild(messagesElement.lastChild); - messagesElement.appendChild(msg.toMessageElement()); - - messageRepeated = true; - } - } else - delete this.repeatCountBeforeCommand; - - // Increment the error or warning count - switch (msg.level) { - case WebInspector.ConsoleMessage.MessageLevel.Warning: - WebInspector.warnings += msg.repeatDelta; - break; - case WebInspector.ConsoleMessage.MessageLevel.Error: - WebInspector.errors += msg.repeatDelta; - break; - } + this._incrementErrorWarningCount(msg); // Add message to the resource panel if (msg.url in WebInspector.resourceURLMap) { @@ -218,13 +212,9 @@ WebInspector.ConsoleView.prototype = { this.commandSincePreviousMessage = false; this.previousMessage = msg; - - if (messageRepeated) - return; } else if (msg instanceof WebInspector.ConsoleCommand) { if (this.previousMessage) { this.commandSincePreviousMessage = true; - this.repeatCountBeforeCommand = this.previousMessage.totalRepeatCount; } } @@ -252,6 +242,35 @@ WebInspector.ConsoleView.prototype = { this.promptElement.scrollIntoView(false); }, + updateMessageRepeatCount: function(count) { + var msg = this.previousMessage; + var prevRepeatCount = msg.totalRepeatCount; + + if (!this.commandSincePreviousMessage) { + msg.repeatDelta = count - prevRepeatCount; + msg.repeatCount = msg.repeatCount + msg.repeatDelta; + msg.totalRepeatCount = count; + msg._updateRepeatCount(); + this._incrementErrorWarningCount(msg); + } else { + msgCopy = new WebInspector.ConsoleMessage(msg.source, msg.type, msg.level, msg.line, msg.url, msg.groupLevel, count - prevRepeatCount); + msgCopy.totalRepeatCount = count; + msgCopy.setMessageBody(msg.args); + this.addMessage(msgCopy); + } + }, + + _incrementErrorWarningCount: function(msg) { + switch (msg.level) { + case WebInspector.ConsoleMessage.MessageLevel.Warning: + WebInspector.warnings += msg.repeatDelta; + break; + case WebInspector.ConsoleMessage.MessageLevel.Error: + WebInspector.errors += msg.repeatDelta; + break; + } + }, + clearMessages: function(clearInspectorController) { if (clearInspectorController) @@ -269,7 +288,6 @@ WebInspector.ConsoleView.prototype = { WebInspector.warnings = 0; delete this.commandSincePreviousMessage; - delete this.repeatCountBeforeCommand; delete this.previousMessage; }, @@ -373,10 +391,9 @@ WebInspector.ConsoleView.prototype = { _promptKeyDown: function(event) { - switch (event.keyIdentifier) { - case "Enter": - this._enterKeyPressed(event); - return; + if (isEnterKey(event)) { + this._enterKeyPressed(event); + return; } this.prompt.handleKeyEvent(event); @@ -539,6 +556,7 @@ WebInspector.ConsoleView.prototype = { if (!nodeId) return; var treeOutline = new WebInspector.ElementsTreeOutline(); + treeOutline.showInElementsPanelEnabled = true; treeOutline.rootDOMNode = WebInspector.domAgent.nodeForId(nodeId); treeOutline.element.addStyleClass("outline-disclosure"); if (!treeOutline.children[0].hasChildren) @@ -590,6 +608,8 @@ WebInspector.ConsoleMessage = function(source, type, level, line, url, groupLeve this.url = url; this.groupLevel = groupLevel; this.repeatCount = repeatCount; + this.repeatDelta = repeatCount; + this.totalRepeatCount = repeatCount; if (arguments.length > 7) this.setMessageBody(Array.prototype.slice.call(arguments, 7)); } @@ -597,6 +617,7 @@ WebInspector.ConsoleMessage = function(source, type, level, line, url, groupLeve WebInspector.ConsoleMessage.prototype = { setMessageBody: function(args) { + this.args = args; switch (this.type) { case WebInspector.ConsoleMessage.MessageType.Trace: var span = document.createElement("span"); @@ -692,13 +713,15 @@ WebInspector.ConsoleMessage.prototype = { toMessageElement: function() { - if (this.propertiesSection) - return this.propertiesSection.element; + if (this._element) + return this._element; var element = document.createElement("div"); element.message = this; element.className = "console-message"; + this._element = element; + switch (this.source) { case WebInspector.ConsoleMessage.MessageSource.HTML: element.addStyleClass("console-html-source"); @@ -738,9 +761,8 @@ WebInspector.ConsoleMessage.prototype = { break; } - if (this.type === WebInspector.ConsoleMessage.MessageType.StartGroup) { + if (this.type === WebInspector.ConsoleMessage.MessageType.StartGroup) element.addStyleClass("console-group-title"); - } if (this.elementsTreeOutline) { element.addStyleClass("outline-disclosure"); @@ -748,15 +770,6 @@ WebInspector.ConsoleMessage.prototype = { return element; } - if (this.repeatCount > 1) { - var messageRepeatCountElement = document.createElement("span"); - messageRepeatCountElement.className = "bubble"; - messageRepeatCountElement.textContent = this.repeatCount; - - element.appendChild(messageRepeatCountElement); - element.addStyleClass("repeated-message"); - } - if (this.url && this.url !== "undefined") { var urlElement = document.createElement("a"); urlElement.className = "console-message-url webkit-html-resource-link"; @@ -776,12 +789,28 @@ WebInspector.ConsoleMessage.prototype = { var messageTextElement = document.createElement("span"); messageTextElement.className = "console-message-text"; + if (this.type === WebInspector.ConsoleMessage.MessageType.Assert) + messageTextElement.appendChild(document.createTextNode(WebInspector.UIString("Assertion failed: "))); messageTextElement.appendChild(this.formattedMessage); element.appendChild(messageTextElement); + if (this.repeatCount > 1) + this._updateRepeatCount(); + return element; }, + _updateRepeatCount: function() { + if (!this.repeatCountElement) { + this.repeatCountElement = document.createElement("span"); + this.repeatCountElement.className = "bubble"; + + this._element.insertBefore(this.repeatCountElement, this._element.firstChild); + this._element.addStyleClass("repeated-message"); + } + this.repeatCountElement.textContent = this.repeatCount; + }, + toString: function() { var sourceString; @@ -823,6 +852,9 @@ WebInspector.ConsoleMessage.prototype = { case WebInspector.ConsoleMessage.MessageType.EndGroup: typeString = "End Group"; break; + case WebInspector.ConsoleMessage.MessageType.Assert: + typeString = "Assert"; + break; } var levelString; @@ -878,7 +910,8 @@ WebInspector.ConsoleMessage.MessageType = { Object: 1, Trace: 2, StartGroup: 3, - EndGroup: 4 + EndGroup: 4, + Assert: 5 } WebInspector.ConsoleMessage.MessageLevel = { diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js index 6c5fa02..e85af66 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js @@ -94,10 +94,9 @@ WebInspector.DatabaseQueryView.prototype = { _promptKeyDown: function(event) { - switch (event.keyIdentifier) { - case "Enter": - this._enterKeyPressed(event); - return; + if (isEnterKey(event)) { + this._enterKeyPressed(event); + return; } this.prompt.handleKeyEvent(event); diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsPanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsPanel.js index 5d0e6d7..aa6319c 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsPanel.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsPanel.js @@ -268,7 +268,12 @@ WebInspector.ElementsPanel.prototype = { if (!this._searchResults.length) { this._currentSearchResultIndex = 0; - this.focusedDOMNode = node; + + // Only change the focusedDOMNode if the search was manually performed, because + // the search may have been performed programmatically and we wouldn't want to + // change the current focusedDOMNode. + if (WebInspector.currentFocusElement === document.getElementById("search")) + this.focusedDOMNode = node; } this._searchResults.push(node); diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js index c4bd372..be01647 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -38,6 +38,7 @@ WebInspector.ElementsTreeOutline = function() { this.includeRootDOMNode = true; this.selectEnabled = false; + this.showInElementsPanelEnabled = false; this.rootDOMNode = null; this.focusedDOMNode = null; } @@ -327,6 +328,8 @@ WebInspector.ElementsTreeElement.prototype = { if (this._addAttributeElement && this._addAttributeElement.parentNode) this._addAttributeElement.parentNode.removeChild(this._addAttributeElement); delete this._addAttributeElement; + + this.updateSelection(); } if (!this._addAttributeElement && visible && !this._editing) { @@ -341,7 +344,7 @@ WebInspector.ElementsTreeElement.prototype = { } else if (!visible && this._addAttributeElement) removeAddAttributeSpan.call(this); }, - + updateSelection: function() { var listItemElement = this.listItemElement; @@ -509,6 +512,14 @@ WebInspector.ElementsTreeElement.prototype = { if (this._editing) return; + if (this.isEventWithinDisclosureTriangle(event)) + return; + + if (this.treeOutline.showInElementsPanelEnabled) { + WebInspector.showElementsPanel(); + WebInspector.panels.elements.focusedDOMNode = this.representedObject; + } + // Prevent selecting the nearest word on double click. if (event.detail >= 2) event.preventDefault(); @@ -522,11 +533,6 @@ WebInspector.ElementsTreeElement.prototype = { if (this._startEditingFromEvent(event, treeElement)) return; - if (this.treeOutline.panel) { - this.treeOutline.rootDOMNode = this.representedObject.parentNode; - this.treeOutline.focusedDOMNode = this.representedObject; - } - if (this.hasChildren && !this.expanded) this.expand(); }, @@ -542,6 +548,8 @@ WebInspector.ElementsTreeElement.prototype = { tag.appendChild(node); tag.appendChild(document.createTextNode('>')); } + + this.updateSelection(); }, _startEditingFromEvent: function(event, treeElement) @@ -578,7 +586,7 @@ WebInspector.ElementsTreeElement.prototype = { this.toggleNewAttributeButton(false); var attribute = listItem.getElementsByClassName("webkit-html-attribute")[0]; if (attribute) - return this._startEditingAttribute(attribute, attribute.getElementsByClassName("webkit-html-attribute-name")[0]); + return this._startEditingAttribute(attribute, attribute.getElementsByClassName("webkit-html-attribute-value")[0]); return this._addNewAttribute(listItem); } @@ -830,9 +838,9 @@ WebInspector.ElementsTreeElement.prototype = { if (node.parentNode && node.parentNode.nodeName.toLowerCase() == "script") { var newNode = document.createElement("span"); newNode.textContent = node.textContent; - + var javascriptSyntaxHighlighter = new WebInspector.JavaScriptSourceSyntaxHighlighter(null, null); - javascriptSyntaxHighlighter.syntaxHighlightLine(newNode, null); + javascriptSyntaxHighlighter.syntaxHighlightNode(newNode); info.title = "<span class=\"webkit-html-text-node webkit-html-js-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>"; } else if (node.parentNode && node.parentNode.nodeName.toLowerCase() == "style") { diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/EventListenersSidebarPane.js b/src/3rdparty/webkit/WebCore/inspector/front-end/EventListenersSidebarPane.js index 55b8e55..2938196 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/EventListenersSidebarPane.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/EventListenersSidebarPane.js @@ -71,6 +71,8 @@ WebInspector.EventListenersSidebarPane.prototype = { var eventListener = eventListeners[i]; eventListener.node = WebInspector.domAgent.nodeForId(eventListener.nodeId); delete eventListener.nodeId; // no longer needed + if (/^function _inspectorCommandLineAPI_logEvent\(/.test(eventListener.listener.toString())) + continue; // ignore event listeners generated by monitorEvent var type = eventListener.type; var section = sectionMap[type]; if (!section) { @@ -201,18 +203,13 @@ WebInspector.EventListenerBar.prototype = { if (node.nodeType === Node.DOCUMENT_NODE) return "document"; - + return appropriateSelectorForNode(node); }, _getFunctionDisplayName: function() { - // TODO: v8 does not yet provide the raw function, this handles such a case with a placeholder - // I didn't make this a UIString because it should be implemented eventually. - if (!this.eventListener.listener) - return "(listener)"; - - // Requires that Function.toString() return at least the function's signature + // Requires that Function.toString() return at least the function's signature. var match = this.eventListener.listener.toString().match(/function ([^\(]+?)\(/); return (match ? match[1] : WebInspector.UIString("(anonymous function)")); } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarBlue.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarBlue.png Binary files differnew file mode 100644 index 0000000..22641b5 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarBlue.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarGray.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarGray.png Binary files differnew file mode 100644 index 0000000..f66cf43 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarGray.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarGreen.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarGreen.png Binary files differnew file mode 100644 index 0000000..cc59082 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarGreen.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarOrange.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarOrange.png Binary files differnew file mode 100644 index 0000000..e5ae6f5 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarOrange.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarPurple.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarPurple.png Binary files differnew file mode 100644 index 0000000..f891252 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarPurple.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarRed.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarRed.png Binary files differnew file mode 100644 index 0000000..b850037 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarRed.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarYellow.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarYellow.png Binary files differnew file mode 100644 index 0000000..2b3e9a7 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineBarYellow.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineCheckmarks.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineCheckmarks.png Binary files differnew file mode 100644 index 0000000..9afa9bb --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineCheckmarks.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineDots.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineDots.png Binary files differnew file mode 100644 index 0000000..e9ba4d3 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineDots.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineIcon.png b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineIcon.png Binary files differnew file mode 100644 index 0000000..09bcf30 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Images/timelineIcon.png diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScript.js b/src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScript.js index 3ce96d0..3bed8da 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScript.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/InjectedScript.js @@ -540,7 +540,7 @@ InjectedScript.getCompletions = function(expression, includeInspectorCommandLine for (var prop in expressionResult) props[prop] = true; if (includeInspectorCommandLineAPI) - for (var prop in InjectedScript._window()._inspectorCommandLineAPI) + for (var prop in InjectedScript._window().console._inspectorCommandLineAPI) if (prop.charAt(0) !== '_') props[prop] = true; } catch(e) { @@ -575,7 +575,7 @@ InjectedScript._evaluateOn = function(evalFunction, object, expression) InjectedScript._ensureCommandLineAPIInstalled(evalFunction, object); // Surround the expression in with statements to inject our command line API so that // the window object properties still take more precedent than our API functions. - expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }"; + expression = "with (window.console._inspectorCommandLineAPI) { with (window) { " + expression + " } }"; var value = evalFunction.call(object, expression); // When evaluating on call frame error is not thrown, but returned as a value. @@ -592,7 +592,7 @@ InjectedScript.addInspectedNode = function(nodeId) return false; InjectedScript._ensureCommandLineAPIInstalled(InjectedScript._window().eval, InjectedScript._window()); - var inspectedNodes = InjectedScript._window()._inspectorCommandLineAPI._inspectedNodes; + var inspectedNodes = InjectedScript._window().console._inspectorCommandLineAPI._inspectedNodes; inspectedNodes.unshift(node); if (inspectedNodes.length >= 5) inspectedNodes.pop(); @@ -901,9 +901,9 @@ InjectedScript._inspectObject = function(o) InjectedScript._ensureCommandLineAPIInstalled = function(evalFunction, evalObject) { - if (evalFunction.call(evalObject, "window._inspectorCommandLineAPI")) + if (evalFunction.call(evalObject, "window.console._inspectorCommandLineAPI")) return; - var inspectorCommandLineAPI = evalFunction.call(evalObject, "window._inspectorCommandLineAPI = { \ + var inspectorCommandLineAPI = evalFunction.call(evalObject, "window.console._inspectorCommandLineAPI = { \ $: function() { return document.getElementById.apply(document, arguments) }, \ $$: function() { return document.querySelectorAll.apply(document, arguments) }, \ $x: function(xpath, context) { \ @@ -922,12 +922,50 @@ InjectedScript._ensureCommandLineAPIInstalled = function(evalFunction, evalObjec values: function(o) { var a = []; for (var k in o) a.push(o[k]); return a; }, \ profile: function() { return console.profile.apply(console, arguments) }, \ profileEnd: function() { return console.profileEnd.apply(console, arguments) }, \ + _logEvent: function _inspectorCommandLineAPI_logEvent(e) { console.log(e.type, e); }, \ + _allEventTypes: [\"mouse\", \"key\", \"load\", \"unload\", \"abort\", \"error\", \ + \"select\", \"change\", \"submit\", \"reset\", \"focus\", \"blur\", \ + \"resize\", \"scroll\"], \ + _normalizeEventTypes: function(t) { \ + if (typeof t === \"undefined\") \ + t = _inspectorCommandLineAPI._allEventTypes; \ + else if (typeof t === \"string\") \ + t = [t]; \ + var i, te = []; \ + for (i = 0; i < t.length; i++) { \ + if (t[i] === \"mouse\") \ + te.splice(0, 0, \"mousedown\", \"mouseup\", \"click\", \"dblclick\", \ + \"mousemove\", \"mouseover\", \"mouseout\"); \ + else if (t[i] === \"key\") \ + te.splice(0, 0, \"keydown\", \"keyup\", \"keypress\"); \ + else \ + te.push(t[i]); \ + } \ + return te; \ + }, \ + monitorEvent: function(o, t) { \ + if (!o || !o.addEventListener || !o.removeEventListener) \ + return; \ + t = _inspectorCommandLineAPI._normalizeEventTypes(t); \ + for (i = 0; i < t.length; i++) { \ + o.removeEventListener(t[i], _inspectorCommandLineAPI._logEvent, false); \ + o.addEventListener(t[i], _inspectorCommandLineAPI._logEvent, false); \ + } \ + }, \ + unmonitorEvent: function(o, t) { \ + if (!o || !o.removeEventListener) \ + return; \ + t = _inspectorCommandLineAPI._normalizeEventTypes(t); \ + for (i = 0; i < t.length; i++) { \ + o.removeEventListener(t[i], _inspectorCommandLineAPI._logEvent, false); \ + } \ + }, \ _inspectedNodes: [], \ - get $0() { return _inspectorCommandLineAPI._inspectedNodes[0] }, \ - get $1() { return _inspectorCommandLineAPI._inspectedNodes[1] }, \ - get $2() { return _inspectorCommandLineAPI._inspectedNodes[2] }, \ - get $3() { return _inspectorCommandLineAPI._inspectedNodes[3] }, \ - get $4() { return _inspectorCommandLineAPI._inspectedNodes[4] } \ + get $0() { return console._inspectorCommandLineAPI._inspectedNodes[0] }, \ + get $1() { return console._inspectorCommandLineAPI._inspectedNodes[1] }, \ + get $2() { return console._inspectorCommandLineAPI._inspectedNodes[2] }, \ + get $3() { return console._inspectorCommandLineAPI._inspectedNodes[3] }, \ + get $4() { return console._inspectorCommandLineAPI._inspectedNodes[4] } \ };"); inspectorCommandLineAPI.clear = InspectorController.wrapCallback(InjectedScript._clearConsoleMessages); @@ -1120,6 +1158,8 @@ Object.type = function(obj) return "regexp"; if (obj instanceof win.NodeList) return "array"; + if (obj instanceof win.HTMLCollection || obj instanceof win.HTMLAllCollection) + return "array"; if (obj instanceof win.Error) return "error"; return type; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/InspectorControllerStub.js b/src/3rdparty/webkit/WebCore/inspector/front-end/InspectorControllerStub.js new file mode 100644 index 0000000..6fb5a1b --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/InspectorControllerStub.js @@ -0,0 +1,291 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +if (!window.InspectorController) { + +WebInspector.InspectorControllerStub = function() +{ + this._searchingForNode = false; + this._windowVisible = true; + this._attachedWindowHeight = 0; + this._debuggerEnabled = true; + this._profilerEnabled = true; + this._resourceTrackingEnabled = false; + this._timelineEnabled = false; + this._settings = {}; +} + +WebInspector.InspectorControllerStub.prototype = { + wrapCallback: function(func) + { + return func; + }, + + isWindowVisible: function() + { + return this._windowVisible; + }, + + platform: function() + { + return "mac-leopard"; + }, + + + closeWindow: function() + { + this._windowVisible = false; + }, + + attach: function() + { + }, + + detach: function() + { + }, + + storeLastActivePanel: function(panel) + { + }, + + clearMessages: function() + { + }, + + searchingForNode: function() + { + return this._searchingForNode; + }, + + search: function(sourceRow, query) + { + }, + + toggleNodeSearch: function() + { + this._searchingForNode = !this._searchingForNode; + }, + + setAttachedWindowHeight: function(height) + { + }, + + moveByUnrestricted: function(x, y) + { + }, + + + addResourceSourceToFrame: function(identifier, element) + { + }, + + addSourceToFrame: function(mimeType, source, element) + { + return false; + }, + + getResourceDocumentNode: function(identifier) + { + return undefined; + }, + + highlightDOMNode: function(node) + { + }, + + hideDOMNodeHighlight: function() + { + }, + + inspectedWindow: function() + { + return window; + }, + + loaded: function() + { + }, + + localizedStringsURL: function() + { + return undefined; + }, + + windowUnloading: function() + { + return false; + }, + + hiddenPanels: function() + { + return ""; + }, + + debuggerEnabled: function() + { + return this._debuggerEnabled; + }, + + enableResourceTracking: function() + { + this._resourceTrackingEnabled = true; + WebInspector.resourceTrackingWasEnabled(); + }, + + disableResourceTracking: function() + { + this._resourceTrackingEnabled = false; + WebInspector.resourceTrackingWasDisabled(); + }, + + resourceTrackingEnabled: function() + { + return this._resourceTrackingEnabled; + }, + + enableDebugger: function() + { + this._debuggerEnabled = true; + }, + + disableDebugger: function() + { + this._debuggerEnabled = false; + }, + + addBreakpoint: function(sourceID, line, condition) + { + }, + + removeBreakpoint: function(sourceID, line) + { + }, + + updateBreakpoint: function(sourceID, line, condition) + { + }, + + pauseInDebugger: function() + { + }, + + pauseOnExceptions: function() + { + return false; + }, + + setPauseOnExceptions: function(value) + { + }, + + resumeDebugger: function() + { + }, + + profilerEnabled: function() + { + return true; + }, + + enableProfiler: function() + { + this._profilerEnabled = true; + }, + + disableProfiler: function() + { + this._profilerEnabled = false; + }, + + startProfiling: function() + { + }, + + stopProfiling: function() + { + }, + + getProfileHeaders: function(callId) + { + WebInspector.didGetProfileHeaders(callId, []); + }, + + getProfile: function(callId, uid) + { + if (WebInspector.__fullProfiles && (uid in WebInspector.__fullProfiles)) + { + WebInspector.didGetProfile(callId, WebInspector.__fullProfiles[uid]); + } + }, + + takeHeapSnapshot: function() + { + }, + + databaseTableNames: function(database) + { + return []; + }, + + stepIntoStatementInDebugger: function() + { + }, + + stepOutOfFunctionInDebugger: function() + { + }, + + stepOverStatementInDebugger: function() + { + }, + + setSetting: function(setting, value) + { + this._settings[setting] = value; + }, + + dispatchOnInjectedScript: function() + { + }, + + releaseWrapperObjectGroup: function() + { + }, + + setting: function(setting) + { + return this._settings[setting]; + } +} + +window.InspectorController = new WebInspector.InspectorControllerStub(); + +} diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Panel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/Panel.js index 5046f6b..6cd200b 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/Panel.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Panel.js @@ -82,6 +82,8 @@ WebInspector.Panel.prototype = { this._toolbarItem.addStyleClass("toggled-on"); WebInspector.currentFocusElement = document.getElementById("main-panels"); + + this.updateSidebarWidth(); }, hide: function() @@ -267,6 +269,103 @@ WebInspector.Panel.prototype = { currentView.jumpToLastSearchResult(); else currentView.jumpToPreviousSearchResult(); + }, + + handleKeyEvent: function(event) + { + this.handleSidebarKeyEvent(event); + }, + + handleSidebarKeyEvent: function(event) + { + if (this.hasSidebar && this.sidebarTree) + this.sidebarTree.handleKeyEvent(event); + }, + + createSidebar: function(parentElement, resizerParentElement) + { + if (this.hasSidebar) + return; + + if (!parentElement) + parentElement = this.element; + + if (!resizerParentElement) + resizerParentElement = parentElement; + + this.hasSidebar = true; + + this.sidebarElement = document.createElement("div"); + this.sidebarElement.className = "sidebar"; + parentElement.appendChild(this.sidebarElement); + + this.sidebarResizeElement = document.createElement("div"); + this.sidebarResizeElement.className = "sidebar-resizer-vertical"; + this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false); + resizerParentElement.appendChild(this.sidebarResizeElement); + + this.sidebarTreeElement = document.createElement("ol"); + this.sidebarTreeElement.className = "sidebar-tree"; + this.sidebarElement.appendChild(this.sidebarTreeElement); + + this.sidebarTree = new TreeOutline(this.sidebarTreeElement); + }, + + _startSidebarDragging: function(event) + { + WebInspector.elementDragStart(this.sidebarResizeElement, this._sidebarDragging.bind(this), this._endSidebarDragging.bind(this), event, "col-resize"); + }, + + _sidebarDragging: function(event) + { + this.updateSidebarWidth(event.pageX); + + event.preventDefault(); + }, + + _endSidebarDragging: function(event) + { + WebInspector.elementDragEnd(event); + }, + + updateSidebarWidth: function(width) + { + if (!this.hasSidebar) + return; + + if (this.sidebarElement.offsetWidth <= 0) { + // The stylesheet hasn't loaded yet or the window is closed, + // so we can't calculate what is need. Return early. + return; + } + + if (!("_currentSidebarWidth" in this)) + this._currentSidebarWidth = this.sidebarElement.offsetWidth; + + if (typeof width === "undefined") + width = this._currentSidebarWidth; + + width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2); + + this._currentSidebarWidth = width; + this.setSidebarWidth(width); + + this.updateMainViewWidth(width); + + var visibleView = this.visibleView; + if (visibleView && "resize" in visibleView) + visibleView.resize(); + }, + + setSidebarWidth: function(width) + { + this.sidebarElement.style.width = width + "px"; + this.sidebarResizeElement.style.left = (width - 3) + "px"; + }, + + updateMainViewWidth: function(width) + { + // Should be implemented by ancestors. } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ProfileDataGridTree.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ProfileDataGridTree.js index 3fb0e00..9a7c741 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ProfileDataGridTree.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ProfileDataGridTree.js @@ -126,20 +126,6 @@ WebInspector.ProfileDataGridNode.prototype = { this.profileView._dataGridNodeDeselected(this); }, - expand: function() - { - if (!this.parent) { - var currentComparator = this.parent.lastComparator; - - if (!currentComparator || (currentComparator === this.lastComparator)) - return; - - this.sort(currentComparator); - } - - WebInspector.DataGridNode.prototype.expand.call(this); - }, - sort: function(/*Function*/ comparator, /*Boolean*/ force) { var gridNodeGroups = [[this]]; @@ -153,7 +139,7 @@ WebInspector.ProfileDataGridNode.prototype = { // If the grid node is collapsed, then don't sort children (save operation for later). // If the grid node has the same sorting as previously, then there is no point in sorting it again. - if (!force && !gridNode.expanded || gridNode.lastComparator === comparator) { + if (!force && (!gridNode.expanded || gridNode.lastComparator === comparator)) { if (gridNode.children.length) gridNode.shouldRefreshChildren = true; continue; @@ -224,6 +210,26 @@ WebInspector.ProfileDataGridNode.prototype = { return this.totalTime / this.tree.totalTime * 100.0; }, + get _parent() + { + return this.parent !== this.dataGrid ? this.parent : this.tree; + }, + + _populate: function(event) + { + this._sharedPopulate(); + + if (this._parent) { + var currentComparator = this._parent.lastComparator; + + if (currentComparator) + this.sort(currentComparator, true); + } + + if (this.removeEventListener) + this.removeEventListener("populate", this._populate, this); + }, + // When focusing and collapsing we modify lots of nodes in the tree. // This allows us to restore them all to their original state when we revert. _save: function() diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ProfileView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ProfileView.js index ee96345..afced41 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ProfileView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ProfileView.js @@ -602,6 +602,16 @@ WebInspector.CPUProfileType.prototype = { setRecordingProfile: function(isProfiling) { this._recording = isProfiling; + }, + + createSidebarTreeElementForProfile: function(profile) + { + return new WebInspector.ProfileSidebarTreeElement(profile); + }, + + createView: function(profile) + { + return new WebInspector.CPUProfileView(profile); } } @@ -627,18 +637,5 @@ WebInspector.CPUProfile.prototype = { get head() { return this.representedObject.head; - }, - - createView: function() - { - return new WebInspector.CPUProfileView(this); - }, - - // FIXME: Extract this into a superclass so that createView can be simply overridden by subclasses. - viewForProfile: function() - { - if (!this._profileView) - this._profileView = this.createView(); - return this._profileView; } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ProfilesPanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ProfilesPanel.js index 55e286e..74c2bb6 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ProfilesPanel.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ProfilesPanel.js @@ -61,6 +61,25 @@ WebInspector.ProfileType.prototype = { buttonClicked: function() { + }, + + viewForProfile: function(profile) + { + if (!profile._profileView) + profile._profileView = this.createView(profile); + return profile._profileView; + }, + + // Must be implemented by subclasses. + createView: function(profile) + { + throw new Error("Needs implemented."); + }, + + // Must be implemented by subclasses. + createSidebarTreeElementForProfile: function(profile) + { + throw new Error("Needs implemented."); } } @@ -68,6 +87,8 @@ WebInspector.ProfilesPanel = function() { WebInspector.Panel.call(this); + this.createSidebar(); + this.element.addStyleClass("profiles"); this._profileTypesByIdMap = {}; this._profileTypeButtonsByIdMap = {}; @@ -80,21 +101,6 @@ WebInspector.ProfilesPanel = function() this.element.appendChild(this.panelEnablerView.element); - this.sidebarElement = document.createElement("div"); - this.sidebarElement.id = "profiles-sidebar"; - this.sidebarElement.className = "sidebar"; - this.element.appendChild(this.sidebarElement); - - this.sidebarResizeElement = document.createElement("div"); - this.sidebarResizeElement.className = "sidebar-resizer-vertical"; - this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false); - this.element.appendChild(this.sidebarResizeElement); - - this.sidebarTreeElement = document.createElement("ol"); - this.sidebarTreeElement.className = "sidebar-tree"; - this.sidebarElement.appendChild(this.sidebarTreeElement); - this.sidebarTree = new TreeOutline(this.sidebarTreeElement); - this.profileViews = document.createElement("div"); this.profileViews.id = "profile-views"; this.element.appendChild(this.profileViews); @@ -143,7 +149,6 @@ WebInspector.ProfilesPanel.prototype = { show: function() { WebInspector.Panel.prototype.show.call(this); - this._updateSidebarWidth(); if (this._shouldPopulateProfiles) this._populateProfiles(); }, @@ -192,11 +197,6 @@ WebInspector.ProfilesPanel.prototype = { this._updateInterface(); }, - handleKeyEvent: function(event) - { - this.sidebarTree.handleKeyEvent(event); - }, - registerProfileType: function(profileType) { this._profileTypesByIdMap[profileType.id] = profileType; @@ -212,10 +212,12 @@ WebInspector.ProfilesPanel.prototype = { addProfileHeader: function(typeId, profile) { - var sidebarParent = this.getProfileType(typeId).treeElement; + var profileType = this.getProfileType(typeId); + var sidebarParent = profileType.treeElement; var small = false; var alternateTitle; + profile.__profilesPanelProfileType = profileType; this._profiles.push(profile); this._profilesIdMap[this._makeKey(profile.uid, typeId)] = profile; @@ -257,7 +259,7 @@ WebInspector.ProfilesPanel.prototype = { } } - var profileTreeElement = new WebInspector.ProfileSidebarTreeElement(profile); + var profileTreeElement = profileType.createSidebarTreeElementForProfile(profile); profileTreeElement.small = small; if (alternateTitle) profileTreeElement.mainTitle = alternateTitle; @@ -276,7 +278,7 @@ WebInspector.ProfilesPanel.prototype = { if (this.visibleView) this.visibleView.hide(); - var view = profile.viewForProfile(); + var view = profile.__profilesPanelProfileType.viewForProfile(profile); view.show(this.profileViews); @@ -449,49 +451,10 @@ WebInspector.ProfilesPanel.prototype = { delete this._shouldPopulateProfiles; }, - _startSidebarDragging: function(event) - { - WebInspector.elementDragStart(this.sidebarResizeElement, this._sidebarDragging.bind(this), this._endSidebarDragging.bind(this), event, "col-resize"); - }, - - _sidebarDragging: function(event) + updateMainViewWidth: function(width) { - this._updateSidebarWidth(event.pageX); - - event.preventDefault(); - }, - - _endSidebarDragging: function(event) - { - WebInspector.elementDragEnd(event); - }, - - _updateSidebarWidth: function(width) - { - if (this.sidebarElement.offsetWidth <= 0) { - // The stylesheet hasn't loaded yet or the window is closed, - // so we can't calculate what is need. Return early. - return; - } - - if (!("_currentSidebarWidth" in this)) - this._currentSidebarWidth = this.sidebarElement.offsetWidth; - - if (typeof width === "undefined") - width = this._currentSidebarWidth; - - width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2); - - this._currentSidebarWidth = width; - - this.sidebarElement.style.width = width + "px"; this.profileViews.style.left = width + "px"; this.profileViewStatusBarItemsContainer.style.left = width + "px"; - this.sidebarResizeElement.style.left = (width - 3) + "px"; - - var visibleView = this.visibleView; - if (visibleView && "resize" in visibleView) - visibleView.resize(); } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ResourceCategory.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ResourceCategory.js index fc508d0..6e94265 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ResourceCategory.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ResourceCategory.js @@ -26,18 +26,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.ResourceCategory = function(title, name) +WebInspector.ResourceCategory = function(name, title, color) { - this.name = name; - this.title = title; + WebInspector.AbstractTimelineCategory.call(this, name, title, color); this.resources = []; } WebInspector.ResourceCategory.prototype = { - toString: function() - { - return this.title; - }, addResource: function(resource) { @@ -66,3 +61,5 @@ WebInspector.ResourceCategory.prototype = { this.resources = []; } } + +WebInspector.ResourceCategory.prototype.__proto__ = WebInspector.AbstractTimelineCategory.prototype; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ResourceView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ResourceView.js index 28586f6..2ea7fdb 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ResourceView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ResourceView.js @@ -178,7 +178,7 @@ WebInspector.ResourceView.prototype = { var isFormEncoded = false; var requestContentType = this._getHeaderValue(this.resource.requestHeaders, "Content-Type"); - if (requestContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i)) + if (requestContentType && requestContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i)) isFormEncoded = true; if (isFormEncoded) { diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ResourcesPanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ResourcesPanel.js index 0f873e7..940570f 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ResourcesPanel.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ResourcesPanel.js @@ -29,190 +29,129 @@ WebInspector.ResourcesPanel = function() { - WebInspector.Panel.call(this); + WebInspector.AbstractTimelinePanel.call(this); this.element.addStyleClass("resources"); - this.filterBarElement = document.createElement("div"); - this.filterBarElement.id = "resources-filter"; - this.element.appendChild(this.filterBarElement); + this._createPanelEnabler(); this.viewsContainerElement = document.createElement("div"); this.viewsContainerElement.id = "resource-views"; this.element.appendChild(this.viewsContainerElement); - this.containerElement = document.createElement("div"); - this.containerElement.id = "resources-container"; - this.containerElement.addEventListener("scroll", this._updateDividersLabelBarPosition.bind(this), false); - this.element.appendChild(this.containerElement); + this.createInterface(); - this.sidebarElement = document.createElement("div"); - this.sidebarElement.id = "resources-sidebar"; - this.sidebarElement.className = "sidebar"; - this.containerElement.appendChild(this.sidebarElement); + this._createStatusbarButtons(); - this.sidebarResizeElement = document.createElement("div"); - this.sidebarResizeElement.className = "sidebar-resizer-vertical"; - this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false); - this.element.appendChild(this.sidebarResizeElement); - - this.containerContentElement = document.createElement("div"); - this.containerContentElement.id = "resources-container-content"; - this.containerElement.appendChild(this.containerContentElement); - - this.summaryBar = new WebInspector.SummaryBar(this.categories); - this.summaryBar.element.id = "resources-summary"; - this.containerContentElement.appendChild(this.summaryBar.element); - - this.resourcesGraphsElement = document.createElement("div"); - this.resourcesGraphsElement.id = "resources-graphs"; - this.containerContentElement.appendChild(this.resourcesGraphsElement); - - this.dividersElement = document.createElement("div"); - this.dividersElement.id = "resources-dividers"; - this.containerContentElement.appendChild(this.dividersElement); - - this.eventDividersElement = document.createElement("div"); - this.eventDividersElement.id = "resources-event-dividers"; - this.containerContentElement.appendChild(this.eventDividersElement); - - this.dividersLabelBarElement = document.createElement("div"); - this.dividersLabelBarElement.id = "resources-dividers-label-bar"; - this.containerContentElement.appendChild(this.dividersLabelBarElement); + this.reset(); + this.filter(this.filterAllElement, false); + this.graphsTreeElement.children[0].select(); +} - this.sidebarTreeElement = document.createElement("ol"); - this.sidebarTreeElement.className = "sidebar-tree"; - this.sidebarElement.appendChild(this.sidebarTreeElement); +WebInspector.ResourcesPanel.prototype = { + toolbarItemClass: "resources", - this.sidebarTree = new TreeOutline(this.sidebarTreeElement); + get toolbarItemLabel() + { + return WebInspector.UIString("Resources"); + }, - var timeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time")); - timeGraphItem.onselect = this._graphSelected.bind(this); + get statusBarItems() + { + return [this.enableToggleButton.element, this.largerResourcesButton.element, this.sortingSelectElement]; + }, - var transferTimeCalculator = new WebInspector.ResourceTransferTimeCalculator(); - var transferDurationCalculator = new WebInspector.ResourceTransferDurationCalculator(); + get categories() + { + return WebInspector.resourceCategories; + }, - timeGraphItem.sortingOptions = [ - { name: WebInspector.UIString("Sort by Start Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingStartTime, calculator: transferTimeCalculator }, - { name: WebInspector.UIString("Sort by Response Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingResponseReceivedTime, calculator: transferTimeCalculator }, - { name: WebInspector.UIString("Sort by End Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingEndTime, calculator: transferTimeCalculator }, - { name: WebInspector.UIString("Sort by Duration"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingDuration, calculator: transferDurationCalculator }, - { name: WebInspector.UIString("Sort by Latency"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingLatency, calculator: transferDurationCalculator }, - ]; + createItemTreeElement: function(item) + { + return new WebInspector.ResourceSidebarTreeElement(item); + }, - timeGraphItem.selectedSortingOptionIndex = 1; + createItemGraph: function(item) + { + return new WebInspector.ResourceGraph(item); + }, - var sizeGraphItem = new WebInspector.SidebarTreeElement("resources-size-graph-sidebar-item", WebInspector.UIString("Size")); - sizeGraphItem.onselect = this._graphSelected.bind(this); + isCategoryVisible: function(categoryName) + { + return (this.itemsGraphsElement.hasStyleClass("filter-all") || this.itemsGraphsElement.hasStyleClass("filter-" + categoryName.toLowerCase())); + }, - var transferSizeCalculator = new WebInspector.ResourceTransferSizeCalculator(); - sizeGraphItem.sortingOptions = [ - { name: WebInspector.UIString("Sort by Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingSize, calculator: transferSizeCalculator }, - ]; + populateSidebar: function() + { + var timeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time")); + timeGraphItem.onselect = this._graphSelected.bind(this); - sizeGraphItem.selectedSortingOptionIndex = 0; + var transferTimeCalculator = new WebInspector.ResourceTransferTimeCalculator(); + var transferDurationCalculator = new WebInspector.ResourceTransferDurationCalculator(); - this.graphsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("GRAPHS"), {}, true); - this.sidebarTree.appendChild(this.graphsTreeElement); + timeGraphItem.sortingOptions = [ + { name: WebInspector.UIString("Sort by Start Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingStartTime, calculator: transferTimeCalculator }, + { name: WebInspector.UIString("Sort by Response Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingResponseReceivedTime, calculator: transferTimeCalculator }, + { name: WebInspector.UIString("Sort by End Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingEndTime, calculator: transferTimeCalculator }, + { name: WebInspector.UIString("Sort by Duration"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingDuration, calculator: transferDurationCalculator }, + { name: WebInspector.UIString("Sort by Latency"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingLatency, calculator: transferDurationCalculator }, + ]; - this.graphsTreeElement.appendChild(timeGraphItem); - this.graphsTreeElement.appendChild(sizeGraphItem); - this.graphsTreeElement.expand(); + timeGraphItem.selectedSortingOptionIndex = 1; - this.resourcesTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RESOURCES"), {}, true); - this.sidebarTree.appendChild(this.resourcesTreeElement); + var sizeGraphItem = new WebInspector.SidebarTreeElement("resources-size-graph-sidebar-item", WebInspector.UIString("Size")); + sizeGraphItem.onselect = this._graphSelected.bind(this); - this.resourcesTreeElement.expand(); + var transferSizeCalculator = new WebInspector.ResourceTransferSizeCalculator(); + sizeGraphItem.sortingOptions = [ + { name: WebInspector.UIString("Sort by Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingSize, calculator: transferSizeCalculator }, + ]; - var panelEnablerHeading = WebInspector.UIString("You need to enable resource tracking to use this panel."); - var panelEnablerDisclaimer = WebInspector.UIString("Enabling resource tracking will reload the page and make page loading slower."); - var panelEnablerButton = WebInspector.UIString("Enable resource tracking"); + sizeGraphItem.selectedSortingOptionIndex = 0; - this.panelEnablerView = new WebInspector.PanelEnablerView("resources", panelEnablerHeading, panelEnablerDisclaimer, panelEnablerButton); - this.panelEnablerView.addEventListener("enable clicked", this._enableResourceTracking, this); + this.graphsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("GRAPHS"), {}, true); + this.sidebarTree.appendChild(this.graphsTreeElement); - this.element.appendChild(this.panelEnablerView.element); + this.graphsTreeElement.appendChild(timeGraphItem); + this.graphsTreeElement.appendChild(sizeGraphItem); + this.graphsTreeElement.expand(); - this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item"); - this.enableToggleButton.addEventListener("click", this._toggleResourceTracking.bind(this), false); + this.itemsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RESOURCES"), {}, true); + this.sidebarTree.appendChild(this.itemsTreeElement); - this.largerResourcesButton = new WebInspector.StatusBarButton(WebInspector.UIString("Use small resource rows."), "resources-larger-resources-status-bar-item"); - this.largerResourcesButton.toggled = Preferences.resourcesLargeRows; - this.largerResourcesButton.addEventListener("click", this._toggleLargerResources.bind(this), false); - if (!Preferences.resourcesLargeRows) { - Preferences.resourcesLargeRows = !Preferences.resourcesLargeRows; - this._toggleLargerResources(); // this will toggle the preference back to the original - } - - this.sortingSelectElement = document.createElement("select"); - this.sortingSelectElement.className = "status-bar-item"; - this.sortingSelectElement.addEventListener("change", this._changeSortingFunction.bind(this), false); - - var createFilterElement = function (category) { - var categoryElement = document.createElement("li"); - categoryElement.category = category; - categoryElement.addStyleClass(category); - var label = WebInspector.UIString("All"); - if (WebInspector.resourceCategories[category]) - label = WebInspector.resourceCategories[category].title; - categoryElement.appendChild(document.createTextNode(label)); - categoryElement.addEventListener("click", this._updateFilter.bind(this), false); - this.filterBarElement.appendChild(categoryElement); - return categoryElement; - }; - - var allElement = createFilterElement.call(this, "all"); - this.filter(allElement.category); - for (var category in this.categories) - createFilterElement.call(this, category); + this.itemsTreeElement.expand(); + }, - this.reset(); + _createPanelEnabler: function() + { + var panelEnablerHeading = WebInspector.UIString("You need to enable resource tracking to use this panel."); + var panelEnablerDisclaimer = WebInspector.UIString("Enabling resource tracking will reload the page and make page loading slower."); + var panelEnablerButton = WebInspector.UIString("Enable resource tracking"); - timeGraphItem.select(); -} + this.panelEnablerView = new WebInspector.PanelEnablerView("resources", panelEnablerHeading, panelEnablerDisclaimer, panelEnablerButton); + this.panelEnablerView.addEventListener("enable clicked", this._enableResourceTracking, this); -WebInspector.ResourcesPanel.prototype = { - toolbarItemClass: "resources", + this.element.appendChild(this.panelEnablerView.element); - get categories() - { - if (!this._categories) { - this._categories = {documents: {color: {r: 47, g: 102, b: 236}}, stylesheets: {color: {r: 157, g: 231, b: 119}}, images: {color: {r: 164, g: 60, b: 255}}, scripts: {color: {r: 255, g: 121, b: 0}}, xhr: {color: {r: 231, g: 231, b: 10}}, fonts: {color: {r: 255, g: 82, b: 62}}, other: {color: {r: 186, g: 186, b: 186}}}; - for (var category in this._categories) { - this._categories[category].title = WebInspector.resourceCategories[category].title; - } - } - return this._categories; + this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item"); + this.enableToggleButton.addEventListener("click", this._toggleResourceTracking.bind(this), false); }, - filter: function (category) { - if (this._filterCategory && this._filterCategory === category) - return; - - if (this._filterCategory) { - var filterElement = this.filterBarElement.getElementsByClassName(this._filterCategory)[0]; - filterElement.removeStyleClass("selected"); - var oldClass = "filter-" + this._filterCategory; - this.resourcesTreeElement.childrenListElement.removeStyleClass(oldClass); - this.resourcesGraphsElement.removeStyleClass(oldClass); + _createStatusbarButtons: function() + { + this.largerResourcesButton = new WebInspector.StatusBarButton(WebInspector.UIString("Use small resource rows."), "resources-larger-resources-status-bar-item"); + this.largerResourcesButton.toggled = Preferences.resourcesLargeRows; + this.largerResourcesButton.addEventListener("click", this._toggleLargerResources.bind(this), false); + if (!Preferences.resourcesLargeRows) { + Preferences.resourcesLargeRows = !Preferences.resourcesLargeRows; + this._toggleLargerResources(); // this will toggle the preference back to the original } - this._filterCategory = category; - var filterElement = this.filterBarElement.getElementsByClassName(this._filterCategory)[0]; - filterElement.addStyleClass("selected"); - var newClass = "filter-" + this._filterCategory; - this.resourcesTreeElement.childrenListElement.addStyleClass(newClass); - this.resourcesGraphsElement.addStyleClass(newClass); - }, - _updateFilter: function (e) { - this.filter(e.target.category); + this.sortingSelectElement = document.createElement("select"); + this.sortingSelectElement.className = "status-bar-item"; + this.sortingSelectElement.addEventListener("change", this._changeSortingFunction.bind(this), false); }, - get toolbarItemLabel() - { - return WebInspector.UIString("Resources"); - }, - get mainResourceLoadTime() { return this._mainResourceLoadTime || -1; @@ -226,7 +165,7 @@ WebInspector.ResourcesPanel.prototype = { this._mainResourceLoadTime = x; // Update the dividers to draw the new line - this._updateGraphDividersIfNeeded(true); + this.updateGraphDividersIfNeeded(true); }, get mainResourceDOMContentTime() @@ -241,21 +180,12 @@ WebInspector.ResourcesPanel.prototype = { this._mainResourceDOMContentTime = x; - this._updateGraphDividersIfNeeded(true); - }, - - get statusBarItems() - { - return [this.enableToggleButton.element, this.largerResourcesButton.element, this.sortingSelectElement]; + this.updateGraphDividersIfNeeded(true); }, show: function() { - WebInspector.Panel.prototype.show.call(this); - - this._updateDividersLabelBarPosition(); - this._updateSidebarWidth(); - this.refreshIfNeeded(); + WebInspector.AbstractTimelinePanel.prototype.show.call(this); var visibleView = this.visibleView; if (visibleView) { @@ -278,7 +208,7 @@ WebInspector.ResourcesPanel.prototype = { resize: function() { - this._updateGraphDividersIfNeeded(); + WebInspector.AbstractTimelinePanel.prototype.resize.call(this); var visibleView = this.visibleView; if (visibleView && "resize" in visibleView) @@ -296,7 +226,7 @@ WebInspector.ResourcesPanel.prototype = { var resourcesLength = this._resources.length; for (var i = 0; i < resourcesLength; ++i) { var resource = this._resources[i]; - if (!resource._resourcesTreeElement) + if (!resource._itemsTreeElement) continue; var resourceView = this.resourceViewForResource(resource); if (!resourceView.performSearch || resourceView === visibleView) @@ -313,7 +243,7 @@ WebInspector.ResourcesPanel.prototype = { function sortFuction(a, b) { - return resourceTreeElementSortFunction(a.resource._resourcesTreeElement, b.resource._resourcesTreeElement); + return resourceTreeElementSortFunction(a.resource._itemsTreeElement, b.resource._itemsTreeElement); } return sortFuction; @@ -321,7 +251,7 @@ WebInspector.ResourcesPanel.prototype = { searchMatchFound: function(view, matches) { - view.resource._resourcesTreeElement.searchMatches = matches; + view.resource._itemsTreeElement.searchMatches = matches; }, searchCanceled: function(startingNewSearch) @@ -333,8 +263,8 @@ WebInspector.ResourcesPanel.prototype = { for (var i = 0; i < this._resources.length; ++i) { var resource = this._resources[i]; - if (resource._resourcesTreeElement) - resource._resourcesTreeElement.updateErrorsAndWarnings(); + if (resource._itemsTreeElement) + resource._itemsTreeElement.updateErrorsAndWarnings(); } }, @@ -342,8 +272,8 @@ WebInspector.ResourcesPanel.prototype = { { for (var i = 0; i < this._resources.length; ++i) { var resource = this._resources[i]; - if (resource._resourcesTreeElement) - resource._resourcesTreeElement.resetBubble(); + if (resource._itemsTreeElement) + resource._itemsTreeElement.resetBubble(); } WebInspector.Panel.prototype.performSearch.call(this, query); @@ -356,23 +286,6 @@ WebInspector.ResourcesPanel.prototype = { return null; }, - get calculator() - { - return this._calculator; - }, - - set calculator(x) - { - if (!x || this._calculator === x) - return; - - this._calculator = x; - this._calculator.reset(); - - this._staleResources = this._resources; - this.refresh(); - }, - get sortingFunction() { return this._sortingFunction; @@ -384,75 +297,19 @@ WebInspector.ResourcesPanel.prototype = { this._sortResourcesIfNeeded(); }, - get needsRefresh() - { - return this._needsRefresh; - }, - - set needsRefresh(x) - { - if (this._needsRefresh === x) - return; - - this._needsRefresh = x; - - if (x) { - if (this.visible && !("_refreshTimeout" in this)) - this._refreshTimeout = setTimeout(this.refresh.bind(this), 500); - } else { - if ("_refreshTimeout" in this) { - clearTimeout(this._refreshTimeout); - delete this._refreshTimeout; - } - } - }, - - refreshIfNeeded: function() - { - if (this.needsRefresh) - this.refresh(); - }, - refresh: function() { - this.needsRefresh = false; - - var staleResourcesLength = this._staleResources.length; - var boundariesChanged = false; - - for (var i = 0; i < staleResourcesLength; ++i) { - var resource = this._staleResources[i]; - if (!resource._resourcesTreeElement) { - // Create the resource tree element and graph. - resource._resourcesTreeElement = new WebInspector.ResourceSidebarTreeElement(resource); - resource._resourcesTreeElement._resourceGraph = new WebInspector.ResourceGraph(resource); - - this.resourcesTreeElement.appendChild(resource._resourcesTreeElement); - this.resourcesGraphsElement.appendChild(resource._resourcesTreeElement._resourceGraph.graphElement); - } - - resource._resourcesTreeElement.refresh(); + WebInspector.AbstractTimelinePanel.prototype.refresh.call(this); - if (this.calculator.updateBoundaries(resource)) - boundariesChanged = true; - } - - if (boundariesChanged) { - // The boundaries changed, so all resource graphs are stale. - this._staleResources = this._resources; - staleResourcesLength = this._staleResources.length; - } - - for (var i = 0; i < staleResourcesLength; ++i) - this._staleResources[i]._resourcesTreeElement._resourceGraph.refresh(this.calculator); - - this._staleResources = []; - - this._updateGraphDividersIfNeeded(); this._sortResourcesIfNeeded(); this._updateSummaryGraph(); }, + _updateSummaryGraph: function() + { + this.summaryBar.update(this._resources); + }, + resourceTrackingWasEnabled: function() { this.reset(); @@ -467,14 +324,9 @@ WebInspector.ResourcesPanel.prototype = { { this.closeVisibleResource(); - this.containerElement.scrollTop = 0; - delete this.currentQuery; this.searchCanceled(); - if (this._calculator) - this._calculator.reset(); - if (this._resources) { var resourcesLength = this._resources.length; for (var i = 0; i < resourcesLength; ++i) { @@ -483,23 +335,18 @@ WebInspector.ResourcesPanel.prototype = { resource.warnings = 0; resource.errors = 0; - delete resource._resourcesTreeElement; delete resource._resourcesView; } } - this._resources = []; - this._staleResources = []; + WebInspector.AbstractTimelinePanel.prototype.reset.call(this); this.mainResourceLoadTime = -1; this.mainResourceDOMContentTime = -1; - - this.resourcesTreeElement.removeChildren(); + this.viewsContainerElement.removeChildren(); - this.resourcesGraphsElement.removeChildren(); - this.summaryBar.reset(); - this._updateGraphDividersIfNeeded(true); + this.summaryBar.reset(); if (InspectorController.resourceTrackingEnabled()) { this.enableToggleButton.title = WebInspector.UIString("Resource tracking enabled. Click to disable."); @@ -527,20 +374,12 @@ WebInspector.ResourcesPanel.prototype = { if (this.visibleView === resource._resourcesView) this.closeVisibleResource(); - this._resources.remove(resource, true); - - if (resource._resourcesTreeElement) { - this.resourcesTreeElement.removeChild(resource._resourcesTreeElement); - this.resourcesGraphsElement.removeChild(resource._resourcesTreeElement._resourceGraph.graphElement); - } + this.removeItem(resource); resource.warnings = 0; resource.errors = 0; - delete resource._resourcesTreeElement; delete resource._resourcesView; - - this._adjustScrollPosition(); }, addMessageToResource: function(resource, msg) @@ -557,8 +396,8 @@ WebInspector.ResourcesPanel.prototype = { break; } - if (!this.currentQuery && resource._resourcesTreeElement) - resource._resourcesTreeElement.updateErrorsAndWarnings(); + if (!this.currentQuery && resource._itemsTreeElement) + resource._itemsTreeElement.updateErrorsAndWarnings(); var view = this.resourceViewForResource(resource); if (view.addMessage) @@ -573,8 +412,8 @@ WebInspector.ResourcesPanel.prototype = { resource.warnings = 0; resource.errors = 0; - if (!this.currentQuery && resource._resourcesTreeElement) - resource._resourcesTreeElement.updateErrorsAndWarnings(); + if (!this.currentQuery && resource._itemsTreeElement) + resource._itemsTreeElement.updateErrorsAndWarnings(); var view = resource._resourcesView; if (!view || !view.clearMessages) @@ -585,8 +424,7 @@ WebInspector.ResourcesPanel.prototype = { refreshResource: function(resource) { - this._staleResources.push(resource); - this.needsRefresh = true; + this.refreshItem(resource); }, recreateViewForResourceIfNeeded: function(resource) @@ -601,8 +439,8 @@ WebInspector.ResourcesPanel.prototype = { resource.warnings = 0; resource.errors = 0; - if (!this.currentQuery && resource._resourcesTreeElement) - resource._resourcesTreeElement.updateErrorsAndWarnings(); + if (!this.currentQuery && resource._itemsTreeElement) + resource._itemsTreeElement.updateErrorsAndWarnings(); var oldView = resource._resourcesView; @@ -638,14 +476,11 @@ WebInspector.ResourcesPanel.prototype = { view.highlightLine(line); } - if (resource._resourcesTreeElement) { - resource._resourcesTreeElement.reveal(); - resource._resourcesTreeElement.select(true); - } + this.revealAndSelectItem(resource); this.visibleResource = resource; - this._updateSidebarWidth(); + this.updateSidebarWidth(); }, showView: function(view) @@ -667,7 +502,7 @@ WebInspector.ResourcesPanel.prototype = { if (this._lastSelectedGraphTreeElement) this._lastSelectedGraphTreeElement.select(true); - this._updateSidebarWidth(); + this.updateSidebarWidth(); }, resourceViewForResource: function(resource) @@ -696,79 +531,25 @@ WebInspector.ResourcesPanel.prototype = { return view.sourceFrame; }, - handleKeyEvent: function(event) - { - this.sidebarTree.handleKeyEvent(event); - }, - _sortResourcesIfNeeded: function() { - var sortedElements = [].concat(this.resourcesTreeElement.children); - sortedElements.sort(this.sortingFunction); - - var sortedElementsLength = sortedElements.length; - for (var i = 0; i < sortedElementsLength; ++i) { - var treeElement = sortedElements[i]; - if (treeElement === this.resourcesTreeElement.children[i]) - continue; - - var wasSelected = treeElement.selected; - this.resourcesTreeElement.removeChild(treeElement); - this.resourcesTreeElement.insertChild(treeElement, i); - if (wasSelected) - treeElement.select(true); - - var graphElement = treeElement._resourceGraph.graphElement; - this.resourcesGraphsElement.insertBefore(graphElement, this.resourcesGraphsElement.children[i]); - } + this.sortItems(this.sortingFunction); }, - _updateGraphDividersIfNeeded: function(force) + updateGraphDividersIfNeeded: function(force) { - if (!this.visible) { - this.needsRefresh = true; - return; - } - - if (document.body.offsetWidth <= 0) { - // The stylesheet hasn't loaded yet or the window is closed, - // so we can't calculate what is need. Return early. - return; - } - - var dividerCount = Math.round(this.dividersElement.offsetWidth / 64); - var slice = this.calculator.boundarySpan / dividerCount; - if (!force && this._currentDividerSlice === slice) + var proceed = WebInspector.AbstractTimelinePanel.prototype.updateGraphDividersIfNeeded.call(this, force); + + if (!proceed) return; - this._currentDividerSlice = slice; - - this.dividersElement.removeChildren(); - this.eventDividersElement.removeChildren(); - this.dividersLabelBarElement.removeChildren(); - - for (var i = 1; i <= dividerCount; ++i) { - var divider = document.createElement("div"); - divider.className = "resources-divider"; - if (i === dividerCount) - divider.addStyleClass("last"); - divider.style.left = ((i / dividerCount) * 100) + "%"; - - this.dividersElement.appendChild(divider.cloneNode()); - - var label = document.createElement("div"); - label.className = "resources-divider-label"; - if (!isNaN(slice)) - label.textContent = this.calculator.formatValue(slice * i); - divider.appendChild(label); - - this.dividersLabelBarElement.appendChild(divider); - } - - if (this.calculator.startAtZero) { + if (this.calculator.startAtZero || !this.calculator.computePercentageFromEventTime) { // If our current sorting method starts at zero, that means it shows all // resources starting at the same point, and so onLoad event and DOMContent // event lines really wouldn't make much sense here, so don't render them. + // Additionally, if the calculator doesn't have the computePercentageFromEventTime + // function defined, we are probably sorting by size, and event times aren't relevant + // in this case. return; } @@ -803,20 +584,6 @@ WebInspector.ResourcesPanel.prototype = { } }, - _updateSummaryGraph: function() - { - this.summaryBar.update(this._resources); - }, - - _updateDividersLabelBarPosition: function() - { - var scrollTop = this.containerElement.scrollTop; - var dividersTop = (scrollTop < this.summaryBar.element.offsetHeight ? this.summaryBar.element.offsetHeight : scrollTop); - this.dividersElement.style.top = scrollTop + "px"; - this.eventDividersElement.style.top = scrollTop + "px"; - this.dividersLabelBarElement.style.top = dividersTop + "px"; - }, - _graphSelected: function(treeElement) { if (this._lastSelectedGraphTreeElement) @@ -843,32 +610,25 @@ WebInspector.ResourcesPanel.prototype = { _toggleLargerResources: function() { - if (!this.resourcesTreeElement._childrenListNode) + if (!this.itemsTreeElement._childrenListNode) return; - this.resourcesTreeElement.smallChildren = !this.resourcesTreeElement.smallChildren; + this.itemsTreeElement.smallChildren = !this.itemsTreeElement.smallChildren; Preferences.resourcesLargeRows = !Preferences.resourcesLargeRows; InspectorController.setSetting("resources-large-rows", Preferences.resourcesLargeRows); - if (this.resourcesTreeElement.smallChildren) { - this.resourcesGraphsElement.addStyleClass("small"); + if (this.itemsTreeElement.smallChildren) { + this.itemsGraphsElement.addStyleClass("small"); this.largerResourcesButton.title = WebInspector.UIString("Use large resource rows."); this.largerResourcesButton.toggled = false; - this._adjustScrollPosition(); + this.adjustScrollPosition(); } else { - this.resourcesGraphsElement.removeStyleClass("small"); + this.itemsGraphsElement.removeStyleClass("small"); this.largerResourcesButton.title = WebInspector.UIString("Use small resource rows."); this.largerResourcesButton.toggled = true; } }, - _adjustScrollPosition: function() - { - // Prevent the container from being scrolled off the end. - if ((this.containerElement.scrollTop + this.containerElement.offsetHeight) > this.sidebarElement.offsetHeight) - this.containerElement.scrollTop = (this.sidebarElement.offsetHeight - this.containerElement.offsetHeight); - }, - _changeSortingFunction: function() { var selectedOption = this.sortingSelectElement[this.sortingSelectElement.selectedIndex]; @@ -893,41 +653,8 @@ WebInspector.ResourcesPanel.prototype = { } }, - _startSidebarDragging: function(event) - { - WebInspector.elementDragStart(this.sidebarResizeElement, this._sidebarDragging.bind(this), this._endSidebarDragging.bind(this), event, "col-resize"); - }, - - _sidebarDragging: function(event) + setSidebarWidth: function(width) { - this._updateSidebarWidth(event.pageX); - - event.preventDefault(); - }, - - _endSidebarDragging: function(event) - { - WebInspector.elementDragEnd(event); - }, - - _updateSidebarWidth: function(width) - { - if (this.sidebarElement.offsetWidth <= 0) { - // The stylesheet hasn't loaded yet or the window is closed, - // so we can't calculate what is need. Return early. - return; - } - - if (!("_currentSidebarWidth" in this)) - this._currentSidebarWidth = this.sidebarElement.offsetWidth; - - if (typeof width === "undefined") - width = this._currentSidebarWidth; - - width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2); - - this._currentSidebarWidth = width; - if (this.visibleResource) { this.containerElement.style.width = width + "px"; this.sidebarElement.style.removeProperty("width"); @@ -936,15 +663,13 @@ WebInspector.ResourcesPanel.prototype = { this.containerElement.style.removeProperty("width"); } - this.containerContentElement.style.left = width + "px"; - this.viewsContainerElement.style.left = width + "px"; this.sidebarResizeElement.style.left = (width - 3) + "px"; + }, - this._updateGraphDividersIfNeeded(); - - var visibleView = this.visibleView; - if (visibleView && "resize" in visibleView) - visibleView.resize(); + updateMainViewWidth: function(width) + { + WebInspector.AbstractTimelinePanel.prototype.updateMainViewWidth.call(this, width); + this.viewsContainerElement.style.left = width + "px"; }, _enableResourceTracking: function() @@ -965,88 +690,19 @@ WebInspector.ResourcesPanel.prototype = { this.sortingSelectElement.visible = true; InspectorController.enableResourceTracking(!!optionalAlways); } - } -} - -WebInspector.ResourcesPanel.prototype.__proto__ = WebInspector.Panel.prototype; - -WebInspector.ResourceCalculator = function() -{ -} - -WebInspector.ResourceCalculator.prototype = { - computeSummaryValues: function(resources) - { - var total = 0; - var categoryValues = {}; - - var resourcesLength = resources.length; - for (var i = 0; i < resourcesLength; ++i) { - var resource = resources[i]; - var value = this._value(resource); - if (typeof value === "undefined") - continue; - if (!(resource.category.name in categoryValues)) - categoryValues[resource.category.name] = 0; - categoryValues[resource.category.name] += value; - total += value; - } - - return {categoryValues: categoryValues, total: total}; - }, - - computeBarGraphPercentages: function(resource) - { - return {start: 0, middle: 0, end: (this._value(resource) / this.boundarySpan) * 100}; - }, - - computeBarGraphLabels: function(resource) - { - const label = this.formatValue(this._value(resource)); - var tooltip = label; - if (resource.cached) - tooltip = WebInspector.UIString("%s (from cache)", tooltip); - return {left: label, right: label, tooltip: tooltip}; - }, - - get boundarySpan() - { - return this.maximumBoundary - this.minimumBoundary; - }, - - updateBoundaries: function(resource) - { - this.minimumBoundary = 0; - - var value = this._value(resource); - if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) { - this.maximumBoundary = value; - return true; - } - - return false; - }, - - reset: function() - { - delete this.minimumBoundary; - delete this.maximumBoundary; - }, - - _value: function(resource) - { - return 0; }, - formatValue: function(value) + get _resources() { - return value.toString(); + return this._items; } } +WebInspector.ResourcesPanel.prototype.__proto__ = WebInspector.AbstractTimelinePanel.prototype; + WebInspector.ResourceTimeCalculator = function(startAtZero) { - WebInspector.ResourceCalculator.call(this); + WebInspector.AbstractTimelineCalculator.call(this); this.startAtZero = startAtZero; } @@ -1204,10 +860,10 @@ WebInspector.ResourceTimeCalculator.prototype = { _upperBound: function(resource) { return 0; - }, + } } -WebInspector.ResourceTimeCalculator.prototype.__proto__ = WebInspector.ResourceCalculator.prototype; +WebInspector.ResourceTimeCalculator.prototype.__proto__ = WebInspector.AbstractTimelineCalculator.prototype; WebInspector.ResourceTransferTimeCalculator = function() { @@ -1254,10 +910,19 @@ WebInspector.ResourceTransferDurationCalculator.prototype.__proto__ = WebInspect WebInspector.ResourceTransferSizeCalculator = function() { - WebInspector.ResourceCalculator.call(this); + WebInspector.AbstractTimelineCalculator.call(this); } WebInspector.ResourceTransferSizeCalculator.prototype = { + computeBarGraphLabels: function(resource) + { + const label = this.formatValue(this._value(resource)); + var tooltip = label; + if (resource.cached) + tooltip = WebInspector.UIString("%s (from cache)", tooltip); + return {left: label, right: label, tooltip: tooltip}; + }, + _value: function(resource) { return resource.contentLength; @@ -1269,7 +934,7 @@ WebInspector.ResourceTransferSizeCalculator.prototype = { } } -WebInspector.ResourceTransferSizeCalculator.prototype.__proto__ = WebInspector.ResourceCalculator.prototype; +WebInspector.ResourceTransferSizeCalculator.prototype.__proto__ = WebInspector.AbstractTimelineCalculator.prototype; WebInspector.ResourceSidebarTreeElement = function(resource) { @@ -1342,7 +1007,7 @@ WebInspector.ResourceSidebarTreeElement.prototype = { get selectable() { - return WebInspector.panels.resources._filterCategory == "all" || WebInspector.panels.resources._filterCategory == this.resource.category.name; + return WebInspector.panels.resources.isCategoryVisible(this.resource.category.name); }, createIconElement: function() diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/SourceFrame.js b/src/3rdparty/webkit/WebCore/inspector/front-end/SourceFrame.js index 790055a..1c11f76 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/SourceFrame.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/SourceFrame.js @@ -425,7 +425,7 @@ WebInspector.SourceFrame.prototype = { return; var expression = selection.getRangeAt(0).toString().trimWhitespace(); - WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, function(result, exception) { + WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, "console", function(result, exception) { WebInspector.showConsole(); var commandMessage = new WebInspector.ConsoleCommand(expression); WebInspector.console.addMessage(commandMessage); @@ -980,132 +980,377 @@ WebInspector.CSSSourceSyntaxHighligher.prototype.__proto__ = WebInspector.Source WebInspector.JavaScriptSourceSyntaxHighlighter = function(table, sourceFrame) { WebInspector.SourceSyntaxHighligher.call(this, table, sourceFrame); - this.findNumber = this.generateFinder(/^(-?(\d+\.?\d*([eE][+-]\d+)?|0[xX]\h+|Infinity)|NaN)(?:\W|$)/, 1, "webkit-javascript-number"); - this.findKeyword = this.generateFinder(/^(null|true|false|break|case|catch|const|default|finally|for|instanceof|new|var|continue|function|return|void|delete|if|this|do|while|else|in|switch|throw|try|typeof|with|debugger|class|enum|export|extends|import|super|get|set)(?:\W|$)/, 1, "webkit-javascript-keyword"); - this.findSingleLineString = this.generateFinder(/^"(?:[^"\\]|\\.)*"|^'([^'\\]|\\.)*'/, 0, "webkit-javascript-string"); // " this quote keeps Xcode happy - this.findMultilineCommentStart = this.generateFinder(/^\/\*.*$/, 0, "webkit-javascript-comment"); - this.findMultilineCommentEnd = this.generateFinder(/^.*?\*\//, 0, "webkit-javascript-comment"); - this.findMultilineSingleQuoteStringStart = this.generateFinder(/^'(?:[^'\\]|\\.)*\\$/, 0, "webkit-javascript-string"); - this.findMultilineSingleQuoteStringEnd = this.generateFinder(/^(?:[^'\\]|\\.)*?'/, 0, "webkit-javascript-string"); - this.findMultilineDoubleQuoteStringStart = this.generateFinder(/^"(?:[^"\\]|\\.)*\\$/, 0, "webkit-javascript-string"); - this.findMultilineDoubleQuoteStringEnd = this.generateFinder(/^(?:[^"\\]|\\.)*?"/, 0, "webkit-javascript-string"); - this.findMultilineRegExpEnd = this.generateFinder(/^(?:[^\/\\]|\\.)*?\/([gim]{0,3})/, 0, "webkit-javascript-regexp"); - this.findSingleLineComment = this.generateFinder(/^\/\/.*|^\/\*.*?\*\//, 0, "webkit-javascript-comment"); -} - -WebInspector.JavaScriptSourceSyntaxHighlighter.prototype = { - deleteContinueFlags: function(cell) + this.LexState = { + Initial: 1, + DivisionAllowed: 2, + }; + this.ContinueState = { + None: 0, + Comment: 1, + SingleQuoteString: 2, + DoubleQuoteString: 3, + RegExp: 4 + }; + + this.nonToken = ""; + this.cursor = 0; + this.lineIndex = -1; + this.lineCode = ""; + this.lineFragment = null; + this.lexState = this.LexState.Initial; + this.continueState = this.ContinueState.None; + + this.rules = [{ + pattern: /^(?:\/\/.*)/, + action: singleLineCommentAction + }, { + pattern: /^(?:\/\*(?:[^\*]|\*[^\/])*\*+\/)/, + action: multiLineSingleLineCommentAction + }, { + pattern: /^(?:\/\*(?:[^\*]|\*[^\/])*)/, + action: multiLineCommentStartAction + }, { + pattern: /^(?:(?:[^\*]|\*[^\/])*\*+\/)/, + action: multiLineCommentEndAction, + continueStateCondition: this.ContinueState.Comment + }, { + pattern: /^.*/, + action: multiLineCommentMiddleAction, + continueStateCondition: this.ContinueState.Comment + }, { + pattern: /^(?:(?:0|[1-9]\d*)\.\d+?(?:[eE](?:\d+|\+\d+|-\d+))?|\.\d+(?:[eE](?:\d+|\+\d+|-\d+))?|(?:0|[1-9]\d*)(?:[eE](?:\d+|\+\d+|-\d+))?|0x[0-9a-fA-F]+|0X[0-9a-fA-F]+)/, + action: numericLiteralAction + }, { + pattern: /^(?:"(?:[^"\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*"|'(?:[^'\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*')/, + action: stringLiteralAction + }, { + pattern: /^(?:'(?:[^'\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*)\\$/, + action: singleQuoteStringStartAction + }, { + pattern: /^(?:(?:[^'\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*')/, + action: singleQuoteStringEndAction, + continueStateCondition: this.ContinueState.SingleQuoteString + }, { + pattern: /^(?:(?:[^'\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*)\\$/, + action: singleQuoteStringMiddleAction, + continueStateCondition: this.ContinueState.SingleQuoteString + }, { + pattern: /^(?:"(?:[^"\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*)\\$/, + action: doubleQuoteStringStartAction + }, { + pattern: /^(?:(?:[^"\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*")/, + action: doubleQuoteStringEndAction, + continueStateCondition: this.ContinueState.DoubleQuoteString + }, { + pattern: /^(?:(?:[^"\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*)\\$/, + action: doubleQuoteStringMiddleAction, + continueStateCondition: this.ContinueState.DoubleQuoteString + }, { + pattern: /^(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))|[0-9])*)/, + action: identOrKeywordAction, + dontAppendNonToken: true + }, { + pattern: /^\)/, + action: rightParenAction, + dontAppendNonToken: true + }, { + pattern: /^(?:<=|>=|===|==|!=|!==|\+\+|\-\-|<<|>>|>>>|&&|\|\||\+=|\-=|\*=|%=|<<=|>>=|>>>=|&=|\|=|^=|[{}\(\[\]\.;,<>\+\-\*%&\|\^!~\?:=])/, + action: punctuatorAction, + dontAppendNonToken: true + }, { + pattern: /^(?:\/=?)/, + action: divPunctuatorAction, + stateCondition: this.LexState.DivisionAllowed, + dontAppendNonToken: true + }, { + pattern: /^(?:\/(?:(?:\\.)|[^\\*\/])(?:(?:\\.)|[^\\/])*\/(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))|[0-9])*)/, + action: regExpLiteralAction + }, { + pattern: /^(?:\/(?:(?:\\.)|[^\\*\/])(?:(?:\\.)|[^\\/])*)\\$/, + action: regExpStartAction + }, { + pattern: /^(?:(?:(?:\\.)|[^\\/])*\/(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))|[0-9])*)/, + action: regExpEndAction, + continueStateCondition: this.ContinueState.RegExp + }, { + pattern: /^(?:(?:(?:\\.)|[^\\/])*)\\$/, + action: regExpMiddleAction, + continueStateCondition: this.ContinueState.RegExp + }]; + + function singleLineCommentAction(token) { - if (!cell) - return; - delete cell._commentContinues; - delete cell._singleQuoteStringContinues; - delete cell._doubleQuoteStringContinues; - delete cell._regexpContinues; - }, - - findMultilineRegExpStart: function(str) + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-comment")); + } + + function multiLineSingleLineCommentAction(token) { - var match = /^\/(?:[^\/\\]|\\.)*\\$/.exec(str); - if (!match || !/\\|\$|\.[\?\*\+]|[^\|]\|[^\|]/.test(match[0])) - return null; - this.previousMatchLength = match[0].length; - return this.createSpan(match[0], "webkit-javascript-regexp"); - }, - - findSingleLineRegExp: function(str) + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-comment")); + } + + function multiLineCommentStartAction(token) { - var match = /^(\/(?:[^\/\\]|\\.)*\/([gim]{0,3}))(.?)/.exec(str); - if (!match || !(match[2].length > 0 || /\\|\$|\.[\?\*\+]|[^\|]\|[^\|]/.test(match[1]) || /\.|;|,/.test(match[3]))) - return null; - this.previousMatchLength = match[1].length; - return this.createSpan(match[1], "webkit-javascript-regexp"); - }, + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-comment")); + this.continueState = this.ContinueState.Comment; + } + + function multiLineCommentEndAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-comment")); + this.continueState = this.ContinueState.None; + } + + function multiLineCommentMiddleAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-comment")); + } + + function numericLiteralAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-number")); + this.lexState = this.LexState.DivisionAllowed; + } + + function stringLiteralAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-string")); + this.lexState = this.LexState.Initial; + } + + function singleQuoteStringStartAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-string")); + this.continueState = this.ContinueState.SingleQuoteString; + } + + function singleQuoteStringEndAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-string")); + this.continueState = this.ContinueState.None; + } + + function singleQuoteStringMiddleAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-string")); + } + + function doubleQuoteStringStartAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-string")); + this.continueState = this.ContinueState.DoubleQuoteString; + } + + function doubleQuoteStringEndAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-string")); + this.continueState = this.ContinueState.None; + } + + function doubleQuoteStringMiddleAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-string")); + } + + function regExpLiteralAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-regexp")); + this.lexState = this.LexState.Initial; + } - syntaxHighlightLine: function(line, prevLine) + function regExpStartAction(token) { - var messageBubble = line.lastChild; - if (messageBubble && messageBubble.nodeType === Node.ELEMENT_NODE && messageBubble.hasStyleClass("webkit-html-message-bubble")) - line.removeChild(messageBubble); - else - messageBubble = null; + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-regexp")); + this.continueState = this.ContinueState.RegExp; + } - var code = line.textContent; + function regExpEndAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-regexp")); + this.continueState = this.ContinueState.None; + } - while (line.firstChild) - line.removeChild(line.firstChild); + function regExpMiddleAction(token) + { + this.cursor += token.length; + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-regexp")); + } + + function identOrKeywordAction(token) + { + const keywords = ["null", "true", "false", "break", "case", "catch", "const", "default", "finally", "for", "instanceof", "new", "var", "continue", "function", "return", "void", "delete", "if", "this", "do", "while", "else", "in", "switch", "throw", "try", "typeof", "with", "debugger", "class", "enum", "export", "extends", "import", "super", "get", "set"]; + this.cursor += token.length; + if (keywords.indexOf(token) === -1) { + this.nonToken += token; + this.lexState = this.LexState.DivisionAllowed; + } else { + this.appendNonToken(); + this.lineFragment.appendChild(this.createSpan(token, "webkit-javascript-keyword")); + this.lexState = this.LexState.Initial; + } + } + + function divPunctuatorAction(token) + { + this.cursor += token.length; + this.nonToken += token; + this.lexState = this.LexState.Initial; + } + + function rightParenAction(token) + { + this.cursor += token.length; + this.nonToken += token; + this.lexState = this.LexState.DivisionAllowed; + } + + function punctuatorAction(token) + { + this.cursor += token.length; + this.nonToken += token; + this.lexState = this.LexState.Initial; + } +} - var token; - var tmp = 0; - var i = 0; - this.previousMatchLength = 0; +WebInspector.JavaScriptSourceSyntaxHighlighter.prototype = { + process: function() + { + // Split up the work into chunks so we don't block the + // UI thread while processing. - if (prevLine) { - if (prevLine._commentContinues) { - if (!(token = this.findMultilineCommentEnd(code))) { - token = this.createSpan(code, "webkit-javascript-comment"); - line._commentContinues = true; - } - } else if (prevLine._singleQuoteStringContinues) { - if (!(token = this.findMultilineSingleQuoteStringEnd(code))) { - token = this.createSpan(code, "webkit-javascript-string"); - line._singleQuoteStringContinues = true; + var rows = this.table.rows; + var rowsLength = rows.length; + const tokensPerChunk = 100; + const lineLengthLimit = 20000; + + var boundProcessChunk = processChunk.bind(this); + var processChunkInterval = setInterval(boundProcessChunk, 25); + boundProcessChunk(); + + function processChunk() + { + for (var i = 0; i < tokensPerChunk; i++) { + if (this.cursor >= this.lineCode.length) + moveToNextLine.call(this); + if (this.lineIndex >= rowsLength) { + this.sourceFrame.dispatchEventToListeners("syntax highlighting complete"); + return; } - } else if (prevLine._doubleQuoteStringContinues) { - if (!(token = this.findMultilineDoubleQuoteStringEnd(code))) { - token = this.createSpan(code, "webkit-javascript-string"); - line._doubleQuoteStringContinues = true; + if (this.cursor > lineLengthLimit) { + var codeFragment = this.lineCode.substring(this.cursor); + this.nonToken += codeFragment; + this.cursor += codeFragment.length; } - } else if (prevLine._regexpContinues) { - if (!(token = this.findMultilineRegExpEnd(code))) { - token = this.createSpan(code, "webkit-javascript-regexp"); - line._regexpContinues = true; + + this.lex(); + } + } + + function moveToNextLine() + { + this.appendNonToken(); + + var row = rows[this.lineIndex]; + var line = row ? row.cells[1] : null; + if (line && this.lineFragment) { + var messageBubble = null; + if (line.lastChild && line.lastChild.nodeType === Node.ELEMENT_NODE && line.lastChild.hasStyleClass("webkit-html-message-bubble")) { + messageBubble = line.lastChild; + line.removeChild(messageBubble); } + + Element.prototype.removeChildren.call(line); + + line.appendChild(this.lineFragment); + if (messageBubble) + line.appendChild(messageBubble); + this.lineFragment = null; } - if (token) { - i += this.previousMatchLength ? this.previousMatchLength : code.length; - tmp = i; - line.appendChild(token); + this.lineIndex++; + if (this.lineIndex >= rowsLength && processChunkInterval) { + clearInterval(processChunkInterval); + this.sourceFrame.dispatchEventToListeners("syntax highlighting complete"); + return; } + row = rows[this.lineIndex]; + line = row ? row.cells[1] : null; + this.lineCode = line.textContent; + this.lineFragment = document.createDocumentFragment(); + this.cursor = 0; + if (!line) + moveToNextLine(); } - - for ( ; i < code.length; ++i) { - var codeFragment = code.substr(i); - var prevChar = code[i - 1]; - token = this.findSingleLineComment(codeFragment); - if (!token) { - if ((token = this.findMultilineCommentStart(codeFragment))) - line._commentContinues = true; - else if (!prevChar || /^\W/.test(prevChar)) { - token = this.findNumber(codeFragment) || - this.findKeyword(codeFragment) || - this.findSingleLineString(codeFragment) || - this.findSingleLineRegExp(codeFragment); - if (!token) { - if (token = this.findMultilineSingleQuoteStringStart(codeFragment)) - line._singleQuoteStringContinues = true; - else if (token = this.findMultilineDoubleQuoteStringStart(codeFragment)) - line._doubleQuoteStringContinues = true; - else if (token = this.findMultilineRegExpStart(codeFragment)) - line._regexpContinues = true; + }, + + lex: function() + { + var token = null; + var codeFragment = this.lineCode.substring(this.cursor); + + for (var i = 0; i < this.rules.length; i++) { + var rule = this.rules[i]; + var ruleContinueStateCondition = typeof rule.continueStateCondition === "undefined" ? this.ContinueState.None : rule.continueStateCondition; + if (this.continueState === ruleContinueStateCondition) { + if (typeof rule.stateCondition !== "undefined" && this.lexState !== rule.stateCondition) + continue; + var match = rule.pattern.exec(codeFragment); + if (match) { + token = match[0]; + if (token) { + if (!rule.dontAppendNonToken) + this.appendNonToken(); + return rule.action.call(this, token); } } } - - if (token) { - if (tmp !== i) - line.appendChild(document.createTextNode(code.substring(tmp, i))); - line.appendChild(token); - i += this.previousMatchLength - 1; - tmp = i + 1; - } } + this.nonToken += codeFragment[0]; + this.cursor++; + }, + + appendNonToken: function () + { + if (this.nonToken.length > 0) { + this.lineFragment.appendChild(document.createTextNode(this.nonToken)); + this.nonToken = ""; + } + }, + + syntaxHighlightNode: function(node) + { + this.lineCode = node.textContent; + this.lineFragment = document.createDocumentFragment(); + this.cursor = 0; + while (true) { + if (this.cursor >= this.lineCode.length) { + var codeFragment = this.lineCode.substring(this.cursor); + this.nonToken += codeFragment; + this.cursor += codeFragment.length; + this.appendNonToken(); + while (node.firstChild) + node.removeChild(node.firstChild); + node.appendChild(this.lineFragment); + this.lineFragment =null; + return; + } - if (tmp < code.length) - line.appendChild(document.createTextNode(code.substring(tmp, i))); - - if (messageBubble) - line.appendChild(messageBubble); + this.lex(); + } } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/StoragePanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/StoragePanel.js index 66b4a92..1aa11ee 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/StoragePanel.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/StoragePanel.js @@ -31,21 +31,7 @@ WebInspector.StoragePanel = function(database) { WebInspector.Panel.call(this); - this.sidebarElement = document.createElement("div"); - this.sidebarElement.id = "storage-sidebar"; - this.sidebarElement.className = "sidebar"; - this.element.appendChild(this.sidebarElement); - - this.sidebarResizeElement = document.createElement("div"); - this.sidebarResizeElement.className = "sidebar-resizer-vertical"; - this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false); - this.element.appendChild(this.sidebarResizeElement); - - this.sidebarTreeElement = document.createElement("ol"); - this.sidebarTreeElement.className = "sidebar-tree"; - this.sidebarElement.appendChild(this.sidebarTreeElement); - - this.sidebarTree = new TreeOutline(this.sidebarTreeElement); + this.createSidebar(); this.databasesListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("DATABASES"), {}, true); this.sidebarTree.appendChild(this.databasesListTreeElement); @@ -86,12 +72,6 @@ WebInspector.StoragePanel.prototype = { return [this.storageViewStatusBarItemsContainer]; }, - show: function() - { - WebInspector.Panel.prototype.show.call(this); - this._updateSidebarWidth(); - }, - reset: function() { if (this._databases) { @@ -133,11 +113,6 @@ WebInspector.StoragePanel.prototype = { this.sidebarTree.selectedTreeElement.deselect(); }, - handleKeyEvent: function(event) - { - this.sidebarTree.handleKeyEvent(event); - }, - addDatabase: function(database) { this._databases.push(database); @@ -416,49 +391,10 @@ WebInspector.StoragePanel.prototype = { return null; }, - _startSidebarDragging: function(event) - { - WebInspector.elementDragStart(this.sidebarResizeElement, this._sidebarDragging.bind(this), this._endSidebarDragging.bind(this), event, "col-resize"); - }, - - _sidebarDragging: function(event) - { - this._updateSidebarWidth(event.pageX); - - event.preventDefault(); - }, - - _endSidebarDragging: function(event) - { - WebInspector.elementDragEnd(event); - }, - - _updateSidebarWidth: function(width) + updateMainViewWidth: function(width) { - if (this.sidebarElement.offsetWidth <= 0) { - // The stylesheet hasn't loaded yet or the window is closed, - // so we can't calculate what is need. Return early. - return; - } - - if (!("_currentSidebarWidth" in this)) - this._currentSidebarWidth = this.sidebarElement.offsetWidth; - - if (typeof width === "undefined") - width = this._currentSidebarWidth; - - width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2); - - this._currentSidebarWidth = width; - - this.sidebarElement.style.width = width + "px"; this.storageViews.style.left = width + "px"; this.storageViewStatusBarItemsContainer.style.left = width + "px"; - this.sidebarResizeElement.style.left = (width - 3) + "px"; - - var visibleView = this.visibleView; - if (visibleView && "resize" in visibleView) - visibleView.resize(); } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/StylesSidebarPane.js b/src/3rdparty/webkit/WebCore/inspector/front-end/StylesSidebarPane.js index 3582f96..a95dae3 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/StylesSidebarPane.js @@ -376,7 +376,7 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl { WebInspector.PropertiesSection.call(this, styleRule.selectorText); - this.titleElement.addEventListener("click", function(e) { e.stopPropagation(); }, false); + this.titleElement.addEventListener("click", this._clickSelector.bind(this), false); this.titleElement.addEventListener("dblclick", this._dblclickSelector.bind(this), false); this.element.addEventListener("dblclick", this._dblclickEmptySpace.bind(this), false); @@ -591,6 +591,19 @@ WebInspector.StylePropertiesSection.prototype = { return item; }, + _clickSelector: function(event) + { + event.stopPropagation(); + + // Don't search "Computed Styles", "Style Attribute", or Mapped Attributes. + if (this.computedStyle || !this.rule || this.rule.isUser) + return; + + var searchElement = document.getElementById("search"); + searchElement.value = this.styleRule.selectorText; + WebInspector.performSearch({ target: searchElement }); + }, + _dblclickEmptySpace: function(event) { this.expand(); diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/SummaryBar.js b/src/3rdparty/webkit/WebCore/inspector/front-end/SummaryBar.js index bbf2b1a..1c31449 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/SummaryBar.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/SummaryBar.js @@ -74,8 +74,7 @@ WebInspector.SummaryBar.prototype = { if (!size) continue; - var color = this.categories[category].color; - var colorString = "rgb(" + color.r + ", " + color.g + ", " + color.b + ")"; + var colorString = this.categories[category].color; var fillSegment = {color: colorString, value: size}; fillSegments.push(fillSegment); diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/TestController.js b/src/3rdparty/webkit/WebCore/inspector/front-end/TestController.js index 8da59e7..12e1ac7 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/TestController.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/TestController.js @@ -44,6 +44,16 @@ WebInspector.TestController.prototype = { { var message = typeof result === "undefined" ? "<undefined>" : JSON.stringify(result); InspectorController.didEvaluateForTestInFrontend(this._callId, message); + }, + + runAfterPendingDispatches: function(callback) + { + if (WebInspector.pendingDispatches === 0) { + callback(); + return; + } + + setTimeout(this.runAfterPendingDispatches.bind(this), 0, callback); } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/TimelineAgent.js b/src/3rdparty/webkit/WebCore/inspector/front-end/TimelineAgent.js index 4363da8..cbbb736 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/TimelineAgent.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/TimelineAgent.js @@ -33,22 +33,31 @@ WebInspector.TimelineAgent = function() { } // Must be kept in sync with TimelineItem.h -WebInspector.TimelineAgent.ItemType = { - DOMDispatch : 0, - Layout : 1, - RecalculateStyles : 2, - Paint : 3, - ParseHTML : 4 +WebInspector.TimelineAgent.RecordType = { + DOMDispatch : 0, + Layout : 1, + RecalculateStyles : 2, + Paint : 3, + ParseHTML : 4, + TimerInstall : 5, + TimerRemove : 6, + TimerFire : 7, + XHRReadyStateChange : 8, + XHRLoad : 9, + EvaluateScriptTag : 10 }; -WebInspector.addItemToTimeline = function(record) { - // Not implemented. +WebInspector.addRecordToTimeline = function(record) { + if (WebInspector.panels.timeline) + WebInspector.panels.timeline.addRecordToTimeline(record); } WebInspector.timelineProfilerWasStarted = function() { - // Not implemented. + if (WebInspector.panels.timeline) + WebInspector.panels.timeline.timelineWasStarted(); } WebInspector.timelineProfilerWasStopped = function() { - // Not implemented. + if (WebInspector.panels.timeline) + WebInspector.panels.timeline.timelineWasStopped(); } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/TimelinePanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/TimelinePanel.js new file mode 100644 index 0000000..df63a0b --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/TimelinePanel.js @@ -0,0 +1,362 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.TimelinePanel = function() +{ + WebInspector.AbstractTimelinePanel.call(this); + + this.element.addStyleClass("timeline"); + + this.createInterface(); + this.summaryBar.element.id = "timeline-summary"; + this.itemsGraphsElement.id = "timeline-graphs"; + + this._createStatusbarButtons(); + + this.calculator = new WebInspector.TimelineCalculator(); + + this.filter(this.filterAllElement, false); +} + +WebInspector.TimelinePanel.prototype = { + toolbarItemClass: "timeline", + + get toolbarItemLabel() + { + return WebInspector.UIString("Timeline"); + }, + + get statusBarItems() + { + return [this.toggleTimelineButton.element, this.clearButton.element]; + }, + + get categories() + { + if (!this._categories) { + this._categories = { + loading: new WebInspector.TimelineCategory("loading", WebInspector.UIString("Loading"), "rgb(47,102,236)"), + scripting: new WebInspector.TimelineCategory("scripting", WebInspector.UIString("Scripting"), "rgb(157,231,119)"), + rendering: new WebInspector.TimelineCategory("rendering", WebInspector.UIString("Rendering"), "rgb(164,60,255)"), + other: new WebInspector.TimelineCategory("other", WebInspector.UIString("Other"), "rgb(186,186,186)") + }; + } + return this._categories; + }, + + populateSidebar: function() + { + this.itemsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RECORDS"), {}, true); + this.itemsTreeElement.expanded = true; + this.sidebarTree.appendChild(this.itemsTreeElement); + }, + + _createStatusbarButtons: function() + { + this.toggleTimelineButton = new WebInspector.StatusBarButton("", "record-profile-status-bar-item"); + this.toggleTimelineButton.addEventListener("click", this._toggleTimelineButtonClicked.bind(this), false); + + this.clearButton = new WebInspector.StatusBarButton("", "timeline-clear-status-bar-item"); + this.clearButton.addEventListener("click", this.reset.bind(this), false); + }, + + timelineWasStarted: function() + { + this.toggleTimelineButton.toggled = true; + }, + + timelineWasStopped: function() + { + this.toggleTimelineButton.toggled = false; + }, + + addRecordToTimeline: function(record) + { + var formattedRecord = this._formatRecord(record); + // Glue subsequent records with same category and title together if they are closer than 100ms to each other. + if (this._lastRecord && (!record.children || !record.children.length) && + this._lastRecord.category == formattedRecord.category && + this._lastRecord.title == formattedRecord.title && + this._lastRecord.details == formattedRecord.details && + formattedRecord.startTime - this._lastRecord.endTime < 0.1) { + this._lastRecord.endTime = formattedRecord.endTime; + this._lastRecord.count++; + this.refreshItem(this._lastRecord); + } else { + this.addItem(formattedRecord); + + for (var i = 0; record.children && i < record.children.length; ++i) + this.addRecordToTimeline(record.children[i]); + this._lastRecord = record.children && record.children.length ? null : formattedRecord; + } + }, + + createItemTreeElement: function(item) + { + return new WebInspector.TimelineRecordTreeElement(item); + }, + + createItemGraph: function(item) + { + return new WebInspector.TimelineGraph(item); + }, + + _toggleTimelineButtonClicked: function() + { + if (InspectorController.timelineProfilerEnabled()) + InspectorController.stopTimelineProfiler(); + else + InspectorController.startTimelineProfiler(); + }, + + _formatRecord: function(record) + { + if (!this._recordStyles) { + this._recordStyles = {}; + var recordTypes = WebInspector.TimelineAgent.RecordType; + this._recordStyles[recordTypes.DOMDispatch] = { title: WebInspector.UIString("DOM Event"), category: this.categories.scripting }; + this._recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: this.categories.rendering }; + this._recordStyles[recordTypes.RecalculateStyles] = { title: WebInspector.UIString("Recalculate Style"), category: this.categories.rendering }; + this._recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: this.categories.rendering }; + this._recordStyles[recordTypes.ParseHTML] = { title: WebInspector.UIString("Parse"), category: this.categories.loading }; + this._recordStyles[recordTypes.TimerInstall] = { title: WebInspector.UIString("Install Timer"), category: this.categories.scripting }; + this._recordStyles[recordTypes.TimerRemove] = { title: WebInspector.UIString("Remove Timer"), category: this.categories.scripting }; + this._recordStyles[recordTypes.TimerFire] = { title: WebInspector.UIString("Timer Fired"), category: this.categories.scripting }; + this._recordStyles[recordTypes.XHRReadyStateChange] = { title: WebInspector.UIString("XHR Ready State Change"), category: this.categories.scripting }; + this._recordStyles[recordTypes.XHRLoad] = { title: WebInspector.UIString("XHR Load"), category: this.categories.scripting }; + this._recordStyles[recordTypes.EvaluateScriptTag] = { title: WebInspector.UIString("Evaluate Script"), category: this.categories.scripting }; + this._recordStyles["Other"] = { title: WebInspector.UIString("Other"), icon: 0, category: this.categories.other }; + } + + var style = this._recordStyles[record.type]; + if (!style) + style = this._recordStyles["Other"]; + + var formattedRecord = {}; + formattedRecord.category = style.category; + formattedRecord.title = style.title; + formattedRecord.startTime = record.startTime / 1000; + formattedRecord.data = record.data; + formattedRecord.count = 1; + formattedRecord.type = record.type; + formattedRecord.details = this._getRecordDetails(record); + formattedRecord.endTime = (typeof record.endTime !== "undefined") ? record.endTime / 1000 : formattedRecord.startTime; + return formattedRecord; + }, + + _getRecordDetails: function(record) + { + switch (record.type) { + case WebInspector.TimelineAgent.RecordType.DOMDispatch: + return record.data.type; + case WebInspector.TimelineAgent.RecordType.TimerInstall: + case WebInspector.TimelineAgent.RecordType.TimerRemove: + case WebInspector.TimelineAgent.RecordType.TimerFire: + return record.data.timerId; + case WebInspector.TimelineAgent.RecordType.XHRReadyStateChange: + case WebInspector.TimelineAgent.RecordType.XHRLoad: + case WebInspector.TimelineAgent.RecordType.EvaluateScriptTag: + return record.data.url; + default: + return ""; + } + }, + + reset: function() + { + WebInspector.AbstractTimelinePanel.prototype.reset.call(this); + this._lastRecord = null; + } +} + +WebInspector.TimelinePanel.prototype.__proto__ = WebInspector.AbstractTimelinePanel.prototype; + + +WebInspector.TimelineCategory = function(name, title, color) +{ + WebInspector.AbstractTimelineCategory.call(this, name, title, color); +} + +WebInspector.TimelineCategory.prototype = { +} + +WebInspector.TimelineCategory.prototype.__proto__ = WebInspector.AbstractTimelineCategory.prototype; + + +WebInspector.TimelineRecordTreeElement = function(record) +{ + this._record = record; + + // Pass an empty title, the title gets made later in onattach. + TreeElement.call(this, "", null, false); +} + +WebInspector.TimelineRecordTreeElement.prototype = { + onattach: function() + { + this.listItemElement.removeChildren(); + this.listItemElement.addStyleClass("timeline-tree-item"); + this.listItemElement.addStyleClass("timeline-category-" + this._record.category.name); + + var iconElement = document.createElement("span"); + iconElement.className = "timeline-tree-icon"; + this.listItemElement.appendChild(iconElement); + + this.typeElement = document.createElement("span"); + this.typeElement.className = "type"; + this.typeElement.textContent = this._record.title; + this.listItemElement.appendChild(this.typeElement); + + if (this._record.details) { + var separatorElement = document.createElement("span"); + separatorElement.className = "separator"; + separatorElement.textContent = " "; + + var dataElement = document.createElement("span"); + dataElement.className = "data"; + dataElement.textContent = "(" + this._record.details + ")"; + dataElement.addStyleClass("dimmed"); + this.listItemElement.appendChild(separatorElement); + this.listItemElement.appendChild(dataElement); + } + }, + + refresh: function() + { + if (this._record.count > 1) + this.typeElement.textContent = this._record.title + " x " + this._record.count; + } +} + +WebInspector.TimelineRecordTreeElement.prototype.__proto__ = TreeElement.prototype; + + +WebInspector.TimelineCalculator = function() +{ + WebInspector.AbstractTimelineCalculator.call(this); +} + +WebInspector.TimelineCalculator.prototype = { + computeBarGraphPercentages: function(record) + { + var start = ((record.startTime - this.minimumBoundary) / this.boundarySpan) * 100; + var end = ((record.endTime - this.minimumBoundary) / this.boundarySpan) * 100; + return {start: start, end: end}; + }, + + computePercentageFromEventTime: function(eventTime) + { + return ((eventTime - this.minimumBoundary) / this.boundarySpan) * 100; + }, + + computeBarGraphLabels: function(record) + { + return {tooltip: record.title}; + }, + + updateBoundaries: function(record) + { + var didChange = false; + + var lowerBound = record.startTime; + + if (typeof this.minimumBoundary === "undefined" || lowerBound < this.minimumBoundary) { + this.minimumBoundary = lowerBound; + didChange = true; + } + + var upperBound = record.endTime; + if (typeof this.maximumBoundary === "undefined" || upperBound > this.maximumBoundary) { + this.maximumBoundary = upperBound; + didChange = true; + } + + return didChange; + }, + + formatValue: function(value) + { + return Number.secondsToString(value, WebInspector.UIString.bind(WebInspector)); + }, + +} + +WebInspector.TimelineCalculator.prototype.__proto__ = WebInspector.AbstractTimelineCalculator.prototype; + + +WebInspector.TimelineGraph = function(record) +{ + this.record = record; + + this._graphElement = document.createElement("div"); + this._graphElement.className = "timeline-graph-side"; + + this._barAreaElement = document.createElement("div"); + this._barAreaElement.className = "timeline-graph-bar-area hidden"; + this._graphElement.appendChild(this._barAreaElement); + + this._barElement = document.createElement("div"); + this._barElement.className = "timeline-graph-bar"; + this._barAreaElement.appendChild(this._barElement); + + this._graphElement.addStyleClass("timeline-category-" + record.category.name); +} + +WebInspector.TimelineGraph.prototype = { + get graphElement() + { + return this._graphElement; + }, + + refreshLabelPositions: function() + { + }, + + refresh: function(calculator) + { + var percentages = calculator.computeBarGraphPercentages(this.record); + var labels = calculator.computeBarGraphLabels(this.record); + + this._percentages = percentages; + + this._barAreaElement.removeStyleClass("hidden"); + + if (!this._graphElement.hasStyleClass("timeline-category-" + this.record.category.name)) { + this._graphElement.removeMatchingStyleClasses("timeline-category-\\w+"); + this._graphElement.addStyleClass("timeline-category-" + this.record.category.name); + } + + this._barElement.style.setProperty("left", percentages.start + "%"); + this._barElement.style.setProperty("right", (100 - percentages.end) + "%"); + + var tooltip = (labels.tooltip || ""); + this._barElement.title = tooltip; + } +} diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/TopDownProfileDataGridTree.js b/src/3rdparty/webkit/WebCore/inspector/front-end/TopDownProfileDataGridTree.js index b9d8b94..1b07883 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/TopDownProfileDataGridTree.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/TopDownProfileDataGridTree.js @@ -33,7 +33,7 @@ WebInspector.TopDownProfileDataGridNode = function(/*ProfileView*/ profileView, } WebInspector.TopDownProfileDataGridNode.prototype = { - _populate: function(event) + _sharedPopulate: function() { var children = this._remainingChildren; var childrenLength = children.length; @@ -41,9 +41,6 @@ WebInspector.TopDownProfileDataGridNode.prototype = { for (var i = 0; i < childrenLength; ++i) this.appendChild(new WebInspector.TopDownProfileDataGridNode(this.profileView, children[i], this.tree)); - if (this.removeEventListener) - this.removeEventListener("populate", this._populate, this); - this._remainingChildren = null; }, @@ -105,7 +102,9 @@ WebInspector.TopDownProfileDataGridTree.prototype = { this.sort(this.lastComparator, true); }, - _merge: WebInspector.TopDownProfileDataGridNode.prototype._merge + _merge: WebInspector.TopDownProfileDataGridNode.prototype._merge, + + _sharedPopulate: WebInspector.TopDownProfileDataGridNode.prototype._sharedPopulate } WebInspector.TopDownProfileDataGridTree.prototype.__proto__ = WebInspector.ProfileDataGridTree.prototype; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc b/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc index 32f15ce..a1d671e 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc @@ -1,6 +1,7 @@ <!DOCTYPE RCC><RCC version="1.0"> <qresource prefix="/webkit/inspector"> <file>inspector.html</file> + <file>AbstractTimelinePanel.js</file> <file>BottomUpProfileDataGridTree.js</file> <file>Breakpoint.js</file> <file>BreakpointsSidebarPane.js</file> @@ -60,6 +61,7 @@ <file>TestController.js</file> <file>TextPrompt.js</file> <file>TimelineAgent.js</file> + <file>TimelinePanel.js</file> <file>TopDownProfileDataGridTree.js</file> <file>treeoutline.js</file> <file>utilities.js</file> diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css index fc08bc2..78ab23d 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.css @@ -203,6 +203,10 @@ body.attached #search-results-matches { background-image: url(Images/scriptsIcon.png); } +.toolbar-item.timeline .toolbar-icon { + background-image: url(Images/timelineIcon.png); +} + .toolbar-item.storage .toolbar-icon { background-image: url(Images/storageIcon.png); } @@ -548,7 +552,7 @@ body.drawer-visible #drawer { margin-right: 4px; text-align: left; font-size: 11px; - font-family: Helvetia, Arial, sans-serif; + font-family: Helvetica, Arial, sans-serif; font-weight: bold; text-shadow: none; color: white; @@ -1159,6 +1163,7 @@ body.drawer-visible #drawer { .add-attribute { margin-left: 1px; margin-right: 1px; + white-space: nowrap; } .placard { @@ -2212,12 +2217,8 @@ body.inactive .data-grid th.sort-ascending, body.inactive .data-grid th.sort-des margin: 0 0 5px 20px; } -.panel-enabler-view button { - font-size: 13px; - margin: 6px 0 0 0; - padding: 3px 20px; +.panel-enabler-view button, .pane button { color: rgb(6, 6, 6); - height: 24px; background-color: transparent; border: 1px solid rgb(165, 165, 165); background-color: rgb(237, 237, 237); @@ -2226,12 +2227,24 @@ body.inactive .data-grid th.sort-ascending, body.inactive .data-grid th.sort-des -webkit-appearance: none; } -.panel-enabler-view button:active { +.panel-enabler-view button { + font-size: 13px; + margin: 6px 0 0 0; + padding: 3px 20px; + height: 24px; +} + +.pane button { + margin: 6px 0 6px 3px; + padding: 2px 9px; +} + +.panel-enabler-view button:active, .pane button:active { background-color: rgb(215, 215, 215); background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239))); } -body.inactive .panel-enabler-view button, .panel-enabler-view button:disabled { +body.inactive .panel-enabler-view button, .panel-enabler-view button:disabled, body.inactive .pane button, .pane button:disabled { color: rgb(130, 130, 130); border-color: rgb(212, 212, 212); background-color: rgb(239, 239, 239); @@ -2401,67 +2414,65 @@ button.enable-toggle-status-bar-item.toggled-on .glyph { } #resources-filter { - height: 24px; - padding: 2px 10px 0; - background: -webkit-gradient(linear, left top, left bottom, from(rgb(233, 233, 233)), to(rgb(207, 207, 207))); - border-bottom: 1px solid rgb(177, 177, 177); - overflow: hidden; + background: -webkit-gradient(linear, left top, left bottom, from(rgb(236, 236, 236)), to(rgb(217, 217, 217))); + border-bottom: 1px solid rgb(64%, 64%, 64%); } #console-filter { - height: 24px; + margin-top: 1px; +} + +.scope-bar { + height: 23px; padding: 2px 10px 0; overflow: hidden; } -#resources-filter li, #console-filter li { +.scope-bar li { display: inline-block; - margin: 1px 1px 0 0; - padding: 0 6px 3px; - font-size: 12px; + margin: 1px 2px 0 0; + padding: 1px 7px 3px; + font-size: 11px; line-height: 12px; font-weight: bold; - color: rgb(40, 40, 40); - border: 1px solid transparent; - border-bottom: 0; + color: rgb(46, 46, 46); background: transparent; + text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0; -webkit-border-radius: 8px; - text-shadow: rgba(255, 255, 255, 0.5) 1px 1px 0; + vertical-align: middle; } -#console-filter div.divider { - margin-left: 5px; - margin-right: 5px; - /* Only want a border-left here because border on both sides - made the divider too thick */ - border-left: 1px solid gray; - display: inline; +.scope-bar .divider { + margin: 1px 9px 0 8px; + background-color: rgba(0, 0, 0, 0.4); + height: 16px; + width: 1px; + vertical-align: middle; + display: inline-block; } -#resources-filter li.selected, #resources-filter li:hover, #resources-filter li:active, -#console-filter li.selected, #console-filter li:hover, #console-filter li:active { +.scope-bar li.selected, .scope-bar li:hover, .scope-bar li:active { color: white; - text-shadow: rgb(80, 80, 80) 1px 1px 1px; - background: rgba(20, 20, 20, 0.4); - border-color: rgba(20, 20, 20, 0.2); - -webkit-box-shadow: 0 1px 0px rgba(255, 255, 255, 0.5); + text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0; } -#resources-filter li:hover, -#console-filter li:hover { - background: rgba(20, 20, 20, 0.4); - border-color: transparent; - -webkit-box-shadow: none; +.scope-bar li:hover { + background: rgba(0, 0, 0, 0.2); } -#resources-filter li:active, -#console-filter li:active { - background: rgba(20, 20, 20, 0.6); +.scope-bar li.selected { + background: rgba(0, 0, 0, 0.3); + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5) inset, 0 -1px 1px rgba(255, 255, 255, 0.25) inset, 0 1px 0 rgba(255, 255, 255, 0.5); +} + +.scope-bar li:active { + background: rgba(0, 0, 0, 0.5); + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5) inset, 0 -1px 1px rgba(255, 255, 255, 0.25) inset, 0 1px 0 rgba(255, 255, 255, 0.5); } #resources-container { position: absolute; - top: 24px; + top: 23px; left: 0; bottom: 0; right: 0; @@ -2832,7 +2843,7 @@ button.enable-toggle-status-bar-item.toggled-on .glyph { #resource-views { position: absolute; - top: 24px; + top: 23px; right: 0; left: 200px; bottom: 0; @@ -2853,7 +2864,7 @@ button.enable-toggle-status-bar-item.toggled-on .glyph { } .resources .sidebar-resizer-vertical { - top: 24px; + top: 23px; } .sidebar-tree, .sidebar-tree .children { @@ -3000,7 +3011,7 @@ body.inactive .sidebar-tree-item .disclosure-button:active { padding: 1px 4px; text-align: center; font-size: 11px; - font-family: Helvetia, Arial, sans-serif; + font-family: Helvetica, Arial, sans-serif; font-weight: bold; text-shadow: none; color: white; @@ -3253,6 +3264,125 @@ body.inactive .sidebar-tree-item.selected .bubble.search-matches { background-image: url(Images/searchSmallGray.png); } +/* Timeline Style */ + +#timeline-summary { + position: absolute; + top: 0; + left: 0; + width: 0; + height: 0; +} + +.timeline-clear-status-bar-item .glyph { + -webkit-mask-image: url(Images/clearConsoleButtonGlyph.png); +} + +.timeline-tree-item { + height: 18px; + padding-left: 10px; + padding-top: 2px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + +.timeline-tree-item .type { + padding-left: 14px; +} + +.timeline-tree-item .timeline-tree-icon { + background-image: url(Images/timelineDots.png); + margin-top: 2px; + width: 12px; + height: 12px; + position: absolute; +} + +.timeline-tree-item:nth-of-type(2n) { + background-color: rgba(0, 0, 0, 0.05); +} + +.timeline-tree-item .data.dimmed { + color: rgba(0, 0, 0, 0.7); +} + +.timeline-category-loading, .timeline-category-scripting, .timeline-category-rendering { + display: none; +} + +.filter-all .timeline-category-loading, .filter-loading .timeline-category-loading, +.filter-all .timeline-category-scripting, .filter-scripting .timeline-category-scripting, +.filter-all .timeline-category-rendering, .filter-rendering .timeline-category-rendering { + display: list-item; +} + +#timeline-graphs { + position: absolute; + left: 0; + right: 0; + max-height: 100%; + top: 19px; +} + +.timeline-graph-side { + position: relative; + height: 18px; + padding: 0 5px; + white-space: nowrap; + margin-top: 0px; + border-top: 1px solid transparent; + overflow: hidden; +} + +.timeline-graph-bar-area { + position: absolute; + top: 0; + bottom: 0; + right: 8px; + left: 9px; +} + +.timeline-graph-bar { + position: absolute; + top: 0; + bottom: 0; + margin: auto -5px; + border-width: 4px 4px 5px; + height: 9px; + min-width: 7px; + opacity: 0.8; + -webkit-border-image: url(Images/timelineBarGray.png) 4 4 5 4; +} + +.timeline-graph-side:nth-of-type(2n) { + background-color: rgba(0, 0, 0, 0.05); +} + +.timeline-category-loading .timeline-graph-bar { + -webkit-border-image: url(Images/timelineBarBlue.png) 4 4 5 4; +} + +.timeline-category-scripting .timeline-graph-bar { + -webkit-border-image: url(Images/timelineBarOrange.png) 4 4 5 4; +} + +.timeline-category-rendering .timeline-graph-bar { + -webkit-border-image: url(Images/timelineBarPurple.png) 4 4 5 4; +} + +.timeline-category-loading .timeline-tree-icon { + background-position-y: 0px; +} + +.timeline-category-scripting .timeline-tree-icon { + background-position-y: 48px; +} + +.timeline-category-rendering .timeline-tree-icon { + background-position-y: 72px; +} + /* Profiler Style */ #profile-views { diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.html b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.html index 4fa69e0..04ab07a 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.html +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.html @@ -34,6 +34,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="utilities.js"></script> <script type="text/javascript" src="treeoutline.js"></script> <script type="text/javascript" src="inspector.js"></script> + <script type="text/javascript" src="InspectorControllerStub.js"></script> <script type="text/javascript" src="Object.js"></script> <script type="text/javascript" src="KeyboardShortcut.js"></script> <script type="text/javascript" src="TextPrompt.js"></script> @@ -44,6 +45,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="Drawer.js"></script> <script type="text/javascript" src="ChangesView.js"></script> <script type="text/javascript" src="ConsoleView.js"></script> + <script type="text/javascript" src="Panel.js"></script> + <script type="text/javascript" src="AbstractTimelinePanel.js"></script> <script type="text/javascript" src="Resource.js"></script> <script type="text/javascript" src="ResourceCategory.js"></script> <script type="text/javascript" src="Database.js"></script> @@ -69,7 +72,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="EventListenersSidebarPane.js"></script> <script type="text/javascript" src="Color.js"></script> <script type="text/javascript" src="StylesSidebarPane.js"></script> - <script type="text/javascript" src="Panel.js"></script> <script type="text/javascript" src="PanelEnablerView.js"></script> <script type="text/javascript" src="StatusBarButton.js"></script> <script type="text/javascript" src="SummaryBar.js"></script> @@ -94,6 +96,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="InjectedScript.js"></script> <script type="text/javascript" src="InjectedScriptAccess.js"></script> <script type="text/javascript" src="TimelineAgent.js"></script> + <script type="text/javascript" src="TimelinePanel.js"></script> <script type="text/javascript" src="TestController.js"></script> </head> <body class="detached"> @@ -110,7 +113,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. </div> <div id="drawer"> <div id="console-view"><div id="console-messages"><div id="console-prompt" spellcheck="false"><br></div></div></div> - <div id="drawer-status-bar" class="status-bar"><div id="other-drawer-status-bar-items"><button id="clear-console-status-bar-item" class="status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><div id="console-filter" class="status-bar-item"></div></div></div> + <div id="drawer-status-bar" class="status-bar"><div id="other-drawer-status-bar-items"><button id="clear-console-status-bar-item" class="status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><div id="console-filter" class="scope-bar status-bar-item"></div></div></div> </div> </body> </html> diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js index 17b02a1..c24d589 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js @@ -143,8 +143,11 @@ var WebInspector = { this.panels.profiles = new WebInspector.ProfilesPanel(); this.panels.profiles.registerProfileType(new WebInspector.CPUProfileType()); } + if (hiddenPanels.indexOf("timeline") === -1 && hiddenPanels.indexOf("timeline") === -1) + this.panels.timeline = new WebInspector.TimelinePanel(); + if (hiddenPanels.indexOf("storage") === -1 && hiddenPanels.indexOf("databases") === -1) - this.panels.storage = new WebInspector.StoragePanel(); + this.panels.storage = new WebInspector.StoragePanel(); }, _loadPreferences: function() @@ -369,6 +372,7 @@ WebInspector.loaded = function() document.body.addStyleClass("platform-" + platform); this._loadPreferences(); + this.pendingDispatches = 0; this.drawer = new WebInspector.Drawer(); this.console = new WebInspector.ConsoleView(this.drawer); @@ -379,13 +383,13 @@ WebInspector.loaded = function() this.domAgent = new WebInspector.DOMAgent(); this.resourceCategories = { - documents: new WebInspector.ResourceCategory(WebInspector.UIString("Documents"), "documents"), - stylesheets: new WebInspector.ResourceCategory(WebInspector.UIString("Stylesheets"), "stylesheets"), - images: new WebInspector.ResourceCategory(WebInspector.UIString("Images"), "images"), - scripts: new WebInspector.ResourceCategory(WebInspector.UIString("Scripts"), "scripts"), - xhr: new WebInspector.ResourceCategory(WebInspector.UIString("XHR"), "xhr"), - fonts: new WebInspector.ResourceCategory(WebInspector.UIString("Fonts"), "fonts"), - other: new WebInspector.ResourceCategory(WebInspector.UIString("Other"), "other") + documents: new WebInspector.ResourceCategory("documents", WebInspector.UIString("Documents"), "rgb(47,102,236)"), + stylesheets: new WebInspector.ResourceCategory("stylesheets", WebInspector.UIString("Stylesheets"), "rgb(157,231,119)"), + images: new WebInspector.ResourceCategory("images", WebInspector.UIString("Images"), "rgb(164,60,255)"), + scripts: new WebInspector.ResourceCategory("scripts", WebInspector.UIString("Scripts"), "rgb(255,121,0)"), + xhr: new WebInspector.ResourceCategory("xhr", WebInspector.UIString("XHR"), "rgb(231,231,10)"), + fonts: new WebInspector.ResourceCategory("fonts", WebInspector.UIString("Fonts"), "rgb(255,82,62)"), + other: new WebInspector.ResourceCategory("other", WebInspector.UIString("Other"), "rgb(186,186,186)") }; this.panels = {}; @@ -456,8 +460,6 @@ WebInspector.loaded = function() // this._updateErrorAndWarningCounts(); var searchField = document.getElementById("search"); - searchField.addEventListener("keydown", this.searchKeyDown.bind(this), false); - searchField.addEventListener("keyup", this.searchKeyUp.bind(this), false); searchField.addEventListener("search", this.performSearch.bind(this), false); // when the search is emptied toolbarElement.addEventListener("mousedown", this.toolbarDragStart, true); @@ -494,7 +496,9 @@ WebInspector.dispatch = function() { function delayDispatch() { WebInspector[methodName].apply(WebInspector, parameters); + WebInspector.pendingDispatches--; } + WebInspector.pendingDispatches++; setTimeout(delayDispatch, 0); } @@ -511,13 +515,19 @@ WebInspector.windowResize = function(event) WebInspector.windowFocused = function(event) { - if (event.target.nodeType === Node.DOCUMENT_NODE) + // Fires after blur, so when focusing on either the main inspector + // or an <iframe> within the inspector we should always remove the + // "inactive" class. + if (event.target.document.nodeType === Node.DOCUMENT_NODE) document.body.removeStyleClass("inactive"); } -WebInspector.windowBlured = function(event) +WebInspector.windowBlurred = function(event) { - if (event.target.nodeType === Node.DOCUMENT_NODE) + // Leaving the main inspector or an <iframe> within the inspector. + // We can add "inactive" now, and if we are moving the focus to another + // part of the inspector then windowFocused will correct this. + if (event.target.document.nodeType === Node.DOCUMENT_NODE) document.body.addStyleClass("inactive"); } @@ -626,7 +636,9 @@ WebInspector.documentKeyDown = function(event) break; - case "U+005B": // [ key + // Windows and Mac have two different definitions of [, so accept both. + case "U+005B": + case "U+00DB": // [ key if (isMac) var isRotateLeft = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey; else @@ -641,7 +653,9 @@ WebInspector.documentKeyDown = function(event) break; - case "U+005D": // ] key + // Windows and Mac have two different definitions of ], so accept both. + case "U+005D": + case "U+00DD": // ] key if (isMac) var isRotateRight = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey; else @@ -1165,7 +1179,7 @@ WebInspector.didCommitLoad = function() WebInspector.setDocument(null); } -WebInspector.addMessageToConsole = function(payload) +WebInspector.addConsoleMessage = function(payload) { var consoleMessage = new WebInspector.ConsoleMessage( payload.source, @@ -1179,6 +1193,11 @@ WebInspector.addMessageToConsole = function(payload) this.console.addMessage(consoleMessage); } +WebInspector.updateConsoleMessageRepeatCount = function(count) +{ + this.console.updateMessageRepeatCount(count); +} + WebInspector.log = function(message) { // remember 'this' for setInterval() callback @@ -1423,26 +1442,15 @@ WebInspector.linkifyURL = function(url, linkText, classes, isExternal) WebInspector.addMainEventListeners = function(doc) { - doc.defaultView.addEventListener("focus", this.windowFocused.bind(this), true); - doc.defaultView.addEventListener("blur", this.windowBlured.bind(this), true); + doc.defaultView.addEventListener("focus", this.windowFocused.bind(this), false); + doc.defaultView.addEventListener("blur", this.windowBlurred.bind(this), false); doc.addEventListener("click", this.documentClick.bind(this), true); } WebInspector.searchKeyDown = function(event) { - if (event.keyIdentifier !== "Enter") - return; - - // Call preventDefault since this was the Enter key. This prevents a "search" event - // from firing for key down. We handle the Enter key on key up in searchKeyUp. This - // stops performSearch from being called twice in a row. - event.preventDefault(); -} - -WebInspector.searchKeyUp = function(event) -{ - if (event.keyIdentifier !== "Enter") - return; + if (!isEnterKey(event)) + return false; // Select all of the text so the user can easily type an entirely new query. event.target.select(); @@ -1451,14 +1459,33 @@ WebInspector.searchKeyUp = function(event) // performance is poor because of searching on every key. The search field has // the incremental attribute set, so we still get incremental searches. this.performSearch(event); + + // Call preventDefault since this was the Enter key. This prevents a "search" event + // from firing for key down. This stops performSearch from being called twice in a row. + event.preventDefault(); } WebInspector.performSearch = function(event) { var query = event.target.value; var forceSearch = event.keyIdentifier === "Enter"; + var isShortSearch = (query.length < 3); + + // Clear a leftover short search flag due to a non-conflicting forced search. + if (isShortSearch && this.shortSearchWasForcedByKeyEvent && this.currentQuery !== query) + delete this.shortSearchWasForcedByKeyEvent; + + // Indicate this was a forced search on a short query. + if (isShortSearch && forceSearch) + this.shortSearchWasForcedByKeyEvent = true; + + if (!query || !query.length || (!forceSearch && isShortSearch)) { + // Prevent clobbering a short search forced by the user. + if (this.shortSearchWasForcedByKeyEvent) { + delete this.shortSearchWasForcedByKeyEvent; + return; + } - if (!query || !query.length || (!forceSearch && query.length < 3)) { delete this.currentQuery; for (var panelName in this.panels) { @@ -1531,7 +1558,8 @@ WebInspector.UIString = function(string) string = window.localizedStrings[string]; else { if (!(string in this.missingLocalizedStrings)) { - console.error("Localized string \"" + string + "\" not found."); + if (!WebInspector.InspectorControllerStub) + console.error("Localized string \"" + string + "\" not found."); this.missingLocalizedStrings[string] = true; } @@ -1614,7 +1642,7 @@ WebInspector.startEditing = function(element, committedCallback, cancelledCallba if (event.handled) return; - if (event.keyIdentifier === "Enter") { + if (isEnterKey(event)) { editingCommitted.call(element); event.preventDefault(); } else if (event.keyCode === 27) { // Escape key diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js b/src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js index 6df23de..e9d185f 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js @@ -817,3 +817,8 @@ String.format = function(format, substitutions, formatters, initialValue, append return { formattedResult: result, unusedSubstitutions: unusedSubstitutions }; } + +function isEnterKey(event) { + // Check if in IME. + return event.keyCode !== 229 && event.keyIdentifier === "Enter"; +} diff --git a/src/3rdparty/webkit/WebCore/loader/Cache.cpp b/src/3rdparty/webkit/WebCore/loader/Cache.cpp index 391790f..46fb068 100644 --- a/src/3rdparty/webkit/WebCore/loader/Cache.cpp +++ b/src/3rdparty/webkit/WebCore/loader/Cache.cpp @@ -275,6 +275,12 @@ void Cache::pruneLiveResources() // Destroy any decoded data in live objects that we can. // Start from the tail, since this is the least recently accessed of the objects. + + // The list might not be sorted by the m_lastDecodedAccessTime. The impact + // of this weaker invariant is minor as the below if statement to check the + // elapsedTime will evaluate to false as the currentTime will be a lot + // greater than the current->m_lastDecodedAccessTime. + // For more details see: https://bugs.webkit.org/show_bug.cgi?id=30209 CachedResource* current = m_liveDecodedResources.m_tail; while (current) { CachedResource* prev = current->m_prevInLiveResourcesList; diff --git a/src/3rdparty/webkit/WebCore/loader/CachedResource.cpp b/src/3rdparty/webkit/WebCore/loader/CachedResource.cpp index 43de633..f2f52b0 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachedResource.cpp +++ b/src/3rdparty/webkit/WebCore/loader/CachedResource.cpp @@ -242,6 +242,12 @@ void CachedResource::setDecodedSize(unsigned size) cache()->insertInLRUList(this); // Insert into or remove from the live decoded list if necessary. + // When inserting into the LiveDecodedResourcesList it is possible + // that the m_lastDecodedAccessTime is still zero or smaller than + // the m_lastDecodedAccessTime of the current list head. This is a + // violation of the invariant that the list is to be kept sorted + // by access time. The weakening of the invariant does not pose + // a problem. For more details please see: https://bugs.webkit.org/show_bug.cgi?id=30209 if (m_decodedSize && !m_inLiveDecodedResourcesList && hasClients()) cache()->insertInLiveDecodedResourcesList(this); else if (!m_decodedSize && m_inLiveDecodedResourcesList) diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp index df46397..9b15448 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp @@ -2,6 +2,8 @@ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * Copyright (C) 2008 Alp Toker <alp@atoker.com> + * Copyright (C) Research In Motion Limited 2009. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -75,6 +77,7 @@ #include "PageTransitionEvent.h" #include "PlaceholderDocument.h" #include "PluginData.h" +#include "PluginDatabase.h" #include "PluginDocument.h" #include "ProgressTracker.h" #include "RenderPart.h" @@ -113,10 +116,6 @@ #include "SVGViewSpec.h" #endif -#if PLATFORM(MAC) || PLATFORM(WIN) -#define PAGE_CACHE_ACCEPTS_UNLOAD_HANDLERS -#endif - namespace WebCore { #if ENABLE(SVG) @@ -337,10 +336,9 @@ void FrameLoader::urlSelected(const ResourceRequest& request, const String& pass FrameLoadRequest frameRequest(request, target); - if (referrerPolicy == NoReferrer) { + if (referrerPolicy == NoReferrer) m_suppressOpenerInNewFrame = true; - setOpener(0); - } else if (frameRequest.resourceRequest().httpReferrer().isEmpty()) + else if (frameRequest.resourceRequest().httpReferrer().isEmpty()) frameRequest.resourceRequest().setHTTPReferrer(m_outgoingReferrer); addHTTPOriginIfNeeded(frameRequest.resourceRequest(), outgoingOrigin()); @@ -757,6 +755,8 @@ void FrameLoader::receivedFirstData() String url; if (!m_documentLoader) return; + if (m_frame->inViewSourceMode()) + return; if (!parseHTTPRefresh(m_documentLoader->response().httpHeaderField("Refresh"), false, delay, url)) return; @@ -1288,6 +1288,30 @@ bool FrameLoader::shouldUsePlugin(const KURL& url, const String& mimeType, bool return objectType == ObjectContentNone || objectType == ObjectContentNetscapePlugin || objectType == ObjectContentOtherPlugin; } +ObjectContentType FrameLoader::defaultObjectContentType(const KURL& url, const String& mimeTypeIn) +{ + String mimeType = mimeTypeIn; + // We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "application/octet-stream" upon failure + if (mimeType.isEmpty()) + mimeType = MIMETypeRegistry::getMIMETypeForExtension(url.path().substring(url.path().reverseFind('.') + 1)); + + if (mimeType.isEmpty()) + return ObjectContentFrame; // Go ahead and hope that we can display the content. + + if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) + return WebCore::ObjectContentImage; + +#if !PLATFORM(MAC) && !PLATFORM(CHROMIUM) // Mac has no PluginDatabase, nor does Chromium + if (PluginDatabase::installedPlugins()->isMIMETypeRegistered(mimeType)) + return WebCore::ObjectContentNetscapePlugin; +#endif + + if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) + return WebCore::ObjectContentFrame; + + return WebCore::ObjectContentNone; +} + static HTMLPlugInElement* toPlugInElement(Node* node) { if (!node) @@ -1467,9 +1491,7 @@ bool FrameLoader::canCachePageContainingThisFrame() // the right NPObjects. See <rdar://problem/5197041> for more information. && !m_containsPlugIns && !m_URL.protocolIs("https") -#ifndef PAGE_CACHE_ACCEPTS_UNLOAD_HANDLERS && (!m_frame->domWindow() || !m_frame->domWindow()->hasEventListeners(eventNames().unloadEvent)) -#endif #if ENABLE(DATABASE) && !m_frame->document()->hasOpenDatabases() #endif @@ -1614,10 +1636,8 @@ bool FrameLoader::logCanCacheFrameDecision(int indentLevel) { PCLOG(" -Frame contains plugins"); cannotCache = true; } if (m_URL.protocolIs("https")) { PCLOG(" -Frame is HTTPS"); cannotCache = true; } -#ifndef PAGE_CACHE_ACCEPTS_UNLOAD_HANDLERS if (m_frame->domWindow() && m_frame->domWindow()->hasEventListeners(eventNames().unloadEvent)) { PCLOG(" -Frame has an unload event listener"); cannotCache = true; } -#endif #if ENABLE(DATABASE) if (m_frame->document()->hasOpenDatabases()) { PCLOG(" -Frame has open database handles"); cannotCache = true; } @@ -1728,10 +1748,13 @@ bool FrameLoader::isComplete() const void FrameLoader::completed() { RefPtr<Frame> protect(m_frame); - for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) - child->redirectScheduler()->startTimer(); + + for (Frame* descendant = m_frame->tree()->traverseNext(m_frame); descendant; descendant = descendant->tree()->traverseNext(m_frame)) + descendant->redirectScheduler()->startTimer(); + if (Frame* parent = m_frame->tree()->parent()) parent->loader()->checkCompleted(); + if (m_frame->view()) m_frame->view()->maintainScrollPositionAtAnchor(0); } @@ -3845,7 +3868,8 @@ void FrameLoader::dispatchDocumentElementAvailable() void FrameLoader::dispatchWindowObjectAvailable() { - if (!m_frame->script()->isEnabled() || !m_frame->script()->haveWindowShell()) + // FIXME: should this be isolated-worlds-aware? + if (!m_frame->script()->isEnabled() || !m_frame->script()->existingWindowShell(mainThreadNormalWorld())) return; m_client->windowObjectCleared(); diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h index bf0eebc..3bf6196 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * Copyright (C) Research In Motion Limited 2009. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -322,6 +323,10 @@ public: // uses the policy machinery (and therefore is called via the PolicyChecker). Once we // introduce a proper callback type for this function, we should make it private again. void continueLoadAfterWillSubmitForm(); + + bool suppressOpenerInNewFrame() const { return m_suppressOpenerInNewFrame; } + + static ObjectContentType defaultObjectContentType(const KURL& url, const String& mimeType); private: bool canCachePageContainingThisFrame(); diff --git a/src/3rdparty/webkit/WebCore/loader/RedirectScheduler.cpp b/src/3rdparty/webkit/WebCore/loader/RedirectScheduler.cpp index f015c12..c0d78ae 100644 --- a/src/3rdparty/webkit/WebCore/loader/RedirectScheduler.cpp +++ b/src/3rdparty/webkit/WebCore/loader/RedirectScheduler.cpp @@ -255,12 +255,20 @@ void RedirectScheduler::scheduleHistoryNavigation(int steps) if (!m_frame->page()) return; + // Invalid history navigations (such as history.forward() during a new load) have the side effect of cancelling any scheduled + // redirects. We also avoid the possibility of cancelling the current load by avoiding the scheduled redirection altogether. + if (!m_frame->page()->canGoBackOrForward(steps)) { + cancel(); + return; + } + schedule(new ScheduledRedirection(steps)); } void RedirectScheduler::timerFired(Timer<RedirectScheduler>*) { - ASSERT(m_frame->page()); + if (!m_frame->page()) + return; if (m_frame->page()->defersLoading()) return; @@ -282,8 +290,7 @@ void RedirectScheduler::timerFired(Timer<RedirectScheduler>*) } // go(i!=0) from a frame navigates into the history of the frame only, // in both IE and NS (but not in Mozilla). We can't easily do that. - if (m_frame->page()->canGoBackOrForward(redirection->historySteps)) - m_frame->page()->goBackOrForward(redirection->historySteps); + m_frame->page()->goBackOrForward(redirection->historySteps); return; case ScheduledRedirection::formSubmission: // The submitForm function will find a target frame before using the redirection timer. diff --git a/src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.h b/src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.h index f06ecde..b09d7be 100644 --- a/src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.h +++ b/src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.h @@ -40,13 +40,8 @@ class Frame; class ResourceError; class ResourceLoader; class ResourceResponse; -//### tempfix, to be removed -#ifdef __SYMBIAN32__ -struct ResourceRequest; -#else -class ResourceRequest; -#endif class ScriptString; +struct ResourceRequest; class ResourceLoadNotifier : public Noncopyable { public: diff --git a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp index 78ca0a5..4be3684 100644 --- a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp +++ b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp @@ -36,10 +36,10 @@ #include "IconRecord.h" #include "IntSize.h" #include "Logging.h" +#include "ScriptController.h" #include "SQLiteStatement.h" #include "SQLiteTransaction.h" #include "SuddenTermination.h" -#include <runtime/InitializeThreading.h> #include <wtf/CurrentTime.h> #include <wtf/MainThread.h> #include <wtf/StdLibExtras.h> @@ -93,7 +93,7 @@ static IconDatabaseClient* defaultClient() IconDatabase* iconDatabase() { if (!sharedIconDatabase) { - JSC::initializeThreading(); + ScriptController::initializeThreading(); sharedIconDatabase = new IconDatabase; } return sharedIconDatabase; diff --git a/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.cpp b/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.cpp index 94976a2..69b0075 100644 --- a/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.cpp +++ b/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.cpp @@ -40,6 +40,20 @@ namespace WebCore { +#if USE(V8) +static bool notificationCenterAvailable = false; + +void NotificationCenter::setIsAvailable(bool available) +{ + notificationCenterAvailable = available; +} + +bool NotificationCenter::isAvailable() +{ + return notificationCenterAvailable; +} +#endif + NotificationCenter::NotificationCenter(ScriptExecutionContext* context, NotificationPresenter* presenter) : ActiveDOMObject(context, this) , m_scriptExecutionContext(context) diff --git a/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.h b/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.h index 596ab8b..1084442 100644 --- a/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.h +++ b/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.h @@ -47,8 +47,12 @@ namespace WebCore { class NotificationCenter : public RefCounted<NotificationCenter>, public ActiveDOMObject { public: +#if USE(V8) + static void setIsAvailable(bool); + static bool isAvailable(); +#endif static PassRefPtr<NotificationCenter> create(ScriptExecutionContext* context, NotificationPresenter* presenter) { return adoptRef(new NotificationCenter(context, presenter)); } - + Notification* createHTMLNotification(const String& URI, ExceptionCode& ec) { return Notification::create(KURL(ParsedURLString, URI), context(), ec, presenter()); diff --git a/src/3rdparty/webkit/WebCore/page/Console.cpp b/src/3rdparty/webkit/WebCore/page/Console.cpp index 79613d3..7d0f697 100644 --- a/src/3rdparty/webkit/WebCore/page/Console.cpp +++ b/src/3rdparty/webkit/WebCore/page/Console.cpp @@ -46,6 +46,7 @@ #include "ScriptCallStack.h" #include <stdio.h> +#include <wtf/UnusedParam.h> namespace WebCore { @@ -247,8 +248,7 @@ void Console::assertCondition(bool condition, ScriptCallStack* callStack) if (condition) return; - // FIXME: <https://bugs.webkit.org/show_bug.cgi?id=19135> It would be nice to prefix assertion failures with a message like "Assertion failed: ". - addMessage(LogMessageType, ErrorMessageLevel, callStack, true); + addMessage(AssertMessageType, ErrorMessageLevel, callStack, true); } void Console::count(ScriptCallStack* callStack) diff --git a/src/3rdparty/webkit/WebCore/page/Console.h b/src/3rdparty/webkit/WebCore/page/Console.h index 08d43e3..1b93a4a 100644 --- a/src/3rdparty/webkit/WebCore/page/Console.h +++ b/src/3rdparty/webkit/WebCore/page/Console.h @@ -64,7 +64,8 @@ namespace WebCore { ObjectMessageType, TraceMessageType, StartGroupMessageType, - EndGroupMessageType + EndGroupMessageType, + AssertMessageType }; enum MessageLevel { diff --git a/src/3rdparty/webkit/WebCore/page/DOMTimer.cpp b/src/3rdparty/webkit/WebCore/page/DOMTimer.cpp index dd1e842..83bcb02 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMTimer.cpp +++ b/src/3rdparty/webkit/WebCore/page/DOMTimer.cpp @@ -27,6 +27,7 @@ #include "config.h" #include "DOMTimer.h" +#include "InspectorTimelineAgent.h" #include "ScheduledAction.h" #include "ScriptExecutionContext.h" #include <wtf/HashSet.h> @@ -87,6 +88,12 @@ int DOMTimer::install(ScriptExecutionContext* context, ScheduledAction* action, // The timer is deleted when context is deleted (DOMTimer::contextDestroyed) or explicitly via DOMTimer::removeById(), // or if it is a one-time timer and it has fired (DOMTimer::fired). DOMTimer* timer = new DOMTimer(context, action, timeout, singleShot); + +#if ENABLE(INSPECTOR) + if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context)) + timelineAgent->didInstallTimer(timer->m_timeoutId, timeout, singleShot); +#endif + return timer->m_timeoutId; } @@ -97,6 +104,12 @@ void DOMTimer::removeById(ScriptExecutionContext* context, int timeoutId) // respectively if (timeoutId <= 0) return; + +#if ENABLE(INSPECTOR) + if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context)) + timelineAgent->didRemoveTimer(timeoutId); +#endif + delete context->findTimeout(timeoutId); } @@ -105,6 +118,12 @@ void DOMTimer::fired() ScriptExecutionContext* context = scriptExecutionContext(); timerNestingLevel = m_nestingLevel; +#if ENABLE(INSPECTOR) + InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context); + if (timelineAgent) + timelineAgent->willFireTimer(m_timeoutId); +#endif + // Simple case for non-one-shot timers. if (isActive()) { if (repeatInterval() && repeatInterval() < s_minTimerInterval) { @@ -115,6 +134,10 @@ void DOMTimer::fired() // No access to member variables after this point, it can delete the timer. m_action->execute(context); +#if ENABLE(INSPECTOR) + if (timelineAgent) + timelineAgent->didFireTimer(); +#endif return; } @@ -125,6 +148,10 @@ void DOMTimer::fired() delete this; action->execute(context); +#if ENABLE(INSPECTOR) + if (timelineAgent) + timelineAgent->didFireTimer(); +#endif delete action; timerNestingLevel = 0; } diff --git a/src/3rdparty/webkit/WebCore/page/DOMTimer.h b/src/3rdparty/webkit/WebCore/page/DOMTimer.h index 3c65258..460430f 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMTimer.h +++ b/src/3rdparty/webkit/WebCore/page/DOMTimer.h @@ -33,6 +33,7 @@ namespace WebCore { + class InspectorTimelineAgent; class ScheduledAction; class DOMTimer : public TimerBase, public ActiveDOMObject { diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.idl b/src/3rdparty/webkit/WebCore/page/DOMWindow.idl index 4587001..5addb83 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMWindow.idl +++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.idl @@ -160,15 +160,15 @@ module window { readonly attribute DOMApplicationCache applicationCache; #endif #if defined(ENABLE_DATABASE) && ENABLE_DATABASE - Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize) + [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize) raises(DOMException); #endif #if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE - readonly attribute Storage sessionStorage; - readonly attribute Storage localStorage; + readonly attribute [EnabledAtRuntime] Storage sessionStorage; + readonly attribute [EnabledAtRuntime] Storage localStorage; #endif #if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS - readonly attribute NotificationCenter webkitNotifications; + readonly attribute [EnabledAtRuntime] NotificationCenter webkitNotifications; #endif #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS @@ -426,6 +426,7 @@ module window { attribute HTMLUListElementConstructor HTMLUListElement; attribute HTMLCollectionConstructor HTMLCollection; + attribute HTMLAllCollectionConstructor HTMLAllCollection; attribute [CustomGetter] HTMLImageElementConstructor Image; // Usable with new operator attribute [CustomGetter] HTMLOptionElementConstructor Option; // Usable with new operator diff --git a/src/3rdparty/webkit/WebCore/page/Geolocation.cpp b/src/3rdparty/webkit/WebCore/page/Geolocation.cpp index 86127d7..de4a9a1 100644 --- a/src/3rdparty/webkit/WebCore/page/Geolocation.cpp +++ b/src/3rdparty/webkit/WebCore/page/Geolocation.cpp @@ -31,10 +31,11 @@ #include "Document.h" #include "Frame.h" #include "Page.h" -#include "PositionError.h" namespace WebCore { +static const char permissionDeniedErrorMessage[] = "User denied Geolocation"; + Geolocation::GeoNotifier::GeoNotifier(Geolocation* geolocation, PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) : m_geolocation(geolocation) , m_successCallback(successCallback) @@ -42,12 +43,21 @@ Geolocation::GeoNotifier::GeoNotifier(Geolocation* geolocation, PassRefPtr<Posit , m_options(options) , m_timer(this, &Geolocation::GeoNotifier::timerFired) { + ASSERT(m_geolocation); ASSERT(m_successCallback); // If no options were supplied from JS, we should have created a default set // of options in JSGeolocationCustom.cpp. ASSERT(m_options); } +void Geolocation::GeoNotifier::setFatalError(PassRefPtr<PositionError> error) +{ + // This method is called at most once on a given GeoNotifier object. + ASSERT(!m_fatalError); + m_fatalError = error; + m_timer.startOneShot(0); +} + bool Geolocation::GeoNotifier::hasZeroTimeout() const { return m_options->hasTimeout() && m_options->timeout() == 0; @@ -63,6 +73,14 @@ void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*) { m_timer.stop(); + if (m_fatalError) { + if (m_errorCallback) + m_errorCallback->handleEvent(m_fatalError.get()); + // This will cause this notifier to be deleted. + m_geolocation->fatalErrorOccurred(this); + return; + } + if (m_errorCallback) { RefPtr<PositionError> error = PositionError::create(PositionError::TIMEOUT, "Timeout expired"); m_errorCallback->handleEvent(error.get()); @@ -70,6 +88,46 @@ void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*) m_geolocation->requestTimedOut(this); } +void Geolocation::Watchers::set(int id, PassRefPtr<GeoNotifier> notifier) +{ + m_idToNotifierMap.set(id, notifier); + m_notifierToIdMap.set(notifier, id); +} + +void Geolocation::Watchers::remove(int id) +{ + IdToNotifierMap::iterator iter = m_idToNotifierMap.find(id); + if (iter == m_idToNotifierMap.end()) + return; + m_notifierToIdMap.remove(iter->second); + m_idToNotifierMap.remove(iter); +} + +void Geolocation::Watchers::remove(GeoNotifier* notifier) +{ + NotifierToIdMap::iterator iter = m_notifierToIdMap.find(notifier); + if (iter == m_notifierToIdMap.end()) + return; + m_idToNotifierMap.remove(iter->second); + m_notifierToIdMap.remove(iter); +} + +void Geolocation::Watchers::clear() +{ + m_idToNotifierMap.clear(); + m_notifierToIdMap.clear(); +} + +bool Geolocation::Watchers::isEmpty() const +{ + return m_idToNotifierMap.isEmpty(); +} + +void Geolocation::Watchers::getNotifiersVector(Vector<RefPtr<GeoNotifier> >& copy) const +{ + copyValuesToVector(m_idToNotifierMap, copy); +} + Geolocation::Geolocation(Frame* frame) : m_frame(frame) , m_service(GeolocationService::create(this)) @@ -92,40 +150,58 @@ void Geolocation::disconnectFrame() void Geolocation::getCurrentPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) { - RefPtr<GeoNotifier> notifier = GeoNotifier::create(this, successCallback, errorCallback, options); - - if (notifier->hasZeroTimeout() || m_service->startUpdating(notifier->m_options.get())) - notifier->startTimerIfNeeded(); - else { - if (notifier->m_errorCallback) { - RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, "Unable to Start"); - notifier->m_errorCallback->handleEvent(error.get()); - } + RefPtr<GeoNotifier> notifier = startRequest(successCallback, errorCallback, options); + if (!notifier) return; - } m_oneShots.add(notifier); } int Geolocation::watchPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) { + RefPtr<GeoNotifier> notifier = startRequest(successCallback, errorCallback, options); + if (!notifier) + return 0; + + static int nextAvailableWatchId = 1; + // In case of overflow, make sure the ID remains positive, but reuse the ID values. + if (nextAvailableWatchId < 1) + nextAvailableWatchId = 1; + m_watchers.set(nextAvailableWatchId, notifier.release()); + return nextAvailableWatchId++; +} + +PassRefPtr<Geolocation::GeoNotifier> Geolocation::startRequest(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) +{ RefPtr<GeoNotifier> notifier = GeoNotifier::create(this, successCallback, errorCallback, options); - if (notifier->hasZeroTimeout() || m_service->startUpdating(notifier->m_options.get())) - notifier->startTimerIfNeeded(); + // Check whether permissions have already been denied. Note that if this is the case, + // the permission state can not change again in the lifetime of this page. + if (isDenied()) + notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); else { - if (notifier->m_errorCallback) { - RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, "Unable to Start"); - notifier->m_errorCallback->handleEvent(error.get()); + if (notifier->hasZeroTimeout() || m_service->startUpdating(notifier->m_options.get())) + notifier->startTimerIfNeeded(); + else { + if (notifier->m_errorCallback) { + RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, "Unable to Start"); + notifier->m_errorCallback->handleEvent(error.get()); + } + return 0; } - return 0; } - - static int sIdentifier = 0; - - m_watchers.set(++sIdentifier, notifier); - return sIdentifier; + return notifier.release(); +} + +void Geolocation::fatalErrorOccurred(Geolocation::GeoNotifier* notifier) +{ + // This request has failed fatally. Remove it from our lists. + m_oneShots.remove(notifier); + m_watchers.remove(notifier); + + if (!hasListeners()) + m_service->stopUpdating(); } void Geolocation::requestTimedOut(GeoNotifier* notifier) @@ -164,7 +240,7 @@ void Geolocation::setIsAllowed(bool allowed) if (isAllowed()) makeSuccessCallbacks(); else { - RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, "User disallowed Geolocation"); + RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage); error->setIsFatal(true); handleError(error.get()); } @@ -212,7 +288,7 @@ void Geolocation::stopTimersForOneShots() void Geolocation::stopTimersForWatchers() { Vector<RefPtr<GeoNotifier> > copy; - copyValuesToVector(m_watchers, copy); + m_watchers.getNotifiersVector(copy); stopTimer(copy); } @@ -231,7 +307,7 @@ void Geolocation::handleError(PositionError* error) copyToVector(m_oneShots, oneShotsCopy); Vector<RefPtr<GeoNotifier> > watchersCopy; - copyValuesToVector(m_watchers, watchersCopy); + m_watchers.getNotifiersVector(watchersCopy); // Clear the lists before we make the callbacks, to avoid clearing notifiers // added by calls to Geolocation methods from the callbacks, and to prevent @@ -294,7 +370,7 @@ void Geolocation::makeSuccessCallbacks() copyToVector(m_oneShots, oneShotsCopy); Vector<RefPtr<GeoNotifier> > watchersCopy; - copyValuesToVector(m_watchers, watchersCopy); + m_watchers.getNotifiersVector(watchersCopy); // Clear the lists before we make the callbacks, to avoid clearing notifiers // added by calls to Geolocation methods from the callbacks, and to prevent diff --git a/src/3rdparty/webkit/WebCore/page/Geolocation.h b/src/3rdparty/webkit/WebCore/page/Geolocation.h index 07a587f..4827664 100644 --- a/src/3rdparty/webkit/WebCore/page/Geolocation.h +++ b/src/3rdparty/webkit/WebCore/page/Geolocation.h @@ -28,6 +28,7 @@ #include "GeolocationService.h" #include "PositionCallback.h" +#include "PositionError.h" #include "PositionErrorCallback.h" #include "PositionOptions.h" #include "Timer.h" @@ -64,6 +65,7 @@ public: void setIsAllowed(bool); bool isAllowed() const { return m_allowGeolocation == Yes; } + bool isDenied() const { return m_allowGeolocation == No; } void setShouldClearCache(bool shouldClearCache) { m_shouldClearCache = shouldClearCache; } bool shouldClearCache() const { return m_shouldClearCache; } @@ -75,6 +77,7 @@ private: public: static PassRefPtr<GeoNotifier> create(Geolocation* geolocation, PassRefPtr<PositionCallback> positionCallback, PassRefPtr<PositionErrorCallback> positionErrorCallback, PassRefPtr<PositionOptions> options) { return adoptRef(new GeoNotifier(geolocation, positionCallback, positionErrorCallback, options)); } + void setFatalError(PassRefPtr<PositionError>); bool hasZeroTimeout() const; void startTimerIfNeeded(); void timerFired(Timer<GeoNotifier>*); @@ -84,11 +87,27 @@ private: RefPtr<PositionErrorCallback> m_errorCallback; RefPtr<PositionOptions> m_options; Timer<GeoNotifier> m_timer; + RefPtr<PositionError> m_fatalError; private: GeoNotifier(Geolocation*, PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>); }; + class Watchers { + public: + void set(int id, PassRefPtr<GeoNotifier>); + void remove(int id); + void remove(GeoNotifier*); + void clear(); + bool isEmpty() const; + void getNotifiersVector(Vector<RefPtr<GeoNotifier> >&) const; + private: + typedef HashMap<int, RefPtr<GeoNotifier> > IdToNotifierMap; + typedef HashMap<RefPtr<GeoNotifier>, int> NotifierToIdMap; + IdToNotifierMap m_idToNotifierMap; + NotifierToIdMap m_notifierToIdMap; + }; + bool hasListeners() const { return !m_oneShots.isEmpty() || !m_watchers.isEmpty(); } void sendError(Vector<RefPtr<GeoNotifier> >&, PositionError*); @@ -108,13 +127,15 @@ private: virtual void geolocationServicePositionChanged(GeolocationService*); virtual void geolocationServiceErrorOccurred(GeolocationService*); + PassRefPtr<GeoNotifier> startRequest(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>); + + void fatalErrorOccurred(GeoNotifier*); void requestTimedOut(GeoNotifier*); typedef HashSet<RefPtr<GeoNotifier> > GeoNotifierSet; - typedef HashMap<int, RefPtr<GeoNotifier> > GeoNotifierMap; GeoNotifierSet m_oneShots; - GeoNotifierMap m_watchers; + Watchers m_watchers; Frame* m_frame; OwnPtr<GeolocationService> m_service; diff --git a/src/3rdparty/webkit/WebCore/page/SecurityOrigin.h b/src/3rdparty/webkit/WebCore/page/SecurityOrigin.h index 46e6fad..6d4ce1f 100644 --- a/src/3rdparty/webkit/WebCore/page/SecurityOrigin.h +++ b/src/3rdparty/webkit/WebCore/page/SecurityOrigin.h @@ -127,9 +127,8 @@ namespace WebCore { // SecurityOrigin is represented with the string "null". String toString() const; - // Serialize the security origin for storage in the database. This format is - // deprecated and should be used only for compatibility with old databases; - // use toString() and createFromString() instead. + // Serialize the security origin to a string that could be used as part of + // file names. This format should be used in storage APIs only. String databaseIdentifier() const; // This method checks for equality between SecurityOrigins, not whether diff --git a/src/3rdparty/webkit/WebCore/page/android/EventHandlerAndroid.cpp b/src/3rdparty/webkit/WebCore/page/android/EventHandlerAndroid.cpp index dcd25f2..cf2acfb 100644 --- a/src/3rdparty/webkit/WebCore/page/android/EventHandlerAndroid.cpp +++ b/src/3rdparty/webkit/WebCore/page/android/EventHandlerAndroid.cpp @@ -68,7 +68,7 @@ bool EventHandler::passWidgetMouseDownEventToWidget(RenderWidget* renderWidget) // This function is used to route the mouse down event to the native widgets, it seems like a // work around for the Mac platform which does not support double clicks, but browsers do. -bool EventHandler::passMouseDownEventToWidget(Widget* ) +bool EventHandler::passMouseDownEventToWidget(Widget*) { // return false so the normal propogation handles the event return false; @@ -84,7 +84,7 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const // It is used to ensure that events are sync'ed correctly between frames. For example // if the user presses down in one frame and up in another frame, this function will // returns true, and pass the event to the correct frame. -bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults& , Frame* , HitTestResult* ) +bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults&, Frame*, HitTestResult*) { notImplemented(); return false; @@ -93,7 +93,7 @@ bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults& , F // This is called to route wheel events to child widgets when they are RenderWidget // as the parent usually gets wheel event. Don't have a mouse with a wheel to confirm // the operation of this function. -bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& , Widget* ) +bool EventHandler::passWheelEventToWidget(PlatformWheelEvent&, Widget*) { notImplemented(); return false; @@ -105,7 +105,7 @@ bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& m } bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, - Frame* subframe, HitTestResult* ) + Frame* subframe, HitTestResult*) { return passSubframeEventToSubframe(mev, subframe); } diff --git a/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp b/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp index ec0e284..59797da 100644 --- a/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp +++ b/src/3rdparty/webkit/WebCore/page/animation/AnimationBase.cpp @@ -468,6 +468,7 @@ public: m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&FillLayer::yPosition, &FillLayer::setYPosition); break; case CSSPropertyBackgroundSize: + case CSSPropertyWebkitBackgroundSize: case CSSPropertyWebkitMaskSize: m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<LengthSize>(&FillLayer::sizeLength, &FillLayer::setSizeLength); break; @@ -592,6 +593,7 @@ static void ensurePropertyMap() gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionY, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionX, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); diff --git a/src/3rdparty/webkit/WebCore/platform/FileSystem.h b/src/3rdparty/webkit/WebCore/platform/FileSystem.h index 958eb73..791198d 100644 --- a/src/3rdparty/webkit/WebCore/platform/FileSystem.h +++ b/src/3rdparty/webkit/WebCore/platform/FileSystem.h @@ -65,15 +65,23 @@ namespace WebCore { class CString; -#if PLATFORM(QT) - -typedef QFile* PlatformFileHandle; -const PlatformFileHandle invalidPlatformFileHandle = 0; +// PlatformModule +#if PLATFORM(WIN_OS) +typedef HMODULE PlatformModule; +#elif PLATFORM(QT) #if defined(Q_WS_MAC) typedef CFBundleRef PlatformModule; -typedef unsigned PlatformModuleVersion; -#elif defined(Q_OS_WIN) -typedef HMODULE PlatformModule; +#else +typedef QLibrary* PlatformModule; +#endif // defined(Q_WS_MAC) +#elif PLATFORM(GTK) +typedef GModule* PlatformModule; +#else +typedef void* PlatformModule; +#endif + +// PlatformModuleVersion +#if PLATFORM(WIN_OS) struct PlatformModuleVersion { unsigned leastSig; unsigned mostSig; @@ -90,46 +98,34 @@ struct PlatformModuleVersion { { } + bool operator != (const PlatformModuleVersion& rhs) const + { + return mostSig != rhs.mostSig && leastSig != rhs.leastSig; + } + + + bool operator > (const PlatformModuleVersion& rhs) const + { + return mostSig > rhs.mostSig && leastSig > rhs.leastSig; + } + }; #else -typedef QLibrary* PlatformModule; typedef unsigned PlatformModuleVersion; #endif +// PlatformFileHandle +#if PLATFORM(QT) +typedef QFile* PlatformFileHandle; +const PlatformFileHandle invalidPlatformFileHandle = 0; #elif PLATFORM(WIN_OS) typedef HANDLE PlatformFileHandle; -typedef HMODULE PlatformModule; // FIXME: -1 is INVALID_HANDLE_VALUE, defined in <winbase.h>. Chromium tries to // avoid using Windows headers in headers. We'd rather move this into the .cpp. const PlatformFileHandle invalidPlatformFileHandle = reinterpret_cast<HANDLE>(-1); - -struct PlatformModuleVersion { - unsigned leastSig; - unsigned mostSig; - - PlatformModuleVersion(unsigned) - : leastSig(0) - , mostSig(0) - { - } - - PlatformModuleVersion(unsigned lsb, unsigned msb) - : leastSig(lsb) - , mostSig(msb) - { - } - -}; #else typedef int PlatformFileHandle; -#if PLATFORM(GTK) -typedef GModule* PlatformModule; -#else -typedef void* PlatformModule; -#endif const PlatformFileHandle invalidPlatformFileHandle = -1; - -typedef unsigned PlatformModuleVersion; #endif bool fileExists(const String&); diff --git a/src/3rdparty/webkit/WebCore/platform/SSLKeyGenerator.h b/src/3rdparty/webkit/WebCore/platform/SSLKeyGenerator.h index 398a009..f81f0a5 100644 --- a/src/3rdparty/webkit/WebCore/platform/SSLKeyGenerator.h +++ b/src/3rdparty/webkit/WebCore/platform/SSLKeyGenerator.h @@ -33,7 +33,14 @@ namespace WebCore { class KURL; - void getSupportedKeySizes(Vector<String>&); + // Returns strings representing key sizes that may be used + // for the <keygen> tag. The first string is displayed as the default + // key size in the <keygen> menu. + void getSupportedKeySizes(Vector<String>& sizes); + + // This function handles the <keygen> tag in form elements. + // Returns a signed copy of the combined challenge string and public + // key (from a newly generated key pair). String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const KURL&); } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/platform/android/ClipboardAndroid.h b/src/3rdparty/webkit/WebCore/platform/android/ClipboardAndroid.h index 7761704..8c9d9fa 100644 --- a/src/3rdparty/webkit/WebCore/platform/android/ClipboardAndroid.h +++ b/src/3rdparty/webkit/WebCore/platform/android/ClipboardAndroid.h @@ -33,31 +33,31 @@ namespace WebCore { - class CachedImage; +class CachedImage; - class ClipboardAndroid : public Clipboard, public CachedResourceClient { - public: - ClipboardAndroid(ClipboardAccessPolicy policy, bool isForDragging); - ~ClipboardAndroid(); - - void clearData(const String&); - void clearAllData(); - String getData(const String&, bool& success) const; - bool setData(const String&, const String&); - - // extensions beyond IE's API - HashSet<String> types() const; +class ClipboardAndroid : public Clipboard, public CachedResourceClient { +public: + ClipboardAndroid(ClipboardAccessPolicy policy, bool isForDragging); + ~ClipboardAndroid(); + + void clearData(const String&); + void clearAllData(); + String getData(const String&, bool& success) const; + bool setData(const String&, const String&); + + // extensions beyond IE's API + HashSet<String> types() const; + + void setDragImage(CachedImage*, const IntPoint&); + void setDragImageElement(Node*, const IntPoint&); - void setDragImage(CachedImage*, const IntPoint&); - void setDragImageElement(Node*, const IntPoint&); - - virtual DragImageRef createDragImage(IntPoint&) const; - virtual void declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*); - virtual void writeURL(const KURL&, const String&, Frame*); - virtual void writeRange(Range*, Frame*); + virtual DragImageRef createDragImage(IntPoint&) const; + virtual void declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*); + virtual void writeURL(const KURL&, const String&, Frame*); + virtual void writeRange(Range*, Frame*); - virtual bool hasData(); - }; + virtual bool hasData(); +}; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/platform/android/CursorAndroid.cpp b/src/3rdparty/webkit/WebCore/platform/android/CursorAndroid.cpp index 5c6e473..beef3b2 100644 --- a/src/3rdparty/webkit/WebCore/platform/android/CursorAndroid.cpp +++ b/src/3rdparty/webkit/WebCore/platform/android/CursorAndroid.cpp @@ -23,6 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #define LOG_TAG "WebCore" #include "config.h" @@ -282,12 +283,14 @@ const Cursor& westPanningCursor() return c; } -const Cursor& grabCursor() { +const Cursor& grabCursor() +{ notImplemented(); return c; } -const Cursor& grabbingCursor() { +const Cursor& grabbingCursor() +{ notImplemented(); return c; } diff --git a/src/3rdparty/webkit/WebCore/platform/android/FileChooserAndroid.cpp b/src/3rdparty/webkit/WebCore/platform/android/FileChooserAndroid.cpp index ec1b758..caedc7a 100644 --- a/src/3rdparty/webkit/WebCore/platform/android/FileChooserAndroid.cpp +++ b/src/3rdparty/webkit/WebCore/platform/android/FileChooserAndroid.cpp @@ -36,10 +36,9 @@ String FileChooser::basenameForWidth(const Font& font, int width) const return String(); // FIXME: This could be a lot faster, but assuming the data will not // often be much longer than the provided width, this may be fast enough. - String output = m_filenames[0].copy(); - while (font.width(TextRun(output.impl())) > width && output.length() > 4) { + String output = m_filenames[0].threadsafeCopy(); + while (font.width(TextRun(output.impl())) > width && output.length() > 4) output = output.replace(output.length() - 4, 4, String("...")); - } return output; } diff --git a/src/3rdparty/webkit/WebCore/platform/android/FileSystemAndroid.cpp b/src/3rdparty/webkit/WebCore/platform/android/FileSystemAndroid.cpp index f2665a2..46c1297 100644 --- a/src/3rdparty/webkit/WebCore/platform/android/FileSystemAndroid.cpp +++ b/src/3rdparty/webkit/WebCore/platform/android/FileSystemAndroid.cpp @@ -30,12 +30,12 @@ #include "CString.h" #include "StringBuilder.h" -#include <fnmatch.h> -#include <dlfcn.h> +#include "cutils/log.h" #include <dirent.h> +#include <dlfcn.h> #include <errno.h> +#include <fnmatch.h> #include <sys/stat.h> -#include "cutils/log.h" namespace WebCore { @@ -72,7 +72,7 @@ CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle) bool unloadModule(PlatformModule module) { - return dlclose(module) == 0; + return !dlclose(module); } void closeFile(PlatformFileHandle& handle) @@ -90,7 +90,7 @@ int writeToFile(PlatformFileHandle handle, const char* data, int length) int bytesWritten = write(handle, data, (size_t)(length - totalBytesWritten)); if (bytesWritten < 0 && errno != EINTR) return -1; - else if (bytesWritten > 0) + if (bytesWritten > 0) totalBytesWritten += bytesWritten; } diff --git a/src/3rdparty/webkit/WebCore/platform/android/KeyEventAndroid.cpp b/src/3rdparty/webkit/WebCore/platform/android/KeyEventAndroid.cpp index ab848bd..d3c48f5 100644 --- a/src/3rdparty/webkit/WebCore/platform/android/KeyEventAndroid.cpp +++ b/src/3rdparty/webkit/WebCore/platform/android/KeyEventAndroid.cpp @@ -41,128 +41,128 @@ namespace WebCore { static int windowsKeyCodeForKeyEvent(unsigned int keyCode) { // Does not provide all key codes, and does not handle all keys. - switch(keyCode) { - case kKeyCodeDel: - return VK_BACK; - case kKeyCodeTab: - return VK_TAB; - case kKeyCodeClear: - return VK_CLEAR; - case kKeyCodeDpadCenter: - case kKeyCodeNewline: - return VK_RETURN; - case kKeyCodeShiftLeft: - case kKeyCodeShiftRight: - return VK_SHIFT; - // back will serve as escape, although we probably do not have access to it - case kKeyCodeBack: - return VK_ESCAPE; - case kKeyCodeSpace: - return VK_SPACE; - case kKeyCodeHome: - return VK_HOME; - case kKeyCodeDpadLeft: - return VK_LEFT; - case kKeyCodeDpadUp: - return VK_UP; - case kKeyCodeDpadRight: - return VK_RIGHT; - case kKeyCodeDpadDown: - return VK_DOWN; - case kKeyCode0: - return VK_0; - case kKeyCode1: - return VK_1; - case kKeyCode2: - return VK_2; - case kKeyCode3: - return VK_3; - case kKeyCode4: - return VK_4; - case kKeyCode5: - return VK_5; - case kKeyCode6: - return VK_6; - case kKeyCode7: - return VK_7; - case kKeyCode8: - return VK_8; - case kKeyCode9: - return VK_9; - case kKeyCodeA: - return VK_A; - case kKeyCodeB: - return VK_B; - case kKeyCodeC: - return VK_C; - case kKeyCodeD: - return VK_D; - case kKeyCodeE: - return VK_E; - case kKeyCodeF: - return VK_F; - case kKeyCodeG: - return VK_G; - case kKeyCodeH: - return VK_H; - case kKeyCodeI: - return VK_I; - case kKeyCodeJ: - return VK_J; - case kKeyCodeK: - return VK_K; - case kKeyCodeL: - return VK_L; - case kKeyCodeM: - return VK_M; - case kKeyCodeN: - return VK_N; - case kKeyCodeO: - return VK_O; - case kKeyCodeP: - return VK_P; - case kKeyCodeQ: - return VK_Q; - case kKeyCodeR: - return VK_R; - case kKeyCodeS: - return VK_S; - case kKeyCodeT: - return VK_T; - case kKeyCodeU: - return VK_U; - case kKeyCodeV: - return VK_V; - case kKeyCodeW: - return VK_W; - case kKeyCodeX: - return VK_X; - case kKeyCodeY: - return VK_Y; - case kKeyCodeZ: - return VK_Z; - // colon - case kKeyCodeSemicolon: - return VK_OEM_1; - case kKeyCodeComma: - return VK_OEM_COMMA; - case kKeyCodeMinus: - return VK_OEM_MINUS; - case kKeyCodeEquals: - return VK_OEM_PLUS; - case kKeyCodePeriod: - return VK_OEM_PERIOD; - case kKeyCodeSlash: - return VK_OEM_2; - // maybe not the right choice - case kKeyCodeLeftBracket: - return VK_OEM_4; - case kKeyCodeBackslash: - return VK_OEM_5; - case kKeyCodeRightBracket: - return VK_OEM_6; - default: - return 0; + switch (keyCode) { + case kKeyCodeDel: + return VK_BACK; + case kKeyCodeTab: + return VK_TAB; + case kKeyCodeClear: + return VK_CLEAR; + case kKeyCodeDpadCenter: + case kKeyCodeNewline: + return VK_RETURN; + case kKeyCodeShiftLeft: + case kKeyCodeShiftRight: + return VK_SHIFT; + // back will serve as escape, although we probably do not have access to it + case kKeyCodeBack: + return VK_ESCAPE; + case kKeyCodeSpace: + return VK_SPACE; + case kKeyCodeHome: + return VK_HOME; + case kKeyCodeDpadLeft: + return VK_LEFT; + case kKeyCodeDpadUp: + return VK_UP; + case kKeyCodeDpadRight: + return VK_RIGHT; + case kKeyCodeDpadDown: + return VK_DOWN; + case kKeyCode0: + return VK_0; + case kKeyCode1: + return VK_1; + case kKeyCode2: + return VK_2; + case kKeyCode3: + return VK_3; + case kKeyCode4: + return VK_4; + case kKeyCode5: + return VK_5; + case kKeyCode6: + return VK_6; + case kKeyCode7: + return VK_7; + case kKeyCode8: + return VK_8; + case kKeyCode9: + return VK_9; + case kKeyCodeA: + return VK_A; + case kKeyCodeB: + return VK_B; + case kKeyCodeC: + return VK_C; + case kKeyCodeD: + return VK_D; + case kKeyCodeE: + return VK_E; + case kKeyCodeF: + return VK_F; + case kKeyCodeG: + return VK_G; + case kKeyCodeH: + return VK_H; + case kKeyCodeI: + return VK_I; + case kKeyCodeJ: + return VK_J; + case kKeyCodeK: + return VK_K; + case kKeyCodeL: + return VK_L; + case kKeyCodeM: + return VK_M; + case kKeyCodeN: + return VK_N; + case kKeyCodeO: + return VK_O; + case kKeyCodeP: + return VK_P; + case kKeyCodeQ: + return VK_Q; + case kKeyCodeR: + return VK_R; + case kKeyCodeS: + return VK_S; + case kKeyCodeT: + return VK_T; + case kKeyCodeU: + return VK_U; + case kKeyCodeV: + return VK_V; + case kKeyCodeW: + return VK_W; + case kKeyCodeX: + return VK_X; + case kKeyCodeY: + return VK_Y; + case kKeyCodeZ: + return VK_Z; + // colon + case kKeyCodeSemicolon: + return VK_OEM_1; + case kKeyCodeComma: + return VK_OEM_COMMA; + case kKeyCodeMinus: + return VK_OEM_MINUS; + case kKeyCodeEquals: + return VK_OEM_PLUS; + case kKeyCodePeriod: + return VK_OEM_PERIOD; + case kKeyCodeSlash: + return VK_OEM_2; + // maybe not the right choice + case kKeyCodeLeftBracket: + return VK_OEM_4; + case kKeyCodeBackslash: + return VK_OEM_5; + case kKeyCodeRightBracket: + return VK_OEM_6; + default: + return 0; } } @@ -171,28 +171,28 @@ static String keyIdentifierForAndroidKeyCode(int keyCode) // Does not return all of the same key identifiers, and // does not handle all the keys. switch (keyCode) { - case kKeyCodeClear: - return "Clear"; - case kKeyCodeNewline: - case kKeyCodeDpadCenter: - return "Enter"; - case kKeyCodeHome: - return "Home"; - case kKeyCodeDpadDown: - return "Down"; - case kKeyCodeDpadLeft: - return "Left"; - case kKeyCodeDpadRight: - return "Right"; - case kKeyCodeDpadUp: - return "Up"; - // Standard says that DEL becomes U+00007F. - case kKeyCodeDel: - return "U+00007F"; - default: - char upper[16]; - sprintf(upper, "U+%06X", windowsKeyCodeForKeyEvent(keyCode)); - return String(upper); + case kKeyCodeClear: + return "Clear"; + case kKeyCodeNewline: + case kKeyCodeDpadCenter: + return "Enter"; + case kKeyCodeHome: + return "Home"; + case kKeyCodeDpadDown: + return "Down"; + case kKeyCodeDpadLeft: + return "Left"; + case kKeyCodeDpadRight: + return "Right"; + case kKeyCodeDpadUp: + return "Up"; + // Standard says that DEL becomes U+00007F. + case kKeyCodeDel: + return "U+00007F"; + default: + char upper[16]; + sprintf(upper, "U+%06X", windowsKeyCodeForKeyEvent(keyCode)); + return String(upper); } } diff --git a/src/3rdparty/webkit/WebCore/platform/android/ScreenAndroid.cpp b/src/3rdparty/webkit/WebCore/platform/android/ScreenAndroid.cpp index 2439c1f..dcd2d10 100644 --- a/src/3rdparty/webkit/WebCore/platform/android/ScreenAndroid.cpp +++ b/src/3rdparty/webkit/WebCore/platform/android/ScreenAndroid.cpp @@ -31,14 +31,12 @@ #include "FloatRect.h" #include "Widget.h" - +#include "ui/DisplayInfo.h" +#include "ui/PixelFormat.h" +#include "ui/SurfaceComposerClient.h" #undef LOG // FIXME: Still have to do this to get the log to show up #include "utils/Log.h" -#include "ui/SurfaceComposerClient.h" -#include "ui/PixelFormat.h" -#include "ui/DisplayInfo.h" - namespace WebCore { int screenDepth(Widget* page) @@ -70,18 +68,18 @@ int Screen::orientation() const // to the values described here // (http://developer.apple.com/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/chapter_8_section_6.html) switch (info.orientation) { - case android::ISurfaceComposer::eOrientationDefault: - return 0; - case android::ISurfaceComposer::eOrientation90: - return 90; - case android::ISurfaceComposer::eOrientation180: - return 180; - case android::ISurfaceComposer::eOrientation270: - return -90; - default: - LOGE("Bad orientation returned from getDisplayIndo %d", - info.orientation); - return 0; + case android::ISurfaceComposer::eOrientationDefault: + return 0; + case android::ISurfaceComposer::eOrientation90: + return 90; + case android::ISurfaceComposer::eOrientation180: + return 180; + case android::ISurfaceComposer::eOrientation270: + return -90; + default: + LOGE("Bad orientation returned from getDisplayIndo %d", + info.orientation); + return 0; } } #endif diff --git a/src/3rdparty/webkit/WebCore/platform/android/TemporaryLinkStubs.cpp b/src/3rdparty/webkit/WebCore/platform/android/TemporaryLinkStubs.cpp index c0b57a6..b82edaf 100644 --- a/src/3rdparty/webkit/WebCore/platform/android/TemporaryLinkStubs.cpp +++ b/src/3rdparty/webkit/WebCore/platform/android/TemporaryLinkStubs.cpp @@ -28,17 +28,15 @@ #define ANDROID_COMPILE_HACK -#include <stdio.h> -#include <stdlib.h> #include "AXObjectCache.h" +#include "CString.h" #include "CachedPage.h" #include "CachedResource.h" -#include "CookieJar.h" +#include "Clipboard.h" #include "Console.h" #include "ContextMenu.h" #include "ContextMenuItem.h" -#include "Clipboard.h" -#include "CString.h" +#include "CookieJar.h" #include "Cursor.h" #include "Database.h" #include "DocumentFragment.h" @@ -49,8 +47,8 @@ #include "FileList.h" #include "Font.h" #include "Frame.h" -#include "FrameLoader.h" #include "FrameLoadRequest.h" +#include "FrameLoader.h" #include "FrameView.h" #include "GraphicsContext.h" #include "HTMLFrameOwnerElement.h" @@ -60,21 +58,11 @@ #include "IconDatabase.h" #include "IconLoader.h" #include "IntPoint.h" - -#if USE(JSC) -#include "JavaScriptCallFrame.h" -#include "JavaScriptDebugServer.h" -#include "API/JSClassRef.h" -#include "JavaScriptProfile.h" -#include "jni_utility.h" -#endif - #include "KURL.h" #include "Language.h" -#include "loader.h" #include "LocalizedStrings.h" -#include "MainResourceLoader.h" #include "MIMETypeRegistry.h" +#include "MainResourceLoader.h" #include "Node.h" #include "NotImplemented.h" #include "PageCache.h" @@ -89,6 +77,17 @@ #include "ScrollbarTheme.h" #include "SmartReplace.h" #include "Widget.h" +#include "loader.h" +#include <stdio.h> +#include <stdlib.h> + +#if USE(JSC) +#include "API/JSClassRef.h" +#include "JavaScriptCallFrame.h" +#include "JavaScriptDebugServer.h" +#include "JavaScriptProfile.h" +#include "jni_utility.h" +#endif using namespace WebCore; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h b/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h index d712efb..7e8f2b0 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/BitmapImage.h @@ -140,8 +140,10 @@ public: virtual CGImageRef getCGImageRef(); #endif -#if PLATFORM(WIN) +#if PLATFORM(WIN) || (PLATFORM(QT) && PLATFORM(WIN_OS)) static PassRefPtr<BitmapImage> create(HBITMAP); +#endif +#if PLATFORM(WIN) virtual bool getHBITMAP(HBITMAP); virtual bool getHBITMAPOfSize(HBITMAP, LPSIZE); #endif diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext3D.h b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext3D.h index 67224e2..07ec04d 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext3D.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext3D.h @@ -29,6 +29,7 @@ #include "PlatformString.h" #include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> #if PLATFORM(MAC) #include <OpenGL/OpenGL.h> @@ -74,11 +75,11 @@ namespace WebCore { class GraphicsContext3DInternal; #endif - class GraphicsContext3D : Noncopyable { + class GraphicsContext3D : public Noncopyable { public: enum ShaderType { FRAGMENT_SHADER, VERTEX_SHADER }; - GraphicsContext3D(); + static PassOwnPtr<GraphicsContext3D> create(); virtual ~GraphicsContext3D(); #if PLATFORM(MAC) @@ -92,7 +93,6 @@ namespace WebCore { Platform3DObject platformTexture() const { return NullPlatform3DObject; } #endif void checkError() const; - void makeContextCurrent(); // Helper to return the size in bytes of OpenGL data types @@ -320,6 +320,8 @@ namespace WebCore { void deleteTexture(unsigned); private: + GraphicsContext3D(); + int m_currentWidth, m_currentHeight; #if PLATFORM(MAC) diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp index d196a0c..c8582bb 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp @@ -59,9 +59,7 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) : m_client(client) , m_anchorPoint(0.5f, 0.5f, 0) , m_opacity(1) -#ifndef NDEBUG , m_zPosition(0) -#endif , m_backgroundColorSet(false) , m_contentsOpaque(false) , m_preserves3D(false) @@ -74,9 +72,7 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) , m_contentsOrientation(CompositingCoordinatesTopDown) , m_parent(0) , m_maskLayer(0) -#ifndef NDEBUG , m_repaintCount(0) -#endif { } @@ -229,7 +225,6 @@ void GraphicsLayer::resumeAnimations() { } -#ifndef NDEBUG void GraphicsLayer::updateDebugIndicators() { if (GraphicsLayer::showDebugBorders()) { @@ -251,7 +246,6 @@ void GraphicsLayer::setZPosition(float position) { m_zPosition = position; } -#endif float GraphicsLayer::accumulatedOpacity() const { diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h index e5b17a6..85eace0 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.h @@ -276,10 +276,8 @@ public: void dumpLayer(TextStream&, int indent = 0) const; -#ifndef NDEBUG int repaintCount() const { return m_repaintCount; } int incrementRepaintCount() { return ++m_repaintCount; } -#endif // Report whether the underlying compositing system uses a top-down // or a bottom-up coordinate system. @@ -294,7 +292,6 @@ public: virtual void setContentsOrientation(CompositingCoordinatesOrientation orientation) { m_contentsOrientation = orientation; } CompositingCoordinatesOrientation contentsOrientation() const { return m_contentsOrientation; } -#ifndef NDEBUG static bool showDebugBorders(); static bool showRepaintCounter(); @@ -305,7 +302,6 @@ public: // z-position is the z-equivalent of position(). It's only used for debugging purposes. virtual float zPosition() const { return m_zPosition; } virtual void setZPosition(float); -#endif virtual void distributeOpacity(float); virtual float accumulatedOpacity() const; @@ -342,9 +338,7 @@ protected: Color m_backgroundColor; float m_opacity; -#ifndef NDEBUG float m_zPosition; -#endif bool m_backgroundColorSet : 1; bool m_contentsOpaque : 1; @@ -365,9 +359,7 @@ protected: IntRect m_contentsRect; -#ifndef NDEBUG int m_repaintCount; -#endif }; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/filters/FEColorMatrix.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/filters/FEColorMatrix.cpp index 1e2e552..a2ed9bd 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/filters/FEColorMatrix.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/filters/FEColorMatrix.cpp @@ -30,6 +30,7 @@ #include "GraphicsContext.h" #include "ImageData.h" #include <math.h> +#include <wtf/MathExtras.h> namespace WebCore { @@ -92,8 +93,8 @@ inline void saturate(double& red, double& green, double& blue, const float& s) inline void huerotate(double& red, double& green, double& blue, const float& hue) { - double cosHue = cos(hue * M_PI / 180); - double sinHue = sin(hue * M_PI / 180); + double cosHue = cos(hue * piDouble / 180); + double sinHue = sin(hue * piDouble / 180); double r = red * (0.213 + cosHue * 0.787 - sinHue * 0.213) + green * (0.715 - cosHue * 0.715 - sinHue * 0.715) + blue * (0.072 - cosHue * 0.072 + sinHue * 0.928); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/filters/FEComponentTransfer.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/filters/FEComponentTransfer.cpp index 43e5edd..0d76d8d 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/filters/FEComponentTransfer.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/filters/FEComponentTransfer.cpp @@ -92,11 +92,11 @@ void FEComponentTransfer::setAlphaFunction(const ComponentTransferFunction& func m_alphaFunc = func; } -void identity(unsigned char*, const ComponentTransferFunction&) +static void identity(unsigned char*, const ComponentTransferFunction&) { } -void table(unsigned char* values, const ComponentTransferFunction& transferFunction) +static void table(unsigned char* values, const ComponentTransferFunction& transferFunction) { const Vector<float>& tableValues = transferFunction.tableValues; unsigned n = tableValues.size(); @@ -113,7 +113,7 @@ void table(unsigned char* values, const ComponentTransferFunction& transferFunct } } -void discrete(unsigned char* values, const ComponentTransferFunction& transferFunction) +static void discrete(unsigned char* values, const ComponentTransferFunction& transferFunction) { const Vector<float>& tableValues = transferFunction.tableValues; unsigned n = tableValues.size(); @@ -128,7 +128,7 @@ void discrete(unsigned char* values, const ComponentTransferFunction& transferFu } } -void linear(unsigned char* values, const ComponentTransferFunction& transferFunction) +static void linear(unsigned char* values, const ComponentTransferFunction& transferFunction) { for (unsigned i = 0; i < 256; ++i) { double val = transferFunction.slope * i + 255 * transferFunction.intercept; @@ -137,7 +137,7 @@ void linear(unsigned char* values, const ComponentTransferFunction& transferFunc } } -void gamma(unsigned char* values, const ComponentTransferFunction& transferFunction) +static void gamma(unsigned char* values, const ComponentTransferFunction& transferFunction) { for (unsigned i = 0; i < 256; ++i) { double val = 255.0 * (transferFunction.amplitude * pow((i / 255.0), transferFunction.exponent) + transferFunction.offset); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/filters/FEGaussianBlur.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/filters/FEGaussianBlur.cpp index a62dfdc..f480f10 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/filters/FEGaussianBlur.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/filters/FEGaussianBlur.cpp @@ -30,6 +30,7 @@ #include "GraphicsContext.h" #include "ImageData.h" #include <math.h> +#include <wtf/MathExtras.h> namespace WebCore { @@ -66,10 +67,10 @@ void FEGaussianBlur::setStdDeviationY(float y) m_y = y; } -void boxBlur(CanvasPixelArray*& srcPixelArray, CanvasPixelArray*& dstPixelArray, +static void boxBlur(CanvasPixelArray*& srcPixelArray, CanvasPixelArray*& dstPixelArray, unsigned dx, int stride, int strideLine, int effectWidth, int effectHeight, bool alphaImage) { - int dxLeft = static_cast<int>(floor(dx / 2)); + int dxLeft = dx / 2; int dxRight = dx - dxLeft; for (int y = 0; y < effectHeight; ++y) { @@ -110,8 +111,8 @@ void FEGaussianBlur::apply(Filter* filter) if (m_x == 0 || m_y == 0) return; - unsigned sdx = static_cast<unsigned>(floor(m_x * 3 * sqrt(2 * M_PI) / 4.f + 0.5f)); - unsigned sdy = static_cast<unsigned>(floor(m_y * 3 * sqrt(2 * M_PI) / 4.f + 0.5f)); + unsigned sdx = static_cast<unsigned>(floor(m_x * 3 * sqrt(2 * piDouble) / 4.f + 0.5f)); + unsigned sdy = static_cast<unsigned>(floor(m_y * 3 * sqrt(2 * piDouble) / 4.f + 0.5f)); IntRect effectDrawingRect = calculateDrawingIntRect(m_in->subRegion()); RefPtr<ImageData> srcImageData(m_in->resultImage()->getPremultipliedImageData(effectDrawingRect)); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp index da6ddac..b671107 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp @@ -120,6 +120,38 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const imageObserver()->didDraw(this); } +BitmapImage::BitmapImage(QPixmap* pixmap, ImageObserver* observer) + : Image(observer) + , m_currentFrame(0) + , m_frames(0) + , m_frameTimer(0) + , m_repetitionCount(cAnimationNone) + , m_repetitionCountStatus(Unknown) + , m_repetitionsComplete(0) + , m_isSolidColor(false) + , m_checkedForSolidColor(false) + , m_animationFinished(true) + , m_allDataReceived(true) + , m_haveSize(true) + , m_sizeAvailable(true) + , m_decodedSize(0) + , m_haveFrameCount(true) + , m_frameCount(1) +{ + initPlatformData(); + + int width = pixmap->width(); + int height = pixmap->height(); + m_decodedSize = width * height * 4; + m_size = IntSize(width, height); + + m_frames.grow(1); + m_frames[0].m_frame = pixmap; + m_frames[0].m_hasAlpha = pixmap->hasAlpha(); + m_frames[0].m_haveMetadata = true; + checkForSolidColor(); +} + void BitmapImage::initPlatformData() { } @@ -181,6 +213,13 @@ void BitmapImage::checkForSolidColor() m_solidColor = QColor::fromRgba(framePixmap->toImage().pixel(0, 0)); } +#if PLATFORM(WIN_OS) +PassRefPtr<BitmapImage> BitmapImage::create(HBITMAP hBitmap) +{ + return BitmapImage::create(new QPixmap(QPixmap::fromWinHBITMAP(hBitmap))); +} +#endif + } diff --git a/src/3rdparty/webkit/WebCore/platform/network/Credential.cpp b/src/3rdparty/webkit/WebCore/platform/network/Credential.cpp index caca785..f905743 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/Credential.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/Credential.cpp @@ -32,6 +32,7 @@ namespace WebCore { Credential::Credential() : m_user("") , m_password("") + , m_persistence(CredentialPersistenceNone) { } @@ -44,7 +45,7 @@ Credential::Credential(const String& user, const String& password, CredentialPer { } -bool Credential::isEmpty() +bool Credential::isEmpty() const { return m_user.isEmpty() && m_password.isEmpty(); } diff --git a/src/3rdparty/webkit/WebCore/platform/network/Credential.h b/src/3rdparty/webkit/WebCore/platform/network/Credential.h index ca4a45a..0471fbc 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/Credential.h +++ b/src/3rdparty/webkit/WebCore/platform/network/Credential.h @@ -41,7 +41,7 @@ public: Credential(); Credential(const String& user, const String& password, CredentialPersistence); - bool isEmpty(); + bool isEmpty() const; const String& user() const; const String& password() const; diff --git a/src/3rdparty/webkit/WebCore/platform/network/FormDataBuilder.cpp b/src/3rdparty/webkit/WebCore/platform/network/FormDataBuilder.cpp index 27bdee3..04c7527 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/FormDataBuilder.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/FormDataBuilder.cpp @@ -108,6 +108,34 @@ static inline void append(Vector<char>& buffer, const CString& string) buffer.append(string.data(), string.length()); } +static void appendQuotedString(Vector<char>& buffer, const CString& string) +{ + // Append a string as a quoted value, escaping quotes and line breaks. + // FIXME: Is it correct to use percent escaping here? Other browsers do not encode these characters yet, + // so we should test popular servers to find out if there is an encoding form they can handle. + unsigned length = string.length(); + for (unsigned i = 0; i < length; ++i) { + unsigned char c = string.data()[i]; + + switch (c) { + case 0x0a: + append(buffer, "%0A"); + break; + case 0x0d: + append(buffer, "%0D"); + break; + case '"': + append(buffer, "%22"); + break; + case '%': + append(buffer, "%25"); + break; + default: + append(buffer, c); + } + } +} + Vector<char> FormDataBuilder::generateUniqueBoundaryString() { Vector<char> boundary; @@ -161,8 +189,10 @@ void FormDataBuilder::beginMultiPartHeader(Vector<char>& buffer, const CString& { addBoundaryToMultiPartHeader(buffer, boundary); + // FIXME: This loses data irreversibly if the input name includes characters you can't encode + // in the website's character set. append(buffer, "Content-Disposition: form-data; name=\""); - append(buffer, name); + appendQuotedString(buffer, name); append(buffer, '"'); } @@ -179,12 +209,10 @@ void FormDataBuilder::addBoundaryToMultiPartHeader(Vector<char>& buffer, const C void FormDataBuilder::addFilenameToMultiPartHeader(Vector<char>& buffer, const TextEncoding& encoding, const String& filename) { - // FIXME: This won't work if the filename includes a " mark, - // or control characters like CR or LF. This also does strange - // things if the filename includes characters you can't encode + // FIXME: This loses data irreversibly if the filename includes characters you can't encode // in the website's character set. append(buffer, "; filename=\""); - append(buffer, encoding.encode(filename.characters(), filename.length(), QuestionMarksForUnencodables)); + appendQuotedString(buffer, encoding.encode(filename.characters(), filename.length(), QuestionMarksForUnencodables)); append(buffer, '"'); } diff --git a/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.cpp b/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.cpp index 4c77999..e0707d9 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.cpp @@ -218,6 +218,26 @@ void ResourceRequestBase::setHTTPHeaderField(const AtomicString& name, const Str m_platformRequestUpdated = false; } +void ResourceRequestBase::clearHTTPReferrer() +{ + updateResourceRequest(); + + m_httpHeaderFields.remove("Referer"); + + if (url().protocolInHTTPFamily()) + m_platformRequestUpdated = false; +} + +void ResourceRequestBase::clearHTTPOrigin() +{ + updateResourceRequest(); + + m_httpHeaderFields.remove("Origin"); + + if (url().protocolInHTTPFamily()) + m_platformRequestUpdated = false; +} + void ResourceRequestBase::setResponseContentDispositionEncodingFallbackArray(const String& encoding1, const String& encoding2, const String& encoding3) { updateResourceRequest(); @@ -358,7 +378,7 @@ void ResourceRequestBase::updateResourceRequest() const m_resourceRequestUpdated = true; } -#if !PLATFORM(MAC) && !USE(CFNETWORK) && !USE(SOUP) +#if !PLATFORM(MAC) && !USE(CFNETWORK) && !USE(SOUP) && !PLATFORM(CHROMIUM) unsigned initializeMaximumHTTPConnectionCountPerHost() { // This is used by the loader to control the number of issued parallel load requests. diff --git a/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h b/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h index 348e6b3..84a7bd0 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h +++ b/src/3rdparty/webkit/WebCore/platform/network/ResourceRequestBase.h @@ -88,11 +88,11 @@ namespace WebCore { String httpReferrer() const { return httpHeaderField("Referer"); } void setHTTPReferrer(const String& httpReferrer) { setHTTPHeaderField("Referer", httpReferrer); } - void clearHTTPReferrer() { m_httpHeaderFields.remove("Referer"); } + void clearHTTPReferrer(); String httpOrigin() const { return httpHeaderField("Origin"); } void setHTTPOrigin(const String& httpOrigin) { setHTTPHeaderField("Origin", httpOrigin); } - void clearHTTPOrigin() { m_httpHeaderFields.remove("Origin"); } + void clearHTTPOrigin(); String httpUserAgent() const { return httpHeaderField("User-Agent"); } void setHTTPUserAgent(const String& httpUserAgent) { setHTTPHeaderField("User-Agent", httpUserAgent); } diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 202346d..ed5e024 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -175,8 +175,8 @@ void QNetworkReplyHandler::abort() QNetworkReply* reply = release(); reply->abort(); reply->deleteLater(); - deleteLater(); } + deleteLater(); } QNetworkReply* QNetworkReplyHandler::release() @@ -188,6 +188,7 @@ QNetworkReply* QNetworkReplyHandler::release() // posted meta call events that were the result of a signal emission // don't reach the slots in our instance. QCoreApplication::removePostedEvents(this, QEvent::MetaCall); + m_reply->setParent(0); m_reply = 0; } return reply; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/CursorQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/CursorQt.cpp index aad84be..3fc83f9 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/CursorQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/CursorQt.cpp @@ -2,7 +2,7 @@ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> * Copyright (C) 2006 George Staikos <staikos@kde.org> * Copyright (C) 2006 Charles Samuels <charles@kde.org> - * Copyright (C) 2008 Holger Hans Peter Freyther + * Copyright (C) 2008, 2009 Holger Hans Peter Freyther * * All rights reserved. * @@ -92,14 +92,14 @@ protected: , SplitVCursor(Qt::SplitVCursor) , NoDropCursor(Qt::ForbiddenCursor) , BlankCursor(Qt::BlankCursor) - , ZoomInCursor(QPixmap(QLatin1String(":/webkit/resources/zoomInCursor.png"))) - , ZoomOutCursor(QPixmap(QLatin1String(":/webkit/resources/zoomOutCursor.png"))) - , VerticalTextCursor(QPixmap(QLatin1String(":/webkit/resources/verticalTextCursor.png"))) - , CellCursor(QPixmap(QLatin1String(":/webkit/resources/cellCursor.png"))) - , ContextMenuCursor(QPixmap(QLatin1String(":/webkit/resources/contextMenuCursor.png"))) - , CopyCursor(QPixmap(QLatin1String(":/webkit/resources/copyCursor.png"))) - , ProgressCursor(QPixmap(QLatin1String(":/webkit/resources/progressCursor.png"))) - , AliasCursor(QPixmap(QLatin1String(":/webkit/resources/aliasCursor.png"))) + , ZoomInCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/zoomInCursor.png")), 7, 7)) + , ZoomOutCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/zoomOutCursor.png")), 7, 7)) + , VerticalTextCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/verticalTextCursor.png")), 7, 7)) + , CellCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/cellCursor.png")), 7, 7)) + , ContextMenuCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/contextMenuCursor.png")), 3, 2)) + , CopyCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/copyCursor.png")), 3, 2)) + , ProgressCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/progressCursor.png")), 3, 2)) + , AliasCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/aliasCursor.png")), 11, 3)) #endif { diff --git a/src/3rdparty/webkit/WebCore/platform/qt/WheelEventQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/WheelEventQt.cpp index 66118e1..9cc27ab 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/WheelEventQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/WheelEventQt.cpp @@ -32,11 +32,11 @@ namespace WebCore { void PlatformWheelEvent::applyDelta(int delta, Qt::Orientation orientation) { if (orientation == Qt::Horizontal) { - m_deltaX = (delta / 120); + m_deltaX = (delta / 120.0f); m_deltaY = 0; } else { m_deltaX = 0; - m_deltaY = (delta / 120); + m_deltaY = (delta / 120.0f); } m_wheelTicksX = m_deltaX; diff --git a/src/3rdparty/webkit/WebCore/platform/text/String.cpp b/src/3rdparty/webkit/WebCore/platform/text/String.cpp index bef2674..44582a9 100644 --- a/src/3rdparty/webkit/WebCore/platform/text/String.cpp +++ b/src/3rdparty/webkit/WebCore/platform/text/String.cpp @@ -441,7 +441,7 @@ String String::number(unsigned long n) String String::number(long long n) { -#if PLATFORM(WIN_OS) +#if PLATFORM(WIN_OS) && !PLATFORM(QT) return String::format("%I64i", n); #else return String::format("%lli", n); @@ -450,7 +450,7 @@ String String::number(long long n) String String::number(unsigned long long n) { -#if PLATFORM(WIN_OS) +#if PLATFORM(WIN_OS) && !PLATFORM(QT) return String::format("%I64u", n); #else return String::format("%llu", n); diff --git a/src/3rdparty/webkit/WebCore/platform/win/BitmapInfo.cpp b/src/3rdparty/webkit/WebCore/platform/win/BitmapInfo.cpp new file mode 100644 index 0000000..9a2312c --- /dev/null +++ b/src/3rdparty/webkit/WebCore/platform/win/BitmapInfo.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Brent Fulgham + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "BitmapInfo.h" + +namespace WebCore { + +BitmapInfo bitmapInfoForSize(int width, int height) +{ + BitmapInfo bitmapInfo; + bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bitmapInfo.bmiHeader.biWidth = width; + bitmapInfo.bmiHeader.biHeight = height; + bitmapInfo.bmiHeader.biPlanes = 1; + bitmapInfo.bmiHeader.biBitCount = 32; + bitmapInfo.bmiHeader.biCompression = BI_RGB; + bitmapInfo.bmiHeader.biSizeImage = 0; + bitmapInfo.bmiHeader.biXPelsPerMeter = 0; + bitmapInfo.bmiHeader.biYPelsPerMeter = 0; + bitmapInfo.bmiHeader.biClrUsed = 0; + bitmapInfo.bmiHeader.biClrImportant = 0; + + return bitmapInfo; +} + +BitmapInfo::BitmapInfo() +{ + memset(&bmiHeader, 0, sizeof(bmiHeader)); + bmiHeader.biSize = sizeof(BITMAPINFOHEADER); +} + +BitmapInfo BitmapInfo::create(const IntSize& size) +{ + return bitmapInfoForSize(size.width(), size.height()); +} + +BitmapInfo BitmapInfo::createBottomUp(const IntSize& size) +{ + return bitmapInfoForSize(size.width(), -size.height()); +} + +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollection.cpp b/src/3rdparty/webkit/WebCore/platform/win/BitmapInfo.h index ce2609c..0127fdb 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollection.cpp +++ b/src/3rdparty/webkit/WebCore/platform/win/BitmapInfo.h @@ -1,5 +1,6 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Brent Fulgham * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,10 +11,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -23,13 +24,20 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#include "JSHTMLAllCollection.h" +#ifndef BitmapInfo_h +#define BitmapInfo_h -using namespace JSC; +#include <windows.h> +#include "IntSize.h" namespace WebCore { -const ClassInfo JSHTMLAllCollection::s_info = { "HTMLAllCollection", 0, 0, 0 }; +struct BitmapInfo : public BITMAPINFO { + BitmapInfo (); + static BitmapInfo create(const IntSize&); + static BitmapInfo createBottomUp(const IntSize&); +}; } // namespace WebCore + +#endif // BitmapInfo_h diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginDatabase.cpp b/src/3rdparty/webkit/WebCore/plugins/PluginDatabase.cpp index c7979d1..ea8e4ad 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginDatabase.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/PluginDatabase.cpp @@ -320,7 +320,7 @@ void PluginDatabase::clear() m_preferredPlugins.clear(); } -#if (!PLATFORM(SYMBIAN)) && (!PLATFORM(WIN_OS) || PLATFORM(WX)) +#if (!PLATFORM(WINCE)) && (!PLATFORM(SYMBIAN)) && (!PLATFORM(WIN_OS) || PLATFORM(WX) || !ENABLE(NETSCAPE_PLUGIN_API)) // For Safari/Win the following three methods are implemented // in PluginDatabaseWin.cpp, but if we can use WebCore constructs // for the logic we should perhaps move it here under XP_WIN? @@ -380,7 +380,7 @@ Vector<String> PluginDatabase::defaultPluginDirectories() // Add paths specific to each port #if PLATFORM(QT) Vector<String> qtPaths; - String qtPath(getenv("QTWEBKIT_PLUGIN_PATH")); + String qtPath(qgetenv("QTWEBKIT_PLUGIN_PATH").constData()); qtPath.split(UChar(':'), /* allowEmptyEntries */ false, qtPaths); paths.append(qtPaths); #endif diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp b/src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp index 19337f0..8f2dfa9 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp @@ -319,15 +319,24 @@ bool PluginPackage::equal(const PluginPackage& a, const PluginPackage& b) { return a.m_description == b.m_description; } +#endif int PluginPackage::compareFileVersion(const PlatformModuleVersion& compareVersion) const { // return -1, 0, or 1 if plug-in version is less than, equal to, or greater than // the passed version + +#if PLATFORM(WIN_OS) + if (m_moduleVersion.mostSig != compareVersion.mostSig) + return m_moduleVersion.mostSig > compareVersion.mostSig ? 1 : -1; + if (m_moduleVersion.leastSig != compareVersion.leastSig) + return m_moduleVersion.leastSig > compareVersion.leastSig ? 1 : -1; +#else if (m_moduleVersion != compareVersion) return m_moduleVersion > compareVersion ? 1 : -1; +#endif + return 0; } -#endif } diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp b/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp index 8320bc4..d69f8a7 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp @@ -394,7 +394,7 @@ static bool getString(ScriptController* proxy, JSValue result, String& string) return false; JSLock lock(JSC::SilenceAssertionsOnly); - ExecState* exec = proxy->globalObject()->globalExec(); + ExecState* exec = proxy->globalObject(pluginWorld())->globalExec(); UString ustring = result.toString(exec); exec->clearException(); diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginView.h b/src/3rdparty/webkit/WebCore/plugins/PluginView.h index 1477561..0a57fa6 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginView.h +++ b/src/3rdparty/webkit/WebCore/plugins/PluginView.h @@ -61,6 +61,7 @@ namespace JSC { namespace WebCore { class Element; class Frame; + class Image; class KeyboardEvent; class MouseEvent; class KURL; @@ -226,7 +227,7 @@ namespace WebCore { void invalidateWindowlessPluginRect(const IntRect&); #if PLATFORM(WIN_OS) && !PLATFORM(WX) && ENABLE(NETSCAPE_PLUGIN_API) - void paintWindowedPluginIntoContext(GraphicsContext*, const IntRect&) const; + void paintWindowedPluginIntoContext(GraphicsContext*, const IntRect&); static HDC WINAPI hookedBeginPaint(HWND, PAINTSTRUCT*); static BOOL WINAPI hookedEndPaint(HWND, const PAINTSTRUCT*); #endif @@ -263,6 +264,11 @@ namespace WebCore { void handleFocusOutEvent(); #endif +#if PLATFORM(WIN_OS) + void paintIntoTransformedContext(HDC); + PassRefPtr<Image> snapshot(); +#endif + int m_mode; int m_paramCount; char** m_paramNames; diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp index 28637a1..e61736b 100644 --- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp @@ -178,11 +178,20 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) const bool syncX = m_pluginDisplay && m_pluginDisplay != QX11Info::display(); QPainter* painter = context->platformContext(); + IntRect exposedRect(rect); + exposedRect.intersect(frameRect()); + exposedRect.move(-frameRect().x(), -frameRect().y()); QPixmap qtDrawable = QPixmap::fromX11Pixmap(m_drawable, QPixmap::ExplicitlyShared); const int drawableDepth = ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth; ASSERT(drawableDepth == qtDrawable.depth()); + // When printing, Qt uses a QPicture to capture the output in preview mode. The + // QPicture holds a reference to the X Pixmap. As a result, the print preview would + // update itself when the X Pixmap changes. To prevent this, we create a copy. + if (m_element->document()->printing()) + qtDrawable = qtDrawable.copy(); + if (m_isTransparent && drawableDepth != 32) { // Attempt content propagation for drawable with no alpha by copying over from the backing store QPoint offset; @@ -202,11 +211,11 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) && backingStoreHasUntransformedContents) { GC gc = XDefaultGC(QX11Info::display(), QX11Info::appScreen()); XCopyArea(QX11Info::display(), backingStorePixmap->handle(), m_drawable, gc, - offset.x() + m_windowRect.x() + m_clipRect.x(), offset.y() + m_windowRect.y() + m_clipRect.y(), - m_clipRect.width(), m_clipRect.height(), m_clipRect.x(), m_clipRect.y()); + offset.x() + m_windowRect.x() + exposedRect.x(), offset.y() + m_windowRect.y() + exposedRect.y(), + exposedRect.width(), exposedRect.height(), exposedRect.x(), exposedRect.y()); } else { // no backing store, clean the pixmap because the plugin thinks its transparent QPainter painter(&qtDrawable); - painter.fillRect(m_clipRect, Qt::white); + painter.fillRect(exposedRect, Qt::white); } if (syncX) @@ -218,19 +227,19 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) XGraphicsExposeEvent& exposeEvent = xevent.xgraphicsexpose; exposeEvent.type = GraphicsExpose; exposeEvent.display = QX11Info::display(); - exposeEvent.drawable = m_drawable; - exposeEvent.x = m_clipRect.x(); - exposeEvent.y = m_clipRect.y(); - exposeEvent.width = m_clipRect.x() + m_clipRect.width(); // flash bug? it thinks width is the right - exposeEvent.height = m_clipRect.y() + m_clipRect.height(); // flash bug? it thinks height is the bottom + exposeEvent.drawable = qtDrawable.handle(); + exposeEvent.x = exposedRect.x(); + exposeEvent.y = exposedRect.y(); + exposeEvent.width = exposedRect.x() + exposedRect.width(); // flash bug? it thinks width is the right in transparent mode + exposeEvent.height = exposedRect.y() + exposedRect.height(); // flash bug? it thinks height is the bottom in transparent mode dispatchNPEvent(xevent); if (syncX) XSync(m_pluginDisplay, False); // sync changes by plugin - painter->drawPixmap(frameRect().x() + m_clipRect.x(), frameRect().y() + m_clipRect.y(), qtDrawable, - m_clipRect.x(), m_clipRect.y(), m_clipRect.width(), m_clipRect.height()); + painter->drawPixmap(QPoint(frameRect().x() + exposedRect.x(), frameRect().y() + exposedRect.y()), qtDrawable, + exposedRect); } // TODO: Unify across ports. @@ -630,7 +639,7 @@ NPError PluginView::getValue(NPNVariable variable, void* value) case NPNVnetscapeWindow: { void* w = reinterpret_cast<void*>(value); QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient(); - *((XID *)w) = client ? client->ownerWidget()->winId() : 0; + *((XID *)w) = client ? client->ownerWidget()->window()->winId() : 0; return NPERR_NO_ERROR; } @@ -661,7 +670,7 @@ void PluginView::invalidateRect(NPRect* rect) invalidate(); return; } - IntRect r(rect->left, rect->top, rect->right + rect->left, rect->bottom + rect->top); + IntRect r(rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top); invalidateWindowlessPluginRect(r); } diff --git a/src/3rdparty/webkit/WebCore/plugins/win/PluginPackageWin.cpp b/src/3rdparty/webkit/WebCore/plugins/win/PluginPackageWin.cpp index e6fb9d5..dc9ec17 100644 --- a/src/3rdparty/webkit/WebCore/plugins/win/PluginPackageWin.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/win/PluginPackageWin.cpp @@ -56,17 +56,6 @@ static String getVersionInfo(const LPVOID versionInfoData, const String& info) return String(reinterpret_cast<UChar*>(buffer), bufferLength - 1); } -int PluginPackage::compareFileVersion(const PlatformModuleVersion& compareVersion) const -{ - // return -1, 0, or 1 if plug-in version is less than, equal to, or greater than - // the passed version - if (m_moduleVersion.mostSig != compareVersion.mostSig) - return m_moduleVersion.mostSig > compareVersion.mostSig ? 1 : -1; - if (m_moduleVersion.leastSig != compareVersion.leastSig) - return m_moduleVersion.leastSig > compareVersion.leastSig ? 1 : -1; - return 0; -} - bool PluginPackage::isPluginBlacklisted() { if (name() == "Citrix ICA Client") { diff --git a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp index e1bf8d6..5ccce0e 100644 --- a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp @@ -30,6 +30,7 @@ #include "PluginView.h" #include "BitmapImage.h" +#include "BitmapInfo.h" #include "Document.h" #include "DocumentLoader.h" #include "Element.h" @@ -495,7 +496,54 @@ bool PluginView::dispatchNPEvent(NPEvent& npEvent) return result; } -void PluginView::paintWindowedPluginIntoContext(GraphicsContext* context, const IntRect& rect) const +void PluginView::paintIntoTransformedContext(HDC hdc) +{ + if (m_isWindowed) { + SendMessage(platformPluginWidget(), WM_PRINTCLIENT, reinterpret_cast<WPARAM>(hdc), PRF_CLIENT | PRF_CHILDREN | PRF_OWNED); + return; + } + + m_npWindow.type = NPWindowTypeDrawable; + m_npWindow.window = hdc; + + WINDOWPOS windowpos = { 0 }; + +#if PLATFORM(WINCE) + IntRect r = static_cast<FrameView*>(parent())->contentsToWindow(frameRect()); + + windowpos.x = r.x(); + windowpos.y = r.y(); + windowpos.cx = r.width(); + windowpos.cy = r.height(); +#else + IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(frameRect().location()); + + windowpos.x = p.x(); + windowpos.y = p.y(); + windowpos.cx = frameRect().width(); + windowpos.cy = frameRect().height(); +#endif + + NPEvent npEvent; + npEvent.event = WM_WINDOWPOSCHANGED; + npEvent.lParam = reinterpret_cast<uint32>(&windowpos); + npEvent.wParam = 0; + + dispatchNPEvent(npEvent); + + setNPWindowRect(frameRect()); + + npEvent.event = WM_PAINT; + npEvent.wParam = reinterpret_cast<uint32>(hdc); + + // This is supposed to be a pointer to the dirty rect, but it seems that the Flash plugin + // ignores it so we just pass null. + npEvent.lParam = 0; + + dispatchNPEvent(npEvent); +} + +void PluginView::paintWindowedPluginIntoContext(GraphicsContext* context, const IntRect& rect) { #if !PLATFORM(WINCE) ASSERT(m_isWindowed); @@ -517,7 +565,7 @@ void PluginView::paintWindowedPluginIntoContext(GraphicsContext* context, const SetWorldTransform(hdc, &transform); - SendMessage(platformPluginWidget(), WM_PRINTCLIENT, reinterpret_cast<WPARAM>(hdc), PRF_CLIENT | PRF_CHILDREN | PRF_OWNED); + paintIntoTransformedContext(hdc); SetWorldTransform(hdc, &originalTransform); @@ -547,7 +595,6 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) ASSERT(parent()->isFrameView()); IntRect rectInWindow = static_cast<FrameView*>(parent())->contentsToWindow(frameRect()); HDC hdc = context->getWindowsContext(rectInWindow, m_isTransparent); - NPEvent npEvent; // On Safari/Windows without transparency layers the GraphicsContext returns the HDC // of the window and the plugin expects that the passed in DC has window coordinates. @@ -563,44 +610,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) } #endif - m_npWindow.type = NPWindowTypeDrawable; - m_npWindow.window = hdc; - - WINDOWPOS windowpos; - memset(&windowpos, 0, sizeof(windowpos)); - -#if PLATFORM(WINCE) - IntRect r = static_cast<FrameView*>(parent())->contentsToWindow(frameRect()); - - windowpos.x = r.x(); - windowpos.y = r.y(); - windowpos.cx = r.width(); - windowpos.cy = r.height(); -#else - IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(frameRect().location()); - - windowpos.x = p.x(); - windowpos.y = p.y(); - windowpos.cx = frameRect().width(); - windowpos.cy = frameRect().height(); -#endif - - npEvent.event = WM_WINDOWPOSCHANGED; - npEvent.lParam = reinterpret_cast<uint32>(&windowpos); - npEvent.wParam = 0; - - dispatchNPEvent(npEvent); - - setNPWindowRect(frameRect()); - - npEvent.event = WM_PAINT; - npEvent.wParam = reinterpret_cast<uint32>(hdc); - - // This is supposed to be a pointer to the dirty rect, but it seems that the Flash plugin - // ignores it so we just pass null. - npEvent.lParam = 0; - - dispatchNPEvent(npEvent); + paintIntoTransformedContext(hdc); context->releaseWindowsContext(hdc, frameRect(), m_isTransparent); } @@ -1018,6 +1028,39 @@ void PluginView::platformDestroy() setPlatformPluginWidget(0); } +PassRefPtr<Image> PluginView::snapshot() +{ + OwnPtr<HDC> hdc(CreateCompatibleDC(0)); + + if (!m_isWindowed) { + // Enable world transforms. + SetGraphicsMode(hdc.get(), GM_ADVANCED); + + XFORM transform; + GetWorldTransform(hdc.get(), &transform); + + // Windowless plug-ins assume that they're drawing onto the view's DC. + // Translate the context so that the plug-in draws at (0, 0). + ASSERT(parent()->isFrameView()); + IntPoint position = static_cast<FrameView*>(parent())->contentsToWindow(frameRect()).location(); + transform.eDx = -position.x(); + transform.eDy = -position.y(); + SetWorldTransform(hdc.get(), &transform); + } + + void* bits; + BitmapInfo bmp = BitmapInfo::createBottomUp(frameRect().size()); + OwnPtr<HBITMAP> hbmp(CreateDIBSection(0, &bmp, DIB_RGB_COLORS, &bits, 0, 0)); + + HBITMAP hbmpOld = static_cast<HBITMAP>(SelectObject(hdc.get(), hbmp.get())); + + paintIntoTransformedContext(hdc.get()); + + SelectObject(hdc.get(), hbmpOld); + + return BitmapImage::create(hbmp.get()); +} + void PluginView::halt() { ASSERT(!m_isHalted); @@ -1025,8 +1068,7 @@ void PluginView::halt() #if !PLATFORM(QT) // Show a screenshot of the plug-in. - OwnPtr<HBITMAP> nodeImage(m_parentFrame->nodeImage(m_element)); - toRenderWidget(m_element->renderer())->showSubstituteImage(BitmapImage::create(nodeImage.get())); + toRenderWidget(m_element->renderer())->showSubstituteImage(snapshot()); #endif m_isHalted = true; diff --git a/src/3rdparty/webkit/WebCore/rendering/HitTestResult.cpp b/src/3rdparty/webkit/WebCore/rendering/HitTestResult.cpp index 0aaddc9..50933c6 100644 --- a/src/3rdparty/webkit/WebCore/rendering/HitTestResult.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/HitTestResult.cpp @@ -123,17 +123,6 @@ Frame* HitTestResult::targetFrame() const return frame->tree()->find(m_innerURLElement->target()); } -IntRect HitTestResult::boundingBox() const -{ - if (m_innerNonSharedNode) { - RenderObject* renderer = m_innerNonSharedNode->renderer(); - if (renderer) - return renderer->absoluteBoundingBoxRect(); - } - - return IntRect(); -} - bool HitTestResult::isSelected() const { if (!m_innerNonSharedNode) @@ -246,7 +235,7 @@ IntRect HitTestResult::imageRect() const { if (!image()) return IntRect(); - return m_innerNonSharedNode->renderBox()->absoluteContentBox(); + return m_innerNonSharedNode->renderBox()->absoluteContentQuad().enclosingBoundingBox(); } KURL HitTestResult::absoluteImageURL() const diff --git a/src/3rdparty/webkit/WebCore/rendering/HitTestResult.h b/src/3rdparty/webkit/WebCore/rendering/HitTestResult.h index f29ca41..25e1058 100644 --- a/src/3rdparty/webkit/WebCore/rendering/HitTestResult.h +++ b/src/3rdparty/webkit/WebCore/rendering/HitTestResult.h @@ -63,7 +63,6 @@ public: void setIsOverWidget(bool b) { m_isOverWidget = b; } Frame* targetFrame() const; - IntRect boundingBox() const; bool isSelected() const; String spellingToolTip(TextDirection&) const; String replacedString() const; diff --git a/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp b/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp index 73b9a3a..9611660 100644 --- a/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp @@ -646,6 +646,15 @@ void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) } } +void MediaControlVolumeSliderElement::update() +{ + float volume = m_mediaElement->volume(); + if (value().toFloat() != volume) { + setValue(String::number(volume)); + MediaControlInputElement::update(); + } +} + // ---------------------------- MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Document* document, HTMLMediaElement* element) diff --git a/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.h b/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.h index e562bb5..8b297733 100644 --- a/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.h +++ b/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.h @@ -234,6 +234,7 @@ class MediaControlVolumeSliderElement : public MediaControlInputElement { public: MediaControlVolumeSliderElement(Document*, HTMLMediaElement*); virtual void defaultEventHandler(Event*); + virtual void update(); }; // ---------------------------- diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBox.h b/src/3rdparty/webkit/WebCore/rendering/RenderBox.h index 41c5622..9050dcb 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderBox.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderBox.h @@ -318,7 +318,7 @@ protected: virtual bool shouldCalculateSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); } - virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const; + virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&) const; virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; private: diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderInline.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderInline.cpp index 05d29d0..0302113 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderInline.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderInline.cpp @@ -30,6 +30,7 @@ #include "RenderArena.h" #include "RenderBlock.h" #include "RenderView.h" +#include "TransformState.h" #include "VisiblePosition.h" #if ENABLE(DASHBOARD_SUPPORT) @@ -705,6 +706,92 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, o->computeRectForRepaint(repaintContainer, rect, fixed); } +IntSize RenderInline::offsetFromContainer(RenderObject* container) const +{ + ASSERT(container == this->container()); + + IntSize offset; + if (isRelPositioned()) + offset += relativePositionOffset(); + + if (!isInline() || isReplaced()) { + RenderBlock* cb; + if (container->isBlockFlow() && (cb = toRenderBlock(container))->hasColumns()) { + IntRect rect(0, 0, 1, 1); + cb->adjustRectForColumns(rect); + } + } + + if (container->hasOverflowClip()) + offset -= toRenderBox(container)->layer()->scrolledContentOffset(); + + return offset; +} + +void RenderInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState) const +{ + if (repaintContainer == this) + return; + + if (RenderView *v = view()) { + if (v->layoutStateEnabled() && !repaintContainer) { + LayoutState* layoutState = v->layoutState(); + IntSize offset = layoutState->m_offset; + if (style()->position() == RelativePosition && layer()) + offset += layer()->relativePositionOffset(); + transformState.move(offset); + return; + } + } + + bool containerSkipped; + RenderObject* o = container(repaintContainer, &containerSkipped); + if (!o) + return; + + IntSize containerOffset = offsetFromContainer(o); + + bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D()); + if (useTransforms && shouldUseTransformFromContainer(o)) { + TransformationMatrix t; + getTransformFromContainer(o, containerOffset, t); + transformState.applyTransform(t, preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); + } else + transformState.move(containerOffset.width(), containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); + + if (containerSkipped) { + // There can't be a transform between repaintContainer and o, because transforms create containers, so it should be safe + // to just subtract the delta between the repaintContainer and o. + IntSize containerOffset = repaintContainer->offsetFromAncestorContainer(o); + transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); + return; + } + + o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState); +} + +void RenderInline::mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState& transformState) const +{ + // We don't expect this function to be called during layout. + ASSERT(!view() || !view()->layoutStateEnabled()); + + RenderObject* o = container(); + if (!o) + return; + + o->mapAbsoluteToLocalPoint(fixed, useTransforms, transformState); + + IntSize containerOffset = offsetFromContainer(o); + + bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D()); + if (useTransforms && shouldUseTransformFromContainer(o)) { + TransformationMatrix t; + getTransformFromContainer(o, containerOffset, t); + transformState.applyTransform(t, preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); + } else + transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); +} + void RenderInline::updateDragState(bool dragOn) { RenderBoxModelObject::updateDragState(dragOn); diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderInline.h b/src/3rdparty/webkit/WebCore/rendering/RenderInline.h index 8e0064e..8e9715c 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderInline.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderInline.h @@ -44,6 +44,8 @@ public: virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); virtual void absoluteQuads(Vector<FloatQuad>&); + virtual IntSize offsetFromContainer(RenderObject*) const; + IntRect linesBoundingBox() const; IntRect linesVisibleOverflowBoundingBox() const; @@ -107,6 +109,9 @@ private: virtual IntRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, int outlineWidth); virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& rect, bool fixed); + virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&) const; + virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; + virtual VisiblePosition positionForPoint(const IntPoint&); virtual IntRect borderBoundingBox() const diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderMedia.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderMedia.cpp index 1da2628..1d4da23 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderMedia.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderMedia.cpp @@ -258,6 +258,7 @@ void RenderMedia::createVolumeSlider() m_volumeSlider = new MediaControlVolumeSliderElement(document(), mediaElement()); m_volumeSlider->setAttribute(precisionAttr, "float"); m_volumeSlider->setAttribute(maxAttr, "1"); + m_volumeSlider->setAttribute(valueAttr, String::number(mediaElement()->volume())); m_volumeSlider->attachToParent(m_volumeSliderContainer.get()); } diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderMediaControlsChromium.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderMediaControlsChromium.cpp index ed20ecf..56fbec4 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderMediaControlsChromium.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderMediaControlsChromium.cpp @@ -54,6 +54,12 @@ static Image* platformResource(const char* name) return 0; } +static bool hasSource(const HTMLMediaElement* mediaElement) +{ + return mediaElement->networkState() != HTMLMediaElement::NETWORK_EMPTY + && mediaElement->networkState() != HTMLMediaElement::NETWORK_NO_SOURCE; +} + static bool paintMediaButton(GraphicsContext* context, const IntRect& rect, Image* image) { IntRect imageRect = image->rect(); @@ -71,7 +77,7 @@ static bool paintMediaMuteButton(RenderObject* object, const RenderObject::Paint static Image* soundNone = platformResource("mediaSoundNone"); static Image* soundDisabled = platformResource("mediaSoundDisabled"); - if (mediaElement->networkState() == HTMLMediaElement::NETWORK_NO_SOURCE || !mediaElement->hasAudio()) + if (!hasSource(mediaElement) || !mediaElement->hasAudio()) return paintMediaButton(paintInfo.context, rect, soundDisabled); return paintMediaButton(paintInfo.context, rect, mediaElement->muted() ? soundNone: soundFull); @@ -87,8 +93,7 @@ static bool paintMediaPlayButton(RenderObject* object, const RenderObject::Paint static Image* mediaPause = platformResource("mediaPause"); static Image* mediaPlayDisabled = platformResource("mediaPlayDisabled"); - if (mediaElement->networkState() == HTMLMediaElement::NETWORK_EMPTY || - mediaElement->networkState() == HTMLMediaElement::NETWORK_NO_SOURCE) + if (!hasSource(mediaElement)) return paintMediaButton(paintInfo.context, rect, mediaPlayDisabled); return paintMediaButton(paintInfo.context, rect, mediaElement->paused() ? mediaPlay : mediaPause); @@ -147,6 +152,13 @@ static bool paintMediaSliderThumb(RenderObject* object, const RenderObject::Pain if (!object->parent()->isSlider()) return false; + HTMLMediaElement* mediaElement = toParentMediaElement(object->parent()); + if (!mediaElement) + return false; + + if (!hasSource(mediaElement)) + return true; + static Image* mediaSliderThumb = platformResource("mediaSliderThumb"); return paintMediaButton(paintInfo.context, rect, mediaSliderThumb); } @@ -228,6 +240,8 @@ bool RenderMediaControlsChromium::shouldRenderMediaControlPart(ControlPart part, case MediaCurrentTimePart: case MediaTimeRemainingPart: return true; + default: + ; } return false; } @@ -258,6 +272,9 @@ bool RenderMediaControlsChromium::paintMediaControlsPart(MediaControlElementType case MediaCurrentTimeDisplay: case MediaTimeRemainingDisplay: case MediaControlsPanel: + case MediaRewindButton: + case MediaReturnToRealtimeButton: + case MediaStatusDisplay: ASSERT_NOT_REACHED(); break; } diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp index 20503f3..4b38d53 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderThemeChromiumWin.cpp @@ -611,21 +611,11 @@ bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o, const IntRect& r, bool drawEdges) { - // Nasty hack to make us not paint the border on text fields with a - // border-radius. Webkit paints elements with border-radius for us. - // FIXME: Get rid of this if-check once we can properly clip rounded - // borders: http://b/1112604 and http://b/1108635 - // FIXME: make sure we do the right thing if css background-clip is set. - if (o->style()->hasBorderRadius()) - return false; - - const ThemeData& themeData = getThemeData(o); - // Fallback to white if the specified color object is invalid. + // (Note ChromiumBridge::paintTextField duplicates this check). Color backgroundColor(Color::white); - if (o->style()->backgroundColor().isValid()) { + if (o->style()->backgroundColor().isValid()) backgroundColor = o->style()->backgroundColor(); - } // If we have background-image, don't fill the content area to expose the // parent's background. Also, we shouldn't fill the content area if the @@ -634,17 +624,32 @@ bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o, // Note that we should paint the content area white if we have neither the // background color nor background image explicitly specified to keep the // appearance of select element consistent with other browsers. - bool fillContentArea = !o->style()->hasBackgroundImage() && backgroundColor.alpha() != 0; - - WebCore::ThemePainter painter(i.context, r); - ChromiumBridge::paintTextField(painter.context(), - themeData.m_part, - themeData.m_state, - themeData.m_classicState, - painter.drawRect(), - backgroundColor, - fillContentArea, - drawEdges); + bool fillContentArea = !o->style()->hasBackgroundImage() && backgroundColor.alpha(); + + if (o->style()->hasBorderRadius()) { + // If the style has rounded borders, setup the context to clip the + // background (themed or filled) appropriately. + // FIXME: make sure we do the right thing if css background-clip is set. + i.context->save(); + IntSize topLeft, topRight, bottomLeft, bottomRight; + o->style()->getBorderRadiiForRect(r, topLeft, topRight, bottomLeft, bottomRight); + i.context->addRoundedRectClip(r, topLeft, topRight, bottomLeft, bottomRight); + } + { + const ThemeData& themeData = getThemeData(o); + WebCore::ThemePainter painter(i.context, r); + ChromiumBridge::paintTextField(painter.context(), + themeData.m_part, + themeData.m_state, + themeData.m_classicState, + painter.drawRect(), + backgroundColor, + fillContentArea, + drawEdges); + // End of block commits the painter before restoring context. + } + if (o->style()->hasBorderRadius()) + i.context->restore(); return false; } diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderTreeAsText.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderTreeAsText.cpp index 5c6e738..b7ab191 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderTreeAsText.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderTreeAsText.cpp @@ -28,6 +28,7 @@ #include "CSSMutableStyleDeclaration.h" #include "CharacterNames.h" +#include "CString.h" #include "Document.h" #include "Frame.h" #include "FrameView.h" @@ -553,4 +554,31 @@ String externalRepresentation(RenderObject* o) return ts.release(); } +static void writeCounterValuesFromChildren(TextStream& stream, RenderObject* parent) +{ + for (RenderObject* child = parent->firstChild(); child; child = child->nextSibling()) { + if (child->isCounter()) { + String str(toRenderText(child)->text()); + stream << str; + } + } +} + +String counterValueForElement(Element* element) +{ + // Make sure the element is not freed during the layout. + RefPtr<Element> elementRef(element); + element->document()->updateLayout(); + TextStream stream; + // The counter renderers should be children of anonymous children + // (i.e., :before or :after pseudo-elements). + if (RenderObject* renderer = element->renderer()) { + for (RenderObject* child = renderer->firstChild(); child; child = child->nextSibling()) { + if (child->isAnonymous()) + writeCounterValuesFromChildren(stream, child); + } + } + return stream.release(); +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderTreeAsText.h b/src/3rdparty/webkit/WebCore/rendering/RenderTreeAsText.h index daca253..325f109 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderTreeAsText.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderTreeAsText.h @@ -28,15 +28,18 @@ namespace WebCore { - class RenderObject; - class String; - class TextStream; +class Element; +class RenderObject; +class String; +class TextStream; - String externalRepresentation(RenderObject*); - void write(TextStream&, const RenderObject&, int indent = 0); +String externalRepresentation(RenderObject*); +void write(TextStream&, const RenderObject&, int indent = 0); - // Helper function shared with SVGRenderTreeAsText - String quoteAndEscapeNonPrintables(const String&); +// Helper function shared with SVGRenderTreeAsText +String quoteAndEscapeNonPrintables(const String&); + +String counterValueForElement(Element*); } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/rendering/SVGRenderSupport.cpp b/src/3rdparty/webkit/WebCore/rendering/SVGRenderSupport.cpp index 0f295e4..ea087f9 100644 --- a/src/3rdparty/webkit/WebCore/rendering/SVGRenderSupport.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/SVGRenderSupport.cpp @@ -94,6 +94,9 @@ void SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject paintInfo.context->beginTransparencyLayer(opacity); } + if (ShadowData* shadow = svgStyle->shadow()) + paintInfo.context->setShadow(IntSize(shadow->x, shadow->y), shadow->blur, shadow->color); + #if ENABLE(FILTERS) AtomicString filterId(svgStyle->filter()); #endif diff --git a/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.cpp b/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.cpp index 1289b06..e8827c4 100644 --- a/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.cpp @@ -51,6 +51,7 @@ SVGRenderStyle::SVGRenderStyle() mask = defaultStyle->mask; misc = defaultStyle->misc; markers = defaultStyle->markers; + shadowSVG = defaultStyle->shadowSVG; setBitDefaults(); } @@ -67,6 +68,7 @@ SVGRenderStyle::SVGRenderStyle(CreateDefaultType) mask.init(); misc.init(); markers.init(); + shadowSVG.init(); } SVGRenderStyle::SVGRenderStyle(const SVGRenderStyle& other) @@ -80,6 +82,7 @@ SVGRenderStyle::SVGRenderStyle(const SVGRenderStyle& other) mask = other.mask; misc = other.misc; markers = other.markers; + shadowSVG = other.shadowSVG; svg_inherited_flags = other.svg_inherited_flags; svg_noninherited_flags = other.svg_noninherited_flags; @@ -93,7 +96,7 @@ bool SVGRenderStyle::operator==(const SVGRenderStyle& o) const { return (fill == o.fill && stroke == o.stroke && text == o.text && stops == o.stops && clip == o.clip && mask == o.mask && - misc == o.misc && markers == o.markers && + misc == o.misc && markers == o.markers && shadowSVG == o.shadowSVG && svg_inherited_flags == o.svg_inherited_flags && svg_noninherited_flags == o.svg_noninherited_flags); } diff --git a/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.h b/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.h index e50d349..12477d7 100644 --- a/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.h +++ b/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.h @@ -30,6 +30,7 @@ #include "GraphicsTypes.h" #include "SVGPaint.h" #include "SVGRenderStyleDefs.h" +#include "ShadowData.h" #include <wtf/Platform.h> @@ -98,6 +99,8 @@ namespace WebCore { SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, lightingColor, LightingColor, lightingColor, Color(255, 255, 255)) SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, misc, baselineShiftValue, BaselineShiftValue, baselineShiftValue, 0) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_OWNPTR(ShadowData, shadowSVG, shadow, Shadow, shadow, 0) + // convenience bool hasStroke() const { return (strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE); } bool hasFill() const { return (fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE); } @@ -172,6 +175,7 @@ namespace WebCore { DataRef<StyleClipData> clip; DataRef<StyleMaskData> mask; DataRef<StyleMiscData> misc; + DataRef<StyleShadowSVGData> shadowSVG; private: enum CreateDefaultType { CreateDefault }; diff --git a/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.cpp b/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.cpp index f5faad3..2ed1d8f 100644 --- a/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.cpp @@ -213,6 +213,25 @@ bool StyleMiscData::operator==(const StyleMiscData &other) const && baselineShiftValue == other.baselineShiftValue; } +StyleShadowSVGData::StyleShadowSVGData() +{ +} + +StyleShadowSVGData::StyleShadowSVGData(const StyleShadowSVGData& other) + : RefCounted<StyleShadowSVGData>() + , shadow(other.shadow ? new ShadowData(*other.shadow) : 0) +{ +} + +bool StyleShadowSVGData::operator==(const StyleShadowSVGData& other) const +{ + if ((!shadow && other.shadow) || (shadow && !other.shadow)) + return false; + if (shadow && other.shadow && (*shadow != *other.shadow)) + return false; + return true; +} + #endif // ENABLE(SVG) // vim:ts=4:noet diff --git a/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.h b/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.h index c0f5d4e..f4cf932 100644 --- a/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.h +++ b/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyleDefs.h @@ -33,6 +33,9 @@ #include "Color.h" #include "Path.h" #include "PlatformString.h" +#include "ShadowData.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -65,6 +68,13 @@ } \ static Data* initial##Type() { return Initial; } +#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_OWNPTR(Data, Group, Variable, Type, Name, Initial) \ + Data* Name() const { return Group->Variable.get(); } \ + void set##Type(Data* obj) { \ + Group.access()->Variable.set(obj); \ + } \ + static Data* initial##Type() { return Initial; } + #define SVG_RS_SET_VARIABLE(Group, Variable, Value) \ if (!(Group->Variable == Value)) \ Group.access()->Variable = Value; @@ -279,6 +289,24 @@ namespace WebCore { StyleMiscData(); StyleMiscData(const StyleMiscData&); }; + + class StyleShadowSVGData : public RefCounted<StyleShadowSVGData> { + public: + static PassRefPtr<StyleShadowSVGData> create() { return adoptRef(new StyleShadowSVGData); } + PassRefPtr<StyleShadowSVGData> copy() const { return adoptRef(new StyleShadowSVGData(*this)); } + + bool operator==(const StyleShadowSVGData& other) const; + bool operator!=(const StyleShadowSVGData& other) const + { + return !(*this == other); + } + + OwnPtr<ShadowData> shadow; + + private: + StyleShadowSVGData(); + StyleShadowSVGData(const StyleShadowSVGData& other); + }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/storage/Database.cpp b/src/3rdparty/webkit/WebCore/storage/Database.cpp index 08ea289..5aaa26f 100644 --- a/src/3rdparty/webkit/WebCore/storage/Database.cpp +++ b/src/3rdparty/webkit/WebCore/storage/Database.cpp @@ -46,6 +46,7 @@ #include "NotImplemented.h" #include "Page.h" #include "OriginQuotaManager.h" +#include "ScriptController.h" #include "SQLiteDatabase.h" #include "SQLiteFileSystem.h" #include "SQLiteStatement.h" @@ -57,7 +58,6 @@ #if USE(JSC) #include "JSDOMWindow.h" -#include <runtime/InitializeThreading.h> #endif namespace WebCore { @@ -128,7 +128,7 @@ PassRefPtr<Database> Database::openDatabase(Document* document, const String& na return 0; } - RefPtr<Database> database = adoptRef(new Database(document, name, expectedVersion)); + RefPtr<Database> database = adoptRef(new Database(document, name, expectedVersion, displayName, estimatedSize)); if (!database->openAndVerifyVersion(e)) { LOG(StorageAPI, "Failed to open and verify version (expected %s) of database %s", expectedVersion.ascii().data(), database->databaseDebugName().ascii().data()); @@ -147,27 +147,28 @@ PassRefPtr<Database> Database::openDatabase(Document* document, const String& na return database; } -Database::Database(Document* document, const String& name, const String& expectedVersion) +Database::Database(Document* document, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize) : m_transactionInProgress(false) , m_document(document) , m_name(name.crossThreadString()) , m_guid(0) , m_expectedVersion(expectedVersion) + , m_displayName(displayName) + , m_estimatedSize(estimatedSize) , m_deleted(false) , m_stopped(false) , m_opened(false) { ASSERT(document); - m_securityOrigin = document->securityOrigin(); + m_mainThreadSecurityOrigin = document->securityOrigin(); + m_databaseThreadSecurityOrigin = m_mainThreadSecurityOrigin->threadsafeCopy(); if (m_name.isNull()) m_name = ""; -#if USE(JSC) - JSC::initializeThreading(); -#endif + ScriptController::initializeThreading(); - m_guid = guidForOriginAndName(m_securityOrigin->toString(), name); + m_guid = guidForOriginAndName(m_mainThreadSecurityOrigin->toString(), name); { MutexLocker locker(guidMutex()); @@ -183,7 +184,7 @@ Database::Database(Document* document, const String& name, const String& expecte ASSERT(m_document->databaseThread()); - m_filename = DatabaseTracker::tracker().fullPathForDatabase(m_securityOrigin.get(), m_name); + m_filename = DatabaseTracker::tracker().fullPathForDatabase(m_mainThreadSecurityOrigin.get(), m_name); DatabaseTracker::tracker().addOpenDatabase(this); m_document->addOpenDatabase(this); @@ -366,20 +367,9 @@ void Database::stop() } } -unsigned long long Database::databaseSize() const -{ - return SQLiteFileSystem::getDatabaseFileSize(m_filename); -} - unsigned long long Database::maximumSize() const { - // The maximum size for this database is the full quota for this origin, minus the current usage within this origin, - // except for the current usage of this database - - OriginQuotaManager& manager(DatabaseTracker::tracker().originQuotaManager()); - Locker<OriginQuotaManager> locker(manager); - - return DatabaseTracker::tracker().quotaForOrigin(m_securityOrigin.get()) - manager.diskUsage(m_securityOrigin.get()) + databaseSize(); + return DatabaseTracker::tracker().getMaxSizeForDatabase(this); } void Database::disableAuthorizer() @@ -647,9 +637,13 @@ void Database::setExpectedVersion(const String& version) updateGuidVersionMap(m_guid, version); } -PassRefPtr<SecurityOrigin> Database::securityOriginCopy() const +SecurityOrigin* Database::securityOrigin() const { - return m_securityOrigin->threadsafeCopy(); + if (isMainThread()) + return m_mainThreadSecurityOrigin.get(); + if (currentThread() == document()->databaseThread()->getThreadID()) + return m_databaseThreadSecurityOrigin.get(); + return 0; } String Database::stringIdentifier() const @@ -658,6 +652,23 @@ String Database::stringIdentifier() const return m_name.threadsafeCopy(); } +String Database::displayName() const +{ + // Return a deep copy for ref counting thread safety + return m_displayName.threadsafeCopy(); +} + +unsigned long Database::estimatedSize() const +{ + return m_estimatedSize; +} + +String Database::fileName() const +{ + // Return a deep copy for ref counting thread safety + return m_filename.threadsafeCopy(); +} + #endif } diff --git a/src/3rdparty/webkit/WebCore/storage/Database.h b/src/3rdparty/webkit/WebCore/storage/Database.h index b850686..f275027 100644 --- a/src/3rdparty/webkit/WebCore/storage/Database.h +++ b/src/3rdparty/webkit/WebCore/storage/Database.h @@ -89,8 +89,11 @@ public: Vector<String> tableNames(); Document* document() const { return m_document.get(); } - PassRefPtr<SecurityOrigin> securityOriginCopy() const; + SecurityOrigin* securityOrigin() const; String stringIdentifier() const; + String displayName() const; + unsigned long estimatedSize() const; + String fileName() const; bool getVersionFromDatabase(String&); bool setVersionInDatabase(const String&); @@ -121,7 +124,8 @@ public: SQLTransactionCoordinator* transactionCoordinator() const; private: - Database(Document* document, const String& name, const String& expectedVersion); + Database(Document* document, const String& name, const String& expectedVersion, + const String& displayName, unsigned long estimatedSize); bool openAndVerifyVersion(ExceptionCode&); @@ -136,10 +140,13 @@ private: static void deliverPendingCallback(void*); RefPtr<Document> m_document; - RefPtr<SecurityOrigin> m_securityOrigin; + RefPtr<SecurityOrigin> m_mainThreadSecurityOrigin; + RefPtr<SecurityOrigin> m_databaseThreadSecurityOrigin; String m_name; int m_guid; String m_expectedVersion; + String m_displayName; + unsigned long m_estimatedSize; String m_filename; bool m_deleted; @@ -152,7 +159,7 @@ private: RefPtr<DatabaseAuthorizer> m_databaseAuthorizer; #ifndef NDEBUG - String databaseDebugName() const { return m_securityOrigin->toString() + "::" + m_name; } + String databaseDebugName() const { return m_mainThreadSecurityOrigin->toString() + "::" + m_name; } #endif }; diff --git a/src/3rdparty/webkit/WebCore/storage/DatabaseThread.cpp b/src/3rdparty/webkit/WebCore/storage/DatabaseThread.cpp index 9e3afdd..40c83ee 100644 --- a/src/3rdparty/webkit/WebCore/storage/DatabaseThread.cpp +++ b/src/3rdparty/webkit/WebCore/storage/DatabaseThread.cpp @@ -152,22 +152,20 @@ void DatabaseThread::scheduleImmediateTask(PassRefPtr<DatabaseTask> task) m_queue.prepend(task); } +class SameDatabasePredicate { +public: + SameDatabasePredicate(const Database* database) : m_database(database) { } + bool operator()(RefPtr<DatabaseTask>& task) const { return task->database() == m_database; } +private: + const Database* m_database; +}; + void DatabaseThread::unscheduleDatabaseTasks(Database* database) { // Note that the thread loop is running, so some tasks for the database // may still be executed. This is unavoidable. - - Deque<RefPtr<DatabaseTask> > filteredReverseQueue; - RefPtr<DatabaseTask> task; - while (m_queue.tryGetMessage(task)) { - if (task->database() != database) - filteredReverseQueue.append(task); - } - - while (!filteredReverseQueue.isEmpty()) { - m_queue.append(filteredReverseQueue.first()); - filteredReverseQueue.removeFirst(); - } + SameDatabasePredicate predicate(database); + m_queue.removeIf(predicate); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/storage/DatabaseTracker.cpp b/src/3rdparty/webkit/WebCore/storage/DatabaseTracker.cpp index 265cd0d..c0c4242 100644 --- a/src/3rdparty/webkit/WebCore/storage/DatabaseTracker.cpp +++ b/src/3rdparty/webkit/WebCore/storage/DatabaseTracker.cpp @@ -33,6 +33,7 @@ #include "ChromeClient.h" #include "Database.h" +#include "DatabaseThread.h" #include "DatabaseTrackerClient.h" #include "Document.h" #include "Logging.h" @@ -182,6 +183,16 @@ bool DatabaseTracker::hasEntryForDatabase(SecurityOrigin* origin, const String& return statement.step() == SQLResultRow; } +unsigned long long DatabaseTracker::getMaxSizeForDatabase(const Database* database) +{ + ASSERT(currentThread() == database->document()->databaseThread()->getThreadID()); + // The maximum size for a database is the full quota for its origin, minus the current usage within the origin, + // plus the current usage of the given database + Locker<OriginQuotaManager> locker(originQuotaManager()); + SecurityOrigin* origin = database->securityOrigin(); + return quotaForOrigin(origin) - originQuotaManager().diskUsage(origin) + SQLiteFileSystem::getDatabaseFileSize(database->fileName()); +} + String DatabaseTracker::originPath(SecurityOrigin* origin) const { ASSERT(currentThread() == m_thread); @@ -409,13 +420,11 @@ void DatabaseTracker::addOpenDatabase(Database* database) if (!m_openDatabaseMap) m_openDatabaseMap.set(new DatabaseOriginMap); - RefPtr<SecurityOrigin> origin(database->securityOriginCopy()); String name(database->stringIdentifier()); - - DatabaseNameMap* nameMap = m_openDatabaseMap->get(origin); + DatabaseNameMap* nameMap = m_openDatabaseMap->get(database->securityOrigin()); if (!nameMap) { nameMap = new DatabaseNameMap; - m_openDatabaseMap->set(origin, nameMap); + m_openDatabaseMap->set(database->securityOrigin(), nameMap); } DatabaseSet* databaseSet = nameMap->get(name); @@ -441,10 +450,8 @@ void DatabaseTracker::removeOpenDatabase(Database* database) return; } - RefPtr<SecurityOrigin> origin(database->securityOriginCopy()); String name(database->stringIdentifier()); - - DatabaseNameMap* nameMap = m_openDatabaseMap->get(origin); + DatabaseNameMap* nameMap = m_openDatabaseMap->get(database->securityOrigin()); if (!nameMap) { ASSERT_NOT_REACHED(); return; @@ -469,7 +476,7 @@ void DatabaseTracker::removeOpenDatabase(Database* database) if (!nameMap->isEmpty()) return; - m_openDatabaseMap->remove(origin); + m_openDatabaseMap->remove(database->securityOrigin()); delete nameMap; } diff --git a/src/3rdparty/webkit/WebCore/storage/DatabaseTracker.h b/src/3rdparty/webkit/WebCore/storage/DatabaseTracker.h index 2f6e06d..85e4858 100644 --- a/src/3rdparty/webkit/WebCore/storage/DatabaseTracker.h +++ b/src/3rdparty/webkit/WebCore/storage/DatabaseTracker.h @@ -86,6 +86,8 @@ public: bool hasEntryForOrigin(SecurityOrigin*); + unsigned long long getMaxSizeForDatabase(const Database*); + private: DatabaseTracker(); diff --git a/src/3rdparty/webkit/WebCore/storage/OriginQuotaManager.cpp b/src/3rdparty/webkit/WebCore/storage/OriginQuotaManager.cpp index 20bb34d..30b3271 100644 --- a/src/3rdparty/webkit/WebCore/storage/OriginQuotaManager.cpp +++ b/src/3rdparty/webkit/WebCore/storage/OriginQuotaManager.cpp @@ -104,8 +104,7 @@ void OriginQuotaManager::markDatabase(Database* database) { ASSERT(database); ASSERT(m_usageRecordGuardLocked); - RefPtr<SecurityOrigin> origin = database->securityOriginCopy(); - OriginUsageRecord* usageRecord = m_usageMap.get(origin); + OriginUsageRecord* usageRecord = m_usageMap.get(database->securityOrigin()); ASSERT(usageRecord); usageRecord->markDatabase(database->stringIdentifier()); diff --git a/src/3rdparty/webkit/WebCore/storage/SQLTransaction.cpp b/src/3rdparty/webkit/WebCore/storage/SQLTransaction.cpp index 149b384..165685b 100644 --- a/src/3rdparty/webkit/WebCore/storage/SQLTransaction.cpp +++ b/src/3rdparty/webkit/WebCore/storage/SQLTransaction.cpp @@ -40,7 +40,6 @@ #include "Logging.h" #include "Page.h" #include "PlatformString.h" -#include "SecurityOrigin.h" #include "Settings.h" #include "SQLError.h" #include "SQLiteTransaction.h" diff --git a/src/3rdparty/webkit/WebCore/storage/SQLTransactionClient.cpp b/src/3rdparty/webkit/WebCore/storage/SQLTransactionClient.cpp index e72f5ed..5918bd8 100644 --- a/src/3rdparty/webkit/WebCore/storage/SQLTransactionClient.cpp +++ b/src/3rdparty/webkit/WebCore/storage/SQLTransactionClient.cpp @@ -47,7 +47,7 @@ void SQLTransactionClient::didCommitTransaction(SQLTransaction* transaction) ASSERT(currentThread() == transaction->database()->document()->databaseThread()->getThreadID()); Database* database = transaction->database(); DatabaseTracker::tracker().scheduleNotifyDatabaseChanged( - database->document()->securityOrigin(), database->stringIdentifier()); + database->securityOrigin(), database->stringIdentifier()); } void SQLTransactionClient::didExecuteStatement(SQLTransaction* transaction) @@ -65,11 +65,9 @@ bool SQLTransactionClient::didExceedQuota(SQLTransaction* transaction) Page* page = database->document()->page(); ASSERT(page); - RefPtr<SecurityOrigin> origin = database->securityOriginCopy(); - - unsigned long long currentQuota = DatabaseTracker::tracker().quotaForOrigin(origin.get()); + unsigned long long currentQuota = DatabaseTracker::tracker().quotaForOrigin(database->securityOrigin()); page->chrome()->client()->exceededDatabaseQuota(database->document()->frame(), database->stringIdentifier()); - unsigned long long newQuota = DatabaseTracker::tracker().quotaForOrigin(origin.get()); + unsigned long long newQuota = DatabaseTracker::tracker().quotaForOrigin(database->securityOrigin()); return (newQuota > currentQuota); } diff --git a/src/3rdparty/webkit/WebCore/storage/StorageEventDispatcher.cpp b/src/3rdparty/webkit/WebCore/storage/StorageEventDispatcher.cpp index d2eab66..9763e07 100644 --- a/src/3rdparty/webkit/WebCore/storage/StorageEventDispatcher.cpp +++ b/src/3rdparty/webkit/WebCore/storage/StorageEventDispatcher.cpp @@ -55,7 +55,7 @@ void StorageEventDispatcher::dispatch(const String& key, const String& oldValue, } for (unsigned i = 0; i < frames.size(); ++i) - frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), frames[i]->domWindow()->sessionStorage())); + frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->sessionStorage())); } else { // Send events to every page. const HashSet<Page*>& pages = page->group().pages(); @@ -68,7 +68,7 @@ void StorageEventDispatcher::dispatch(const String& key, const String& oldValue, } for (unsigned i = 0; i < frames.size(); ++i) - frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), frames[i]->domWindow()->localStorage())); + frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->localStorage())); } } diff --git a/src/3rdparty/webkit/WebCore/svg/SVGStyledElement.cpp b/src/3rdparty/webkit/WebCore/svg/SVGStyledElement.cpp index 98b6459..6960519 100644 --- a/src/3rdparty/webkit/WebCore/svg/SVGStyledElement.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SVGStyledElement.cpp @@ -245,20 +245,23 @@ PassRefPtr<CSSValue> SVGStyledElement::getPresentationAttribute(const String& na if (!mappedAttributes()) return 0; - Attribute* attr = mappedAttributes()->getAttributeItem(QualifiedName(nullAtom, name, nullAtom)); + QualifiedName attributeName(nullAtom, name, nullAtom); + Attribute* attr = mappedAttributes()->getAttributeItem(attributeName); if (!attr || !attr->isMappedAttribute() || !attr->style()) return 0; MappedAttribute* cssSVGAttr = static_cast<MappedAttribute*>(attr); - - // FIXME: Is it possible that the style will not be shared at the time this - // is called, but a later addition to the DOM will make it shared? - if (!cssSVGAttr->style()->hasOneRef()) { + // This function returns a pointer to a CSSValue which can be mutated from JavaScript. + // If the associated MappedAttribute uses the same CSSMappedAttributeDeclaration + // as StyledElement's mappedAttributeDecls cache, create a new CSSMappedAttributeDeclaration + // before returning so that any modifications to the CSSValue will not affect other attributes. + MappedAttributeEntry entry; + mapToEntry(attributeName, entry); + if (getMappedAttributeDecl(entry, cssSVGAttr) == cssSVGAttr->decl()) { cssSVGAttr->setDecl(0); int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(cssSVGAttr->name()); addCSSProperty(cssSVGAttr, propId, cssSVGAttr->value()); } - return cssSVGAttr->style()->getPropertyCSSValue(name); } diff --git a/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp b/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp index e969514..be8ab78 100644 --- a/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp +++ b/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp @@ -28,6 +28,52 @@ namespace WebCore { +void SynchronizableProperties::addProperty(SVGAnimatedPropertyBase* base) +{ + m_bases.add(base); +} + +void SynchronizableProperties::synchronize() +{ + ASSERT(!m_bases.isEmpty()); + if (m_shouldSynchronize) { + BaseSet::iterator it = m_bases.begin(); + BaseSet::iterator end = m_bases.end(); + + for (; it != end; ++it) { + SVGAnimatedPropertyBase* base = *it; + ASSERT(base); + base->synchronize(); + } + } +} + +void SynchronizableProperties::startAnimation() +{ + ASSERT(!m_bases.isEmpty()); + BaseSet::iterator it = m_bases.begin(); + BaseSet::iterator end = m_bases.end(); + + for (; it != end; ++it) { + SVGAnimatedPropertyBase* base = *it; + ASSERT(base); + base->startAnimation(); + } +} + +void SynchronizableProperties::stopAnimation() +{ + ASSERT(!m_bases.isEmpty()); + BaseSet::iterator it = m_bases.begin(); + BaseSet::iterator end = m_bases.end(); + + for (; it != end; ++it) { + SVGAnimatedPropertyBase* base = *it; + ASSERT(base); + base->stopAnimation(); + } +} + SynchronizablePropertyController::SynchronizablePropertyController() { } @@ -36,20 +82,15 @@ void SynchronizablePropertyController::registerProperty(const QualifiedName& att { // 'attrName' is ambigious. For instance in SVGMarkerElement both 'orientType' / 'orientAngle' // SVG DOM objects are synchronized with the 'orient' attribute. This why we need a HashSet. - SynchronizableProperty property(base); - PropertyMap::iterator it = m_map.find(attrName.localName()); if (it == m_map.end()) { - Properties properties; - properties.add(property); + SynchronizableProperties properties; + properties.addProperty(base); m_map.set(attrName.localName(), properties); return; } - Properties& properties = it->second; - ASSERT(!properties.isEmpty()); - - properties.add(property); + it->second.addProperty(base); } void SynchronizablePropertyController::setPropertyNeedsSynchronization(const QualifiedName& attrName) @@ -57,17 +98,7 @@ void SynchronizablePropertyController::setPropertyNeedsSynchronization(const Qua PropertyMap::iterator itProp = m_map.find(attrName.localName()); ASSERT(itProp != m_map.end()); - Properties& properties = itProp->second; - ASSERT(!properties.isEmpty()); - - Properties::iterator it = properties.begin(); - Properties::iterator end = properties.end(); - - for (; it != end; ++it) { - SynchronizableProperty& property = *it; - ASSERT(property.base); - property.shouldSynchronize = true; - } + itProp->second.setNeedsSynchronization(); } void SynchronizablePropertyController::synchronizeProperty(const String& name) @@ -76,21 +107,7 @@ void SynchronizablePropertyController::synchronizeProperty(const String& name) if (itProp == m_map.end()) return; - Properties& properties = itProp->second; - ASSERT(!properties.isEmpty()); - - Properties::iterator it = properties.begin(); - Properties::iterator end = properties.end(); - - for (; it != end; ++it) { - SynchronizableProperty& property = *it; - ASSERT(property.base); - - if (!property.shouldSynchronize) - continue; - - property.base->synchronize(); - } + itProp->second.synchronize(); } void SynchronizablePropertyController::synchronizeAllProperties() @@ -101,23 +118,8 @@ void SynchronizablePropertyController::synchronizeAllProperties() PropertyMap::iterator itProp = m_map.begin(); PropertyMap::iterator endProp = m_map.end(); - for (; itProp != endProp; ++itProp) { - Properties& properties = itProp->second; - ASSERT(!properties.isEmpty()); - - Properties::iterator it = properties.begin(); - Properties::iterator end = properties.end(); - - for (; it != end; ++it) { - SynchronizableProperty& property = *it; - ASSERT(property.base); - - if (!property.shouldSynchronize) - continue; - - property.base->synchronize(); - } - } + for (; itProp != endProp; ++itProp) + itProp->second.synchronize(); } void SynchronizablePropertyController::startAnimation(const String& name) @@ -126,17 +128,7 @@ void SynchronizablePropertyController::startAnimation(const String& name) if (itProp == m_map.end()) return; - Properties& properties = itProp->second; - ASSERT(!properties.isEmpty()); - - Properties::iterator it = properties.begin(); - Properties::iterator end = properties.end(); - - for (; it != end; ++it) { - SynchronizableProperty& property = *it; - ASSERT(property.base); - property.base->startAnimation(); - } + itProp->second.startAnimation(); } void SynchronizablePropertyController::stopAnimation(const String& name) @@ -145,17 +137,7 @@ void SynchronizablePropertyController::stopAnimation(const String& name) if (itProp == m_map.end()) return; - Properties& properties = itProp->second; - ASSERT(!properties.isEmpty()); - - Properties::iterator it = properties.begin(); - Properties::iterator end = properties.end(); - - for (; it != end; ++it) { - SynchronizableProperty& property = *it; - ASSERT(property.base); - property.base->stopAnimation(); - } + itProp->second.stopAnimation(); } } diff --git a/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.h b/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.h index b7f101b..1ec5026 100644 --- a/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.h +++ b/src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.h @@ -31,65 +31,28 @@ namespace WebCore { class QualifiedName; class SVGAnimatedPropertyBase; -struct SynchronizableProperty { - SynchronizableProperty() - : base(0) - , shouldSynchronize(false) - { - } - - explicit SynchronizableProperty(SVGAnimatedPropertyBase* _base) - : base(_base) - , shouldSynchronize(false) - { - } - - explicit SynchronizableProperty(WTF::HashTableDeletedValueType) - : base(reinterpret_cast<SVGAnimatedPropertyBase*>(-1)) - , shouldSynchronize(false) - { - } - - bool isHashTableDeletedValue() const - { - return base == reinterpret_cast<SVGAnimatedPropertyBase*>(-1); - } - - bool operator==(const SynchronizableProperty& other) const - { - return base == other.base && shouldSynchronize == other.shouldSynchronize; - } - - SVGAnimatedPropertyBase* base; - bool shouldSynchronize; -}; - -struct SynchronizablePropertyHash { - static unsigned hash(const SynchronizableProperty& key) +class SynchronizableProperties { +public: + SynchronizableProperties() + : m_shouldSynchronize(false) { - return StringImpl::computeHash(reinterpret_cast<const UChar*>(&key), sizeof(SynchronizableProperty) / sizeof(UChar)); } - static bool equal(const SynchronizableProperty& a, const SynchronizableProperty& b) + void setNeedsSynchronization() { - return a == b; + m_shouldSynchronize = true; } - static const bool safeToCompareToEmptyOrDeleted = true; -}; - -struct SynchronizablePropertyHashTraits : WTF::GenericHashTraits<SynchronizableProperty> { - static const bool emptyValueIsZero = true; + void addProperty(SVGAnimatedPropertyBase*); + void synchronize(); + void startAnimation(); + void stopAnimation(); - static void constructDeletedValue(SynchronizableProperty& slot) - { - new (&slot) SynchronizableProperty(WTF::HashTableDeletedValue); - } +private: + typedef HashSet<SVGAnimatedPropertyBase*> BaseSet; - static bool isDeletedValue(const SynchronizableProperty& value) - { - return value.isHashTableDeletedValue(); - } + BaseSet m_bases; + bool m_shouldSynchronize; }; // Helper class used exclusively by SVGElement to keep track of all animatable properties within a SVGElement, @@ -110,8 +73,7 @@ private: SynchronizablePropertyController(); private: - typedef HashSet<SynchronizableProperty, SynchronizablePropertyHash, SynchronizablePropertyHashTraits> Properties; - typedef HashMap<String, Properties> PropertyMap; + typedef HashMap<String, SynchronizableProperties> PropertyMap; PropertyMap m_map; }; diff --git a/src/3rdparty/webkit/WebCore/websockets/WebSocket.cpp b/src/3rdparty/webkit/WebCore/websockets/WebSocket.cpp index f3bbdd7..32e0559 100644 --- a/src/3rdparty/webkit/WebCore/websockets/WebSocket.cpp +++ b/src/3rdparty/webkit/WebCore/websockets/WebSocket.cpp @@ -110,7 +110,8 @@ WebSocket::WebSocket(ScriptExecutionContext* context) WebSocket::~WebSocket() { - close(); + if (m_channel.get()) + m_channel->disconnect(); } void WebSocket::connect(const KURL& url, ExceptionCode& ec) @@ -190,7 +191,7 @@ ScriptExecutionContext* WebSocket::scriptExecutionContext() const void WebSocket::didConnect() { LOG(Network, "WebSocket %p didConnect", this); - if (m_state != CONNECTING) { + if (m_state != CONNECTING || !scriptExecutionContext()) { didClose(); return; } @@ -201,7 +202,7 @@ void WebSocket::didConnect() void WebSocket::didReceiveMessage(const String& msg) { LOG(Network, "WebSocket %p didReceiveMessage %s", this, msg.utf8().data()); - if (m_state != OPEN) + if (m_state != OPEN || !scriptExecutionContext()) return; RefPtr<MessageEvent> evt = MessageEvent::create(); // FIXME: origin, lastEventId, source, messagePort. @@ -213,7 +214,8 @@ void WebSocket::didClose() { LOG(Network, "WebSocket %p didClose", this); m_state = CLOSED; - scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, Event::create(eventNames().closeEvent, false, false))); + if (scriptExecutionContext()) + scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, Event::create(eventNames().closeEvent, false, false))); } EventTargetData* WebSocket::eventTargetData() diff --git a/src/3rdparty/webkit/WebCore/websockets/WebSocketChannel.cpp b/src/3rdparty/webkit/WebCore/websockets/WebSocketChannel.cpp index 145cd34..be388b4 100644 --- a/src/3rdparty/webkit/WebCore/websockets/WebSocketChannel.cpp +++ b/src/3rdparty/webkit/WebCore/websockets/WebSocketChannel.cpp @@ -71,6 +71,7 @@ void WebSocketChannel::connect() LOG(Network, "WebSocketChannel %p connect", this); ASSERT(!m_handle.get()); m_handshake.reset(); + ref(); m_handle = SocketStreamHandle::create(m_handshake.url(), this); } @@ -103,6 +104,14 @@ void WebSocketChannel::close() m_handle->close(); // will call didClose() } +void WebSocketChannel::disconnect() +{ + LOG(Network, "WebSocketChannel %p disconnect", this); + m_client = 0; + if (m_handle.get()) + m_handle->close(); +} + void WebSocketChannel::willOpenStream(SocketStreamHandle*, const KURL&) { } @@ -126,13 +135,15 @@ void WebSocketChannel::didClose(SocketStreamHandle* handle) { LOG(Network, "WebSocketChannel %p didClose", this); ASSERT(handle == m_handle.get() || !m_handle.get()); - if (!m_handle.get()) - return; - m_unhandledBufferSize = handle->bufferedAmount(); - WebSocketChannelClient* client = m_client; - m_client = 0; - m_handle = 0; - client->didClose(); + if (m_handle.get()) { + m_unhandledBufferSize = handle->bufferedAmount(); + WebSocketChannelClient* client = m_client; + m_client = 0; + m_handle = 0; + if (client) + client->didClose(); + } + deref(); } void WebSocketChannel::didReceiveData(SocketStreamHandle* handle, const char* data, int len) @@ -143,6 +154,10 @@ void WebSocketChannel::didReceiveData(SocketStreamHandle* handle, const char* da handle->close(); return; } + if (!m_client) { + handle->close(); + return; + } if (m_handshake.mode() != WebSocketHandshake::Connected) { int headerLength = m_handshake.readServerHandshake(m_buffer, m_bufferSize); if (headerLength <= 0) @@ -184,7 +199,7 @@ void WebSocketChannel::didReceiveData(SocketStreamHandle* handle, const char* da handle->close(); return; } - length = length * 128 + *p & 0x7f; + length = length * 128 + (*p & 0x7f); ++p; } if (p + length < end) { diff --git a/src/3rdparty/webkit/WebCore/websockets/WebSocketChannel.h b/src/3rdparty/webkit/WebCore/websockets/WebSocketChannel.h index 75f41f6..ad38163 100644 --- a/src/3rdparty/webkit/WebCore/websockets/WebSocketChannel.h +++ b/src/3rdparty/webkit/WebCore/websockets/WebSocketChannel.h @@ -47,7 +47,7 @@ namespace WebCore { class WebSocketChannel : public RefCounted<WebSocketChannel>, public SocketStreamHandleClient { public: - static PassRefPtr<WebSocketChannel> create(ScriptExecutionContext* context, WebSocketChannelClient* client, const KURL& url, const String& protocol) { return new WebSocketChannel(context, client, url, protocol); } + static PassRefPtr<WebSocketChannel> create(ScriptExecutionContext* context, WebSocketChannelClient* client, const KURL& url, const String& protocol) { return adoptRef(new WebSocketChannel(context, client, url, protocol)); } virtual ~WebSocketChannel(); virtual void connect(); @@ -57,6 +57,8 @@ namespace WebCore { virtual void close(); + virtual void disconnect(); + virtual void willOpenStream(SocketStreamHandle*, const KURL&); virtual void willSendData(SocketStreamHandle*, const char*, int); virtual void didOpen(SocketStreamHandle*); diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp b/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp index f4d795b..9a88309 100644 --- a/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp +++ b/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp @@ -49,6 +49,7 @@ #include "WorkerThreadableLoader.h" #include "XMLHttpRequestException.h" #include <wtf/RefPtr.h> +#include <wtf/UnusedParam.h> #if ENABLE(NOTIFICATIONS) #include "NotificationCenter.h" diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl b/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl index 17bee55..0a5817c 100644 --- a/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl +++ b/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl @@ -72,7 +72,7 @@ module threads { #if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS // Notification interface - readonly attribute NotificationCenter webkitNotifications; + readonly attribute [EnabledAtRuntime] NotificationCenter webkitNotifications; #endif // Constructors diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp index ca48d8d..87a6540 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp @@ -33,6 +33,7 @@ #include "EventNames.h" #include "File.h" #include "HTTPParsers.h" +#include "InspectorTimelineAgent.h" #include "ResourceError.h" #include "ResourceRequest.h" #include "SecurityOrigin.h" @@ -47,7 +48,9 @@ #include <wtf/RefCountedLeakCounter.h> #if USE(JSC) +#include "JSDOMBinding.h" #include "JSDOMWindow.h" +#include <runtime/Protect.h> #endif namespace WebCore { @@ -248,10 +251,32 @@ void XMLHttpRequest::callReadyStateChangeListener() if (!scriptExecutionContext()) return; +#if ENABLE(INSPECTOR) + InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(scriptExecutionContext()); + if (timelineAgent) + timelineAgent->willChangeXHRReadyState(m_url.string(), m_state); +#endif + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent)); - if (m_state == DONE && !m_error) +#if ENABLE(INSPECTOR) + if (timelineAgent) + timelineAgent->didChangeXHRReadyState(); +#endif + + if (m_state == DONE && !m_error) { +#if ENABLE(INSPECTOR) + if (timelineAgent) + timelineAgent->willLoadXHR(m_url.string()); +#endif + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadEvent)); + +#if ENABLE(INSPECTOR) + if (timelineAgent) + timelineAgent->didLoadXHR(); +#endif + } } void XMLHttpRequest::setWithCredentials(bool value, ExceptionCode& ec) @@ -604,10 +629,8 @@ void XMLHttpRequest::dropProtection() // out. But it is protected from GC while loading, so this // can't be recouped until the load is done, so only // report the extra cost at that point. - - if (JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext())) - if (DOMObject* wrapper = getCachedDOMObjectWrapper(*globalObject->globalData(), this)) - JSC::Heap::heap(wrapper)->reportExtraMemoryCost(m_responseText.size() * 2); + if (DOMObject* wrapper = getCachedDOMObjectWrapper(*scriptExecutionContext()->globalData(), this)) + JSC::Heap::heap(wrapper)->reportExtraMemoryCost(m_responseText.size() * 2); #endif unsetPendingActivity(this); diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h index 30744a0..c7e0192 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h @@ -182,7 +182,7 @@ private: unsigned m_lastSendLineNumber; String m_lastSendURL; ExceptionCode m_exceptionCode; - + EventTargetData m_eventTargetData; }; diff --git a/src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp b/src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp index da39443..1089f7c 100644 --- a/src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp +++ b/src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp @@ -667,12 +667,13 @@ Value FunRound::evaluate() const return round(arg(0)->evaluate().toNumber()); } +struct FunctionMapping { + const char* name; + FunctionRec function; +}; + static void createFunctionMap() { - struct FunctionMapping { - const char *name; - FunctionRec function; - }; static const FunctionMapping functions[] = { { "boolean", { &createFunBoolean, 1 } }, { "ceiling", { &createFunCeiling, 1 } }, diff --git a/src/3rdparty/webkit/WebKit.pri b/src/3rdparty/webkit/WebKit.pri index 2dba0d4..10291b4 100644 --- a/src/3rdparty/webkit/WebKit.pri +++ b/src/3rdparty/webkit/WebKit.pri @@ -25,6 +25,10 @@ building-libs { LIBS += -lQtWebKit$${QT_MAJOR_VERSION} } else { LIBS += -lQtWebKit + symbian { + TARGET.EPOCSTACKSIZE = 0x14000 // 80 kB + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 // Min 128kB, Max 32MB + } } } } diff --git a/src/3rdparty/webkit/WebKit/ChangeLog b/src/3rdparty/webkit/WebKit/ChangeLog index 607a039..5006da7 100644 --- a/src/3rdparty/webkit/WebKit/ChangeLog +++ b/src/3rdparty/webkit/WebKit/ChangeLog @@ -1,3 +1,19 @@ +2009-10-27 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + Updated license + + * LICENSE: + +2009-10-26 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Move some WebView event handling code into its own file, WebViewEventHandling.mm + + * WebKit.xcodeproj/project.pbxproj: + 2009-10-19 John Gregg <johnnyg@google.com> Reviewed by Dimitri Glazkov. diff --git a/src/3rdparty/webkit/WebKit/LICENSE b/src/3rdparty/webkit/WebKit/LICENSE index 47dee86..f29b41c 100644 --- a/src/3rdparty/webkit/WebKit/LICENSE +++ b/src/3rdparty/webkit/WebKit/LICENSE @@ -1,25 +1,21 @@ -Copyright (C) 2005 Apple Computer, Inc. All rights reserved. +Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - its contributors may be used to endorse or promote products derived - from this software without specific prior written permission. + documentation and/or other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY +THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY +DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig b/src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig index 6572d2c..fabc009 100644 --- a/src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig +++ b/src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 532; -MINOR_VERSION = 3; +MINOR_VERSION = 4; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); @@ -36,6 +36,7 @@ SYSTEM_VERSION_PREFIX_ = 4; // Some Tiger versions of Xcode don't set MAC_OS_X_V SYSTEM_VERSION_PREFIX_1040 = 4; SYSTEM_VERSION_PREFIX_1050 = 5; SYSTEM_VERSION_PREFIX_1060 = 6; +SYSTEM_VERSION_PREFIX_1070 = 7; // The production build always uses the full version with a system version prefix. BUNDLE_VERSION_Production = $(SYSTEM_VERSION_PREFIX)$(FULL_VERSION); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index 0cb4204..b22109b 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -280,7 +280,11 @@ QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent) QGraphicsWebView::~QGraphicsWebView() { if (d->page) { +#if QT_VERSION >= 0x040600 + d->page->d->view.clear(); +#else d->page->d->view = 0; +#endif d->page->d->client = 0; // unset the page client } @@ -330,6 +334,28 @@ bool QGraphicsWebView::sceneEvent(QEvent* event) /*! \reimp */ +QVariant QGraphicsWebView::itemChange(GraphicsItemChange change, const QVariant& value) +{ + switch (change) { + // Differently from QWebView, it is interesting to QGraphicsWebView to handle + // post mouse cursor change notifications. Reason: 'ItemCursorChange' is sent + // as the first action in QGraphicsItem::setCursor implementation, and at that + // item widget's cursor has not been effectively changed yet. + // After cursor is properly set (at 'ItemCursorHasChanged' emission time), we + // fire 'CursorChange'. + case ItemCursorChange: + return value; + case ItemCursorHasChanged: + QEvent event(QEvent::CursorChange); + QApplication::sendEvent(this, &event); + return value; + } + + return QGraphicsWidget::itemChange(change, value); +} + +/*! \reimp +*/ bool QGraphicsWebView::event(QEvent* event) { // Re-implemented in order to allows fixing event-related bugs in patch releases. diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h index 26f7374..43cf59a 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h @@ -85,6 +85,7 @@ public: virtual void setGeometry(const QRectF& rect); virtual void updateGeometry(); virtual void paint(QPainter*, const QStyleOptionGraphicsItem* options, QWidget* widget = 0); + virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value); virtual bool event(QEvent*); public Q_SLOTS: diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp index 5b83870..6305d10 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp @@ -202,23 +202,9 @@ bool QWebElement::isNull() const \sa findFirst() */ -QList<QWebElement> QWebElement::findAll(const QString &selectorQuery) const +QWebElementCollection QWebElement::findAll(const QString &selectorQuery) const { - QList<QWebElement> elements; - if (!m_element) - return elements; - - ExceptionCode exception = 0; // ### - RefPtr<NodeList> nodes = m_element->querySelectorAll(selectorQuery, exception); - if (!nodes) - return elements; - - for (unsigned i = 0; i < nodes->length(); ++i) { - WebCore::Node* n = nodes->item(i); - elements.append(QWebElement(static_cast<Element*>(n))); - } - - return elements; + return QWebElementCollection(*this, selectorQuery); } /*! @@ -682,7 +668,7 @@ static bool setupScriptContext(WebCore::Element* element, JSC::JSValue& thisValu if (!scriptController) return false; - state = scriptController->globalObject()->globalExec(); + state = scriptController->globalObject(mainThreadNormalWorld())->globalExec(); if (!state) return false; @@ -1137,7 +1123,7 @@ QWebElement QWebElement::clone() const The element is still valid after removal, and can be inserted into other parts of the document. - \sa removeChildren(), removeFromDocument() + \sa removeAllChildren(), removeFromDocument() */ QWebElement &QWebElement::takeFromDocument() { @@ -1153,7 +1139,7 @@ QWebElement &QWebElement::takeFromDocument() /*! Removes this element from the document and makes it a null element. - \sa removeChildren(), takeFromDocument() + \sa removeAllChildren(), takeFromDocument() */ void QWebElement::removeFromDocument() { @@ -1171,7 +1157,7 @@ void QWebElement::removeFromDocument() \sa removeFromDocument(), takeFromDocument() */ -void QWebElement::removeChildren() +void QWebElement::removeAllChildren() { if (!m_element) return; @@ -1450,3 +1436,391 @@ void QWebElement::render(QPainter* painter) context.restore(); } +class QWebElementCollectionPrivate : public QSharedData +{ +public: + static QWebElementCollectionPrivate* create(const PassRefPtr<Node> &context, const QString &query); + + RefPtr<NodeList> m_result; + +private: + inline QWebElementCollectionPrivate() {} +}; + +QWebElementCollectionPrivate* QWebElementCollectionPrivate::create(const PassRefPtr<Node> &context, const QString &query) +{ + if (!context) + return 0; + + // Let WebKit do the hard work hehehe + ExceptionCode exception = 0; // ### + RefPtr<NodeList> nodes = context->querySelectorAll(query, exception); + if (!nodes) + return 0; + + QWebElementCollectionPrivate* priv = new QWebElementCollectionPrivate; + priv->m_result = nodes; + return priv; +} + +/*! + \class QWebElementCollection + \since 4.6 + \brief The QWebElementCollection class represents a collection of web elements. + \preliminary + + Elements in a document can be selected using QWebElement::findAll() or using the + QWebElement constructor. The collection is composed by choosing all elements in the + document that match a specified CSS selector expression. + + The number of selected elements is provided through the count() property. Individual + elements can be retrieved by index using at(). + + It is also possible to iterate through all elements in the collection using Qt's foreach + macro: + + \code + QWebElementCollection collection = document.findAll("p"); + foreach (QWebElement paraElement, collection) { + ... + } + \endcode +*/ + +/*! + Constructs an empty collection. +*/ +QWebElementCollection::QWebElementCollection() +{ +} + +/*! + Constructs a copy of \a other. +*/ +QWebElementCollection::QWebElementCollection(const QWebElementCollection &other) + : d(other.d) +{ +} + +/*! + Constructs a collection of elements from the list of child elements of \a contextElement that + match the specified CSS selector \a query. +*/ +QWebElementCollection::QWebElementCollection(const QWebElement &contextElement, const QString &query) +{ + d = QExplicitlySharedDataPointer<QWebElementCollectionPrivate>(QWebElementCollectionPrivate::create(contextElement.m_element, query)); +} + +/*! + Assigns \a other to this collection and returns a reference to this collection. +*/ +QWebElementCollection &QWebElementCollection::operator=(const QWebElementCollection &other) +{ + d = other.d; + return *this; +} + +/*! + Destroys the collection. +*/ +QWebElementCollection::~QWebElementCollection() +{ +} + +/*! \fn QWebElementCollection &QWebElementCollection::operator+=(const QWebElementCollection &other) + + Appends the items of the \a other list to this list and returns a + reference to this list. + + \sa operator+(), append() +*/ + +/*! + Returns a collection that contains all the elements of this collection followed + by all the elements in the \a other collection. Duplicates may occur in the result. + + \sa operator+=() +*/ +QWebElementCollection QWebElementCollection::operator+(const QWebElementCollection &other) const +{ + QWebElementCollection n = *this; n.d.detach(); n += other; return n; +} + +/*! + Extends the collection by appending all items of \a other. + + The resulting collection may include duplicate elements. + + \sa operator+=() +*/ +void QWebElementCollection::append(const QWebElementCollection &other) +{ + if (!d) { + *this = other; + return; + } + if (!other.d) + return; + Vector<RefPtr<Node> > nodes; + RefPtr<NodeList> results[] = { d->m_result, other.d->m_result }; + nodes.reserveInitialCapacity(results[0]->length() + results[1]->length()); + + for (int i = 0; i < 2; ++i) { + int j = 0; + Node* n = results[i]->item(j); + while (n) { + nodes.append(n); + n = results[i]->item(++j); + } + } + + d->m_result = StaticNodeList::adopt(nodes); +} + +/*! + Returns the number of elements in the collection. +*/ +int QWebElementCollection::count() const +{ + if (!d) + return 0; + return d->m_result->length(); +} + +/*! + Returns the element at index position \a i in the collection. +*/ +QWebElement QWebElementCollection::at(int i) const +{ + if (!d) + return QWebElement(); + Node* n = d->m_result->item(i); + return QWebElement(static_cast<Element*>(n)); +} + +/*! + \fn const QWebElement QWebElementCollection::operator[](int position) const + + Returns the element at the specified \a position in the collection. +*/ + +/*! \fn QWebElement QWebElementCollection::first() const + + Returns the first element in the collection. + + \sa last(), operator[](), at(), count() +*/ + +/*! \fn QWebElement QWebElementCollection::last() const + + Returns the last element in the collection. + + \sa first(), operator[](), at(), count() +*/ + +/*! + Returns a QList object with the elements contained in this collection. +*/ +QList<QWebElement> QWebElementCollection::toList() const +{ + if (!d) + return QList<QWebElement>(); + QList<QWebElement> elements; + int i = 0; + Node* n = d->m_result->item(i); + while (n) { + if (n->isElementNode()) + elements.append(QWebElement(static_cast<Element*>(n))); + n = d->m_result->item(++i); + } + return elements; +} + +/*! + \fn QWebElementCollection::const_iterator QWebElementCollection::begin() const + + Returns an STL-style iterator pointing to the first element in the collection. + + \sa end() +*/ + +/*! + \fn QWebElementCollection::const_iterator QWebElementCollection::end() const + + Returns an STL-style iterator pointing to the imaginary element after the + last element in the list. + + \sa begin() +*/ + +/*! + \class QWebElementCollection::const_iterator + \since 4.6 + \brief The QWebElementCollection::const_iterator class provides an STL-style const iterator for QWebElementCollection. + + QWebElementCollection provides STL style const iterators for fast low-level access to the elements. + + QWebElementCollection::const_iterator allows you to iterate over a QWebElementCollection. + + The default QWebElementCollection::const_iterator constructors creates an uninitialized iterator. You must initialize + it using a QWebElementCollection function like QWebElementCollection::begin() or QWebElementCollection::end() before you + can start iterating. +*/ + +/*! + \fn QWebElementCollection::const_iterator::const_iterator() + + Constructs an uninitialized iterator. + + Functions like operator*() and operator++() should not be called on + an uninitialized iterator. Use operator=() to assign a value + to it before using it. + + \sa QWebElementCollection::begin() +*/ + +/*! + \fn QWebElementCollection::const_iterator::const_iterator(const const_iterator &other) + + Constructs a copy of \a other. +*/ + +/*! + \fn QWebElementCollection::const_iterator::const_iterator(const QWebElementCollection *collection, int index) + \internal +*/ + +/*! + \fn const QWebElement QWebElementCollection::const_iterator::operator*() const + + Returns the current element. +*/ + +/*! + \fn bool QWebElementCollection::const_iterator::operator==(const const_iterator &other) const + + Returns true if \a other points to the same item as this iterator; + otherwise returns false. + + \sa operator!=() +*/ + +/*! + \fn bool QWebElementCollection::const_iterator::operator!=(const const_iterator &other) const + + Returns true if \a other points to a different element than this; + iterator; otherwise returns false. + + \sa operator==() +*/ + +/*! + \fn QWebElementCollection::const_iterator &QWebElementCollection::const_iterator::operator++() + + The prefix ++ operator (\c{++it}) advances the iterator to the next element in the collection + and returns an iterator to the new current element. + + Calling this function on QWebElementCollection::end() leads to undefined results. + + \sa operator--() +*/ + +/*! + \fn QWebElementCollection::const_iterator QWebElementCollection::const_iterator::operator++(int) + + \overload + + The postfix ++ operator (\c{it++}) advances the iterator to the next element in the collection + and returns an iterator to the previously current element. + + Calling this function on QWebElementCollection::end() leads to undefined results. +*/ + +/*! + \fn QWebElementCollection::const_iterator &QWebElementCollection::const_iterator::operator--() + + The prefix -- operator (\c{--it}) makes the preceding element current and returns an + iterator to the new current element. + + Calling this function on QWebElementCollection::begin() leads to undefined results. + + \sa operator++() +*/ + +/*! + \fn QWebElementCollection::const_iterator QWebElementCollection::const_iterator::operator--(int) + + \overload + + The postfix -- operator (\c{it--}) makes the preceding element current and returns + an iterator to the previously current element. +*/ + +/*! + \fn QWebElementCollection::const_iterator &QWebElementCollection::const_iterator::operator+=(int j) + + Advances the iterator by \a j elements. If \a j is negative, the iterator goes backward. + + \sa operator-=(), operator+() +*/ + +/*! + \fn QWebElementCollection::const_iterator &QWebElementCollection::const_iterator::operator-=(int j) + + Makes the iterator go back by \a j elements. If \a j is negative, the iterator goes forward. + + \sa operator+=(), operator-() +*/ + +/*! + \fn QWebElementCollection::const_iterator QWebElementCollection::const_iterator::operator+(int j) const + + Returns an iterator to the element at \a j positions forward from this iterator. If \a j + is negative, the iterator goes backward. + + \sa operator-(), operator+=() +*/ + +/*! + \fn QWebElementCollection::const_iterator QWebElementCollection::const_iterator::operator-(int j) const + + Returns an iterator to the element at \a j positiosn backward from this iterator. + If \a j is negative, the iterator goes forward. + + \sa operator+(), operator-=() +*/ + +/*! + \fn int QWebElementCollection::const_iterator::operator-(const_iterator other) const + + Returns the number of elements between the item point to by \a other + and the element pointed to by this iterator. +*/ + +/*! + \fn bool QWebElementCollection::const_iterator::operator<(const const_iterator &other) const + + Returns true if the element pointed to by this iterator is less than the element pointed to + by the \a other iterator. +*/ + +/*! + \fn bool QWebElementCollection::const_iterator::operator<=(const const_iterator &other) const + + Returns true if the element pointed to by this iterator is less than or equal to the + element pointed to by the \a other iterator. +*/ + +/*! + \fn bool QWebElementCollection::const_iterator::operator>(const const_iterator &other) const + + Returns true if the element pointed to by this iterator is greater than the element pointed to + by the \a other iterator. +*/ + +/*! + \fn bool QWebElementCollection::const_iterator::operator>=(const const_iterator &other) const + + Returns true if the element pointed to by this iterator is greater than or equal to the + element pointed to by the \a other iterator. +*/ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h index 351ccb4..a18d262 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h @@ -36,6 +36,7 @@ class QPainter; QT_END_NAMESPACE class QWebFrame; +class QWebElementCollection; class QWebElementPrivate; class QWEBKIT_EXPORT QWebElement { @@ -50,8 +51,8 @@ public: bool isNull() const; - QList<QWebElement> findAll(const QString& selectorQuery) const; - QWebElement findFirst(const QString& selectorQuery) const; + QWebElementCollection findAll(const QString &selectorQuery) const; + QWebElement findFirst(const QString &selectorQuery) const; void setPlainText(const QString& text); QString toPlainText() const; @@ -96,7 +97,7 @@ public: QWebElement document() const; QWebFrame *webFrame() const; - // TODO: Add QList<QWebElement> overloads + // TODO: Add QWebElementCollection overloads // docs need example snippet void appendInside(const QString& markup); void appendInside(const QWebElement& element); @@ -125,7 +126,7 @@ public: QWebElement clone() const; QWebElement& takeFromDocument(); void removeFromDocument(); - void removeChildren(); + void removeAllChildren(); QVariant evaluateJavaScript(const QString& scriptSource); @@ -146,6 +147,7 @@ private: static QWebElement enclosingElement(WebCore::Node*); friend class QWebFrame; + friend class QWebElementCollection; friend class QWebHitTestResult; friend class QWebHitTestResultPrivate; friend class QWebPage; @@ -154,4 +156,70 @@ private: WebCore::Element* m_element; }; +class QWebElementCollectionPrivate; + +class QWEBKIT_EXPORT QWebElementCollection +{ +public: + QWebElementCollection(); + QWebElementCollection(const QWebElement &contextElement, const QString &query); + QWebElementCollection(const QWebElementCollection &); + QWebElementCollection &operator=(const QWebElementCollection &); + ~QWebElementCollection(); + + QWebElementCollection operator+(const QWebElementCollection &other) const; + inline QWebElementCollection &operator+=(const QWebElementCollection &other) + { + append(other); return *this; + } + + void append(const QWebElementCollection &collection); + + int count() const; + QWebElement at(int i) const; + + inline QWebElement first() const { return at(0); } + inline QWebElement last() const { return at(count() - 1); } + + QList<QWebElement> toList() const; + + class const_iterator { + public: + int i; + const QWebElementCollection *s; + + inline const_iterator(const QWebElementCollection *collection, int index) : i(index), s(collection) {} + inline const_iterator(const const_iterator &o) : i(o.i), s(o.s) {} + + inline const QWebElement operator*() const { return s->at(i); } + + inline bool operator==(const const_iterator& o) const { return i == o.i && s == o.s; } + inline bool operator!=(const const_iterator& o) const { return i != o.i || s != o.s; } + inline bool operator<(const const_iterator& o) const { return i < o.i; } + inline bool operator<=(const const_iterator& o) const { return i <= o.i; } + inline bool operator>(const const_iterator& o) const { return i > o.i; } + inline bool operator>=(const const_iterator& o) const { return i >= o.i; } + + inline const_iterator &operator++() { ++i; return *this; } + inline const_iterator operator++(int) { const_iterator n(s, i); ++i; return n; } + inline const_iterator &operator--() { i--; return *this; } + inline const_iterator operator--(int) { const_iterator n(s, i); i--; return n; } + inline const_iterator &operator+=(int j) { i += j; return *this; } + inline const_iterator &operator-=(int j) { i -= j; return *this; } + inline const_iterator operator+(int j) const { return const_iterator(s, i + j); } + inline const_iterator operator-(int j) const { return const_iterator(s, i - j); } + inline int operator-(const_iterator j) const { return i - j.i; } + private: + inline const_iterator() : i(0), s(0) {} + }; + friend class const_iterator; + + inline const_iterator begin() const { return const_iterator(this, 0); } + inline const_iterator end() const { return const_iterator(this, count()); } + inline QWebElement operator[](int i) const { return at(i); } + +private: + QExplicitlySharedDataPointer<QWebElementCollectionPrivate> d; +}; + #endif // QWEBELEMENT_H diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index d2c324d..606dae4 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -185,6 +185,17 @@ void QWEBKIT_EXPORT qt_drt_garbageCollector_collectOnAlternateThread(bool waitUn gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone); } +// Returns the value of counter in the element specified by \a id. +QString QWEBKIT_EXPORT qt_drt_counterValueForElementById(QWebFrame* qFrame, const QString& id) +{ + Frame* frame = QWebFramePrivate::core(qFrame); + if (Document* document = frame->document()) { + Element* element = document->getElementById(id); + return WebCore::counterValueForElement(element); + } + return QString(); +} + QWebFrameData::QWebFrameData(WebCore::Page* parentPage, WebCore::Frame* parentFrame, WebCore::HTMLFrameOwnerElement* ownerFrameElement, const WebCore::String& frameName) @@ -232,7 +243,7 @@ WebCore::Scrollbar* QWebFramePrivate::verticalScrollBar() const return frame->view()->verticalScrollbar(); } -void QWebFramePrivate::renderPrivate(QPainter *painter, const QRegion &clip) +void QWebFramePrivate::renderPrivate(QPainter *painter, QWebFrame::RenderLayer layer, const QRegion &clip) { if (!frame->view() || !frame->contentRenderer()) return; @@ -241,24 +252,58 @@ void QWebFramePrivate::renderPrivate(QPainter *painter, const QRegion &clip) if (vector.isEmpty()) return; - WebCore::FrameView* view = frame->view(); - view->layoutIfNeededRecursive(); - GraphicsContext context(painter); + if (context.paintingDisabled() && !context.updatingControlTints()) + return; - if (clipRenderToViewport) - view->paint(&context, vector.first()); - else - view->paintContents(&context, vector.first()); + WebCore::FrameView* view = frame->view(); + view->layoutIfNeededRecursive(); - for (int i = 1; i < vector.size(); ++i) { + for (int i = 0; i < vector.size(); ++i) { const QRect& clipRect = vector.at(i); + QRect intersectedRect = clipRect.intersected(view->frameRect()); + painter->save(); painter->setClipRect(clipRect, Qt::IntersectClip); - if (clipRenderToViewport) - view->paint(&context, clipRect); - else - view->paintContents(&context, clipRect); + + int x = view->x(); + int y = view->y(); + + if (layer & QWebFrame::ContentsLayer) { + context.save(); + + int scrollX = view->scrollX(); + int scrollY = view->scrollY(); + + QRect rect = intersectedRect; + context.translate(x, y); + rect.translate(-x, -y); + context.translate(-scrollX, -scrollY); + rect.translate(scrollX, scrollY); + context.clip(view->visibleContentRect()); + + view->paintContents(&context, rect); + + context.restore(); + } + + if (layer & QWebFrame::ScrollBarLayer + && !view->scrollbarsSuppressed() + && (view->horizontalScrollbar() || view->verticalScrollbar())) { + context.save(); + + QRect rect = intersectedRect; + context.translate(x, y); + rect.translate(-x, -y); + + view->paintScrollbars(&context, rect); + + context.restore(); + } + + if (layer & QWebFrame::PanIconLayer) + view->paintPanScrollIcon(&context); + painter->restore(); } } @@ -386,7 +431,7 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object return; JSC::JSLock lock(JSC::SilenceAssertionsOnly); - JSDOMWindow* window = toJSDOMWindow(d->frame); + JSDOMWindow* window = toJSDOMWindow(d->frame, mainThreadNormalWorld()); JSC::Bindings::RootObject* root = d->frame->script()->bindingRootObject(); if (!window) { qDebug() << "Warning: couldn't get window object"; @@ -946,44 +991,37 @@ void QWebFrame::setScrollPosition(const QPoint &pos) } /*! - Render the frame into \a painter clipping to \a clip. + \since 4.6 + Render the \a layer of the frame using \a painter clipping to \a clip. \sa print() */ -void QWebFrame::render(QPainter *painter, const QRegion &clip) -{ - d->renderPrivate(painter, clip); -} -/*! - Render the frame into \a painter. -*/ -void QWebFrame::render(QPainter *painter) +void QWebFrame::render(QPainter* painter, RenderLayer layer, const QRegion& clip) { - if (!d->frame->view()) - return; - - d->renderPrivate(painter, QRegion(d->frame->view()->frameRect())); + if (!clip.isEmpty()) + d->renderPrivate(painter, layer, clip); + else if (d->frame->view()) + d->renderPrivate(painter, layer, QRegion(d->frame->view()->frameRect())); } /*! - \since 4.6 - \property QWebFrame::clipRenderToViewport - - Returns true if render will clip content to viewport; otherwise returns false. + Render the frame into \a painter clipping to \a clip. */ -bool QWebFrame::clipRenderToViewport() const +void QWebFrame::render(QPainter *painter, const QRegion &clip) { - return d->clipRenderToViewport; + d->renderPrivate(painter, AllLayers, clip); } /*! - \since 4.6 - Sets whether the content of a frame will be clipped to viewport when rendered. + Render the frame into \a painter. */ -void QWebFrame::setClipRenderToViewport(bool clipRenderToViewport) +void QWebFrame::render(QPainter *painter) { - d->clipRenderToViewport = clipRenderToViewport; + if (!d->frame->view()) + return; + + d->renderPrivate(painter, AllLayers, QRegion(d->frame->view()->frameRect())); } /*! @@ -1114,7 +1152,7 @@ QWebElement QWebFrame::documentElement() const \sa QWebElement::findAll() */ -QList<QWebElement> QWebFrame::findAllElements(const QString &selectorQuery) const +QWebElementCollection QWebFrame::findAllElements(const QString &selectorQuery) const { return documentElement().findAll(selectorQuery); } @@ -1264,7 +1302,7 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource) if (proxy) { JSC::JSValue v = d->frame->script()->executeScript(ScriptSourceCode(scriptSource)).jsValue(); int distance = 0; - rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject()->globalExec(), v, QMetaType::Void, &distance); + rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject(mainThreadNormalWorld())->globalExec(), v, QMetaType::Void, &distance); } return rc; } @@ -1402,7 +1440,6 @@ QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult if (!hitTest.innerNode()) return; pos = hitTest.point(); - boundingRect = hitTest.boundingBox(); WebCore::TextDirection dir; title = hitTest.title(dir); linkText = hitTest.textContent(); @@ -1412,6 +1449,7 @@ QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult imageUrl = hitTest.absoluteImageURL(); innerNode = hitTest.innerNode(); innerNonSharedNode = hitTest.innerNonSharedNode(); + boundingRect = innerNonSharedNode ? innerNonSharedNode->renderer()->absoluteBoundingBoxRect(true) : IntRect(); WebCore::Image *img = hitTest.image(); if (img) { QPixmap *pix = img->nativeImageForCurrentFrame(); @@ -1659,4 +1697,3 @@ QWebFrame *QWebHitTestResult::frame() const return 0; return d->frame; } - diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h index 55c73b4..08285f8 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h @@ -50,6 +50,7 @@ class QWebHitTestResult; class QWebHistoryItem; class QWebSecurityOrigin; class QWebElement; +class QWebElementCollection; namespace WebCore { class WidgetPrivate; @@ -112,7 +113,6 @@ class QWEBKIT_EXPORT QWebFrame : public QObject { Q_PROPERTY(QIcon icon READ icon) Q_PROPERTY(QSize contentsSize READ contentsSize) Q_PROPERTY(QPoint scrollPosition READ scrollPosition WRITE setScrollPosition) - Q_PROPERTY(bool clipRenderToViewport READ clipRenderToViewport WRITE setClipRenderToViewport) Q_PROPERTY(bool focus READ hasFocus) private: QWebFrame(QWebPage *parent, QWebFrameData *frameData); @@ -165,10 +165,17 @@ public: QPoint scrollPosition() const; void setScrollPosition(const QPoint &pos); - void render(QPainter *painter, const QRegion &clip); - void render(QPainter *painter); - bool clipRenderToViewport() const; - void setClipRenderToViewport(bool clipRenderToViewport); + enum RenderLayer { + ContentsLayer = 0x10, + ScrollBarLayer = 0x20, + PanIconLayer = 0x40, + + AllLayers = 0xff + }; + + void render(QPainter*); + void render(QPainter*, const QRegion& clip); + void render(QPainter*, RenderLayer layer, const QRegion& clip = QRegion()); void setTextSizeMultiplier(qreal factor); qreal textSizeMultiplier() const; @@ -184,7 +191,7 @@ public: QSize contentsSize() const; QWebElement documentElement() const; - QList<QWebElement> findAllElements(const QString &selectorQuery) const; + QWebElementCollection findAllElements(const QString &selectorQuery) const; QWebElement findFirstElement(const QString &selectorQuery) const; QWebHitTestResult hitTestContent(const QPoint &pos) const; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h index 632f83a..081e65d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h @@ -70,7 +70,6 @@ public: , allowsScrolling(true) , marginWidth(-1) , marginHeight(-1) - , clipRenderToViewport(true) {} void init(QWebFrame* qframe, QWebFrameData* frameData); @@ -82,7 +81,7 @@ public: static WebCore::Frame* core(QWebFrame*); static QWebFrame* kit(WebCore::Frame*); - void renderPrivate(QPainter *painter, const QRegion &clip); + void renderPrivate(QPainter*, QWebFrame::RenderLayer, const QRegion& clip); QWebFrame *q; Qt::ScrollBarPolicy horizontalScrollBarPolicy; @@ -94,7 +93,6 @@ public: bool allowsScrolling; int marginWidth; int marginHeight; - bool clipRenderToViewport; }; class QWebHitTestResultPrivate { diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp index 5752d66..d852012 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp @@ -31,6 +31,11 @@ #include <QSharedData> #include <QDebug> +enum { + InitialHistoryVersion = 1, + DefaultHistoryVersion = InitialHistoryVersion +}; + /*! \class QWebHistoryItem \since 4.4 @@ -226,7 +231,8 @@ bool QWebHistoryItem::isValid() const number of items is given by count(), and the history can be cleared with the clear() function. - QWebHistory's state can be saved with saveState() and loaded with restoreState(). + QWebHistory's state can be saved to a QDataStream using the >> operator and loaded + by using the << operator. \sa QWebHistoryItem, QWebHistoryInterface, QWebPage */ @@ -475,135 +481,72 @@ void QWebHistory::setMaximumItemCount(int count) } /*! - \enum QWebHistory::HistoryStateVersion + \since 4.6 + \fn QDataStream& operator<<(QDataStream& stream, const QWebHistory& history) + \relates QWebHistory - This enum describes the versions available for QWebHistory's saveState() function: + \brief The operator<< function streams a history into a data stream. - \value HistoryVersion_1 Version 1 (Qt 4.6) - \value DefaultHistoryVersion The current default version in 1. + It saves the \a history into the specified \a stream. */ +QDataStream& operator<<(QDataStream& target, const QWebHistory& history) +{ + QWebHistoryPrivate* d = history.d; + + int version = DefaultHistoryVersion; + + target << version; + target << history.count() << history.currentItemIndex(); + + const WebCore::HistoryItemVector &items = d->lst->entries(); + for (unsigned i = 0; i < items.size(); i++) + items[i].get()->saveState(target, version); + + return target; +} + /*! + \fn QDataStream& operator>>(QDataStream& stream, QWebHistory& history) + \relates QWebHistory \since 4.6 - Restores the state of QWebHistory from the given \a buffer. Returns true - if the history was successfully restored; otherwise returns false. + \brief The operator>> function loads a history from a data stream. - \sa saveState() + Loads a QWebHistory from the specified \a stream into the given \a history. */ -bool QWebHistory::restoreState(const QByteArray& buffer) + +QDataStream& operator>>(QDataStream& source, QWebHistory& history) { - QDataStream stream(buffer); + QWebHistoryPrivate* d = history.d; + int version; - bool result = false; - stream >> version; - switch (version) { - case HistoryVersion_1: { + source >> version; + + if (version == 1) { int count; int currentIndex; - stream >> count >> currentIndex; + source >> count >> currentIndex; - clear(); + history.clear(); // only if there are elements if (count) { // after clear() is new clear HistoryItem (at the end we had to remove it) - WebCore::HistoryItem *nullItem = d->lst->currentItem(); - for (int i = 0;i < count;i++) { + WebCore::HistoryItem* nullItem = d->lst->currentItem(); + for (int i = 0; i < count; i++) { WTF::PassRefPtr<WebCore::HistoryItem> item = WebCore::HistoryItem::create(); - item->restoreState(stream, version); + item->restoreState(source, version); d->lst->addItem(item); } d->lst->removeItem(nullItem); - goToItem(itemAt(currentIndex)); - result = stream.status() == QDataStream::Ok; + history.goToItem(history.itemAt(currentIndex)); } - break; - } - default: {} // result is false; } d->page()->updateNavigationActions(); - return result; -}; - -/*! - \since 4.6 - Saves the state of this QWebHistory into a QByteArray. - - Saves the current state of this QWebHistory. The version number, \a version, is - stored as part of the data. - - To restore the saved state, pass the return value to restoreState(). - - \sa restoreState() -*/ -QByteArray QWebHistory::saveState(HistoryStateVersion version) const -{ - QByteArray buffer; - QDataStream stream(&buffer, QIODevice::WriteOnly); - stream << version; - - switch (version) { - case HistoryVersion_1: { - stream << count() << currentItemIndex(); - - const WebCore::HistoryItemVector &items = d->lst->entries(); - for (unsigned i = 0; i < items.size(); i++) - items[i].get()->saveState(stream, version); - - if (stream.status() != QDataStream::Ok) - buffer = QByteArray(); // make buffer isNull()==true and isEmpty()==true - break; - } - default: - buffer.clear(); - - } - - return buffer; -} - -/*! - \since 4.6 - \fn QDataStream& operator<<(QDataStream& stream, const QWebHistory& history) - \relates QWebHistory - - \brief The operator<< function streams a history into a data stream. - - It saves the \a history into the specified \a stream. This is a - convenience function and is equivalent to calling the saveState() - method. - - \sa QWebHistory::saveState() -*/ - -QDataStream& operator<<(QDataStream& stream, const QWebHistory& history) -{ - return stream << history.saveState(); -} - -/*! - \fn QDataStream& operator>>(QDataStream& stream, QWebHistory& history) - \relates QWebHistory - \since 4.6 - - \brief The operator>> function loads a history from a data stream. - - Loads a QWebHistory from the specified \a stream into the given \a history. - This is a convenience function and it is equivalent to calling the restoreState() - method. - - \sa QWebHistory::restoreState() -*/ - -QDataStream& operator>>(QDataStream& stream, QWebHistory& history) -{ - QByteArray buffer; - stream >> buffer; - history.restoreState(buffer); - return stream; + return source; } QWebPagePrivate* QWebHistoryPrivate::page() diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.h index e46f124..cce4553 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.h @@ -42,9 +42,6 @@ public: QWebHistoryItem &operator=(const QWebHistoryItem &other); ~QWebHistoryItem(); - //bool restoreState(QByteArray& buffer); - //QByteArray saveState(QWebHistory::HistoryStateVersion version = DefaultHistoryVersion) const; - QUrl originalUrl() const; QUrl url() const; @@ -69,22 +66,10 @@ private: QExplicitlySharedDataPointer<QWebHistoryItemPrivate> d; }; -//QWEBKIT_EXPORT QDataStream & operator<<(QDataStream& out,const QWebHistoryItem& hist); -//QWEBKIT_EXPORT QDataStream & operator>>(QDataStream& in,QWebHistoryItem& hist); - class QWebHistoryPrivate; class QWEBKIT_EXPORT QWebHistory { public: - enum HistoryStateVersion { - HistoryVersion_1, - /*, HistoryVersion_2, */ - DefaultHistoryVersion = HistoryVersion_1 - }; - - bool restoreState(const QByteArray& buffer); - QByteArray saveState(HistoryStateVersion version = DefaultHistoryVersion) const; - void clear(); QList<QWebHistoryItem> items() const; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 764bfad..6f1347c 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -77,6 +77,7 @@ #include "LocalizedStrings.h" #include "Cache.h" #include "runtime/InitializeThreading.h" +#include "PageGroup.h" #include <QApplication> #include <QBasicTimer> @@ -262,7 +263,9 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions) QWebPagePrivate::QWebPagePrivate(QWebPage *qq) : q(qq) , client(0) +#if QT_VERSION < 0x040600 , view(0) +#endif , inspectorFrontend(0) , inspector(0) , inspectorIsInternalOnly(false) @@ -302,6 +305,8 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) history.d = new QWebHistoryPrivate(page->backForwardList()); memset(actions, 0, sizeof(actions)); + + PageGroup::setShouldTrackVisitedLinks(true); } QWebPagePrivate::~QWebPagePrivate() @@ -378,7 +383,7 @@ static QWebPage::WebAction webActionForContextMenuAction(WebCore::ContextMenuAct QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMenu, const QList<WebCore::ContextMenuItem> *items, QBitArray *visitedWebActions) { - QMenu* menu = new QMenu(view); + QMenu* menu = new QMenu(q->view()); for (int i = 0; i < items->count(); ++i) { const ContextMenuItem &item = items->at(i); switch (item.type()) { @@ -759,13 +764,13 @@ void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button) { #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - if (view && view->testAttribute(Qt::WA_InputMethodEnabled) + if (q->view() && q->view()->testAttribute(Qt::WA_InputMethodEnabled) && button == Qt::LeftButton && qApp->autoSipEnabled()) { QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( - view->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); + q->view()->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) { QEvent event(QEvent::RequestSoftwareInputPanel); - QApplication::sendEvent(view, &event); + QApplication::sendEvent(q->view(), &event); } } @@ -909,8 +914,8 @@ void QWebPagePrivate::keyPressEvent(QKeyEvent *ev) if (!handled) { handled = true; QFont defaultFont; - if (view) - defaultFont = view->font(); + if (q->view()) + defaultFont = q->view()->font(); QFontMetrics fm(defaultFont); if (!handleScrolling(ev, frame)) { switch (ev->key()) { @@ -1665,7 +1670,7 @@ QWebHistory *QWebPage::history() const */ void QWebPage::setView(QWidget *view) { - if (d->view != view) { + if (this->view() != view) { d->view = view; setViewportSize(view ? view->size() : QSize(0, 0)); } @@ -1678,7 +1683,11 @@ void QWebPage::setView(QWidget *view) */ QWidget *QWebPage::view() const { +#if QT_VERSION < 0x040600 return d->view; +#else + return d->view.data(); +#endif } /*! @@ -1705,7 +1714,7 @@ void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg) { Q_UNUSED(frame) #ifndef QT_NO_MESSAGEBOX - QMessageBox::information(d->view, tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), msg, QMessageBox::Ok); + QMessageBox::information(view(), tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), msg, QMessageBox::Ok); #endif } @@ -1721,7 +1730,7 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg) #ifdef QT_NO_MESSAGEBOX return true; #else - return QMessageBox::Yes == QMessageBox::information(d->view, tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()), msg, QMessageBox::Yes, QMessageBox::No); + return QMessageBox::Yes == QMessageBox::information(view(), tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()), msg, QMessageBox::Yes, QMessageBox::No); #endif } @@ -1739,7 +1748,7 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr Q_UNUSED(frame) bool ok = false; #ifndef QT_NO_INPUTDIALOG - QString x = QInputDialog::getText(d->view, tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), msg, QLineEdit::Normal, defaultValue, &ok); + QString x = QInputDialog::getText(view(), tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), msg, QLineEdit::Normal, defaultValue, &ok); if (ok && result) *result = x; #endif @@ -1764,7 +1773,7 @@ bool QWebPage::shouldInterruptJavaScript() #ifdef QT_NO_MESSAGEBOX return false; #else - return QMessageBox::Yes == QMessageBox::information(d->view, tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No); + return QMessageBox::Yes == QMessageBox::information(view(), tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No); #endif } @@ -1781,7 +1790,7 @@ bool QWebPage::shouldInterruptJavaScript() */ QWebPage *QWebPage::createWindow(WebWindowType type) { - QWebView *webView = qobject_cast<QWebView *>(d->view); + QWebView *webView = qobject_cast<QWebView *>(view()); if (webView) { QWebView *newView = webView->createWindow(type); if (newView) @@ -2764,7 +2773,7 @@ bool QWebPage::extension(Extension extension, const ExtensionOption *option, Ext if (extension == ChooseMultipleFilesExtension) { // FIXME: do not ignore suggestedFiles QStringList suggestedFiles = static_cast<const ChooseMultipleFilesExtensionOption*>(option)->suggestedFileNames; - QStringList names = QFileDialog::getOpenFileNames(d->view, QString::null); + QStringList names = QFileDialog::getOpenFileNames(view(), QString::null); static_cast<ChooseMultipleFilesExtensionReturn*>(output)->fileNames = names; return true; } @@ -2846,7 +2855,7 @@ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFil { Q_UNUSED(parentFrame) #ifndef QT_NO_FILEDIALOG - return QFileDialog::getOpenFileName(d->view, QString::null, suggestedFile); + return QFileDialog::getOpenFileName(view(), QString::null, suggestedFile); #else return QString::null; #endif @@ -3109,8 +3118,8 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const // Language QLocale locale; - if (d->view) - locale = d->view->locale(); + if (view()) + locale = view()->locale(); QString name = locale.name(); name[2] = QLatin1Char('-'); ua.append(name); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h index b9571fa..f0f842d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h @@ -135,7 +135,12 @@ public: #ifndef QT_NO_UNDOSTACK QUndoStack *undoStack; #endif + +#if QT_VERSION >= 0x040600 + QWeakPointer<QWidget> view; +#else QWidget* view; +#endif bool insideOpenCall; quint64 m_totalBytes; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp index 7c44e37..2a225c5 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp @@ -30,6 +30,16 @@ using namespace WebCore; +void QWEBKIT_EXPORT qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) +{ + SecurityOrigin::whiteListAccessFromOrigin(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains); +} + +void QWEBKIT_EXPORT qt_drt_resetOriginAccessWhiteLists() +{ + SecurityOrigin::resetOriginAccessWhiteLists(); +} + /*! \class QWebSecurityOrigin \since 4.5 @@ -239,21 +249,3 @@ QStringList QWebSecurityOrigin::localSchemes() } return list; } - -/*! - \since 4.6 - \internal -*/ -void QWebSecurityOrigin::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) -{ - SecurityOrigin::whiteListAccessFromOrigin(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains); -} - -/*! - \since 4.6 - \internal -*/ -void QWebSecurityOrigin::resetOriginAccessWhiteLists() -{ - SecurityOrigin::resetOriginAccessWhiteLists(); -} diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h index 94b96f0..16f8bc1 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h @@ -40,8 +40,6 @@ public: static void addLocalScheme(const QString& scheme); static void removeLocalScheme(const QString& scheme); static QStringList localSchemes(); - static void whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); - static void resetOriginAccessWhiteLists(); ~QWebSecurityOrigin(); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index cb487ce..b9c2f74 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -246,7 +246,11 @@ QWebView::QWebView(QWidget *parent) QWebView::~QWebView() { if (d->page) { +#if QT_VERSION >= 0x040600 + d->page->d->view.clear(); +#else d->page->d->view = 0; +#endif d->page->d->client = 0; } @@ -324,79 +328,6 @@ void QWebView::setPage(QWebPage* page) } /*! - Returns a valid URL from a user supplied \a string if one can be deducted. - In the case that is not possible, an invalid QUrl() is returned. - - \since 4.6 - - Most applications that can browse the web, allow the user to input a URL - in the form of a plain string. This string can be manually typed into - a location bar, obtained from the clipboard, or passed in via command - line arguments. - - When the string is not already a valid URL, a best guess is performed, - making various web related assumptions. - - In the case the string corresponds to a valid file path on the system, - a file:// URL is constructed, using QUrl::fromLocalFile(). - - If that is not the case, an attempt is made to turn the string into a - http:// or ftp:// URL. The latter in the case the string starts with - 'ftp'. The result is then passed through QUrl's tolerant parser, and - in the case or success, a valid QUrl is returned, or else a QUrl(). - - \section1 Examples: - - \list - \o webkit.org becomes http://webkit.org - \o ftp.webkit.org becomes ftp://ftp.webkit.org - \o localhost becomes http://localhost - \o /home/user/test.html becomes file:///home/user/test.html (if exists) - \endlist - - \section2 Tips when dealing with URLs and strings: - - \list - \o When creating a QString from a QByteArray or a char*, always use - QString::fromUtf8(). - \o Do not use QUrl(string), nor QUrl::toString() anywhere where the URL might - be used, such as in the location bar, as those functions loose data. - Instead use QUrl::fromEncoded() and QUrl::toEncoded(), respectively. - \endlist - */ -QUrl QWebView::guessUrlFromString(const QString &string) -{ - QString trimmedString = string.trimmed(); - - // Check the most common case of a valid url with scheme and host first - QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode); - if (url.isValid() && !url.scheme().isEmpty() && !url.host().isEmpty()) - return url; - - // Absolute files that exists - if (QDir::isAbsolutePath(trimmedString) && QFile::exists(trimmedString)) - return QUrl::fromLocalFile(trimmedString); - - // If the string is missing the scheme or the scheme is not valid prepend a scheme - QString scheme = url.scheme(); - if (scheme.isEmpty() || scheme.contains(QLatin1Char('.')) || scheme == QLatin1String("localhost")) { - // Do not do anything for strings such as "foo", only "foo.com" - int dotIndex = trimmedString.indexOf(QLatin1Char('.')); - if (dotIndex != -1 || trimmedString.startsWith(QLatin1String("localhost"))) { - const QString hostscheme = trimmedString.left(dotIndex).toLower(); - QByteArray scheme = (hostscheme == QLatin1String("ftp")) ? "ftp" : "http"; - trimmedString = QLatin1String(scheme) + QLatin1String("://") + trimmedString; - } - url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode); - } - - if (url.isValid()) - return url; - - return QUrl(); -} - -/*! Loads the specified \a url and displays it. \note The view remains the same until enough data has arrived to display the new \a url. @@ -684,24 +615,38 @@ qreal QWebView::textSizeMultiplier() const return page()->mainFrame()->textSizeMultiplier(); } -#if !defined(Q_OS_SYMBIAN) /*! \property QWebView::renderHints \since 4.6 \brief the default render hints for the view - These hints are used to initialize QPainter before painting the web page. + These hints are used to initialize QPainter before painting the Web page. QPainter::TextAntialiasing is enabled by default. + \note This property is not available on Symbian. However, the getter and + setter functions can still be used directly. + + \sa QPainter::renderHints() +*/ + +/*! + \since 4.6 + Returns the render hints used by the view to render content. + \sa QPainter::renderHints() */ -#endif QPainter::RenderHints QWebView::renderHints() const { return d->renderHints; } +/*! + \since 4.6 + Sets the render hints used by the view to the specified \a hints. + + \sa QPainter::setRenderHints() +*/ void QWebView::setRenderHints(QPainter::RenderHints hints) { if (hints == d->renderHints) @@ -711,11 +656,11 @@ void QWebView::setRenderHints(QPainter::RenderHints hints) } /*! - If \a enabled is true, the render hint \a hint is enabled; otherwise it - is disabled. - \since 4.6 - \sa renderHints + If \a enabled is true, enables the specified render \a hint; otherwise + disables it. + + \sa renderHints, QPainter::renderHints() */ void QWebView::setRenderHint(QPainter::RenderHint hint, bool enabled) { diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h index 15b5836..e9c1ec8 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h @@ -53,9 +53,8 @@ class QWEBKIT_EXPORT QWebView : public QWidget { // FIXME: temporary work around for elftran issue that it couldn't find the QPainter::staticMetaObject // symbol from Qt lib; it should be reverted after the right symbol is exported. -// remember to revert the qdoc \property comment as well. // See bug: http://qt.nokia.com/developer/task-tracker/index_html?method=entry&id=258893 -#if !defined(Q_OS_SYMBIAN) +#if defined(Q_QDOC) || !defined(Q_OS_SYMBIAN) Q_PROPERTY(QPainter::RenderHints renderHints READ renderHints WRITE setRenderHints) #endif Q_FLAGS(QPainter::RenderHints) @@ -66,8 +65,6 @@ public: QWebPage* page() const; void setPage(QWebPage* page); - static QUrl guessUrlFromString(const QString& string); - void load(const QUrl& url); #if QT_VERSION < 0x040400 && !defined(qdoc) void load(const QWebNetworkRequest& request); diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 7987613..b19a1d0 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,484 @@ +2009-10-29 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Remove QWebView::guessUrlFromString() and replace its use + with the new QUrl::fromUserInput() if using Qt 4.6 or newer. + + * Api/qwebview.cpp: + * Api/qwebview.h: + * QGVLauncher/main.cpp: + (urlFromUserInput): + (WebPage::applyProxy): + (MainWindow::load): + * QtLauncher/main.cpp: + (urlFromUserInput): + (MainWindow::MainWindow): + (MainWindow::changeLocation): + * tests/qwebview/tst_qwebview.cpp: + +2009-10-28 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Serialize directly to the stream, and not first to an QByteArray, + that is later serialized. That is slower and also uses more bytes. + + * Api/qwebhistory.cpp: + (operator<<): + (operator>>): + +2009-10-28 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Eric Seidel. + + [Qt] WebFrame::counterValueForElementById must not be exposed + https://bugs.webkit.org/show_bug.cgi?id=30882 + + * Api/qwebframe.cpp: + (qt_drt_counterValueForElementById): + * Api/qwebframe.h: + +2009-10-27 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + Provide a way to get counter values with layoutTestContoller + https://bugs.webkit.org/show_bug.cgi?id=30555 + + * Api/qwebframe.cpp: + (QWebFrame::counterValueForElementById): + (QWebHitTestResult::frame): + * Api/qwebframe.h: + +2009-10-28 Antonio Gomes <tonikitoo@webkit.org> + + Pushing missing WebKit/qt/tests/qwebframe/resources/ dir from bug 29248. + + [Qt] [API] Make it possible to have 'invisible' loads + https://bugs.webkit.org/show_bug.cgi?id=29248 + + * tests/qwebframe/resources/image2.png: Copied from WebKit/qt/tests/qwebelement/image.png. + +2009-10-28 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + [Qt] QWebHistory::saveState() is inconsistent with the Qt API + https://bugs.webkit.org/show_bug.cgi?id=30710 + + Make the versioning internal and enforce it in the WebCore + part. Adjust the comments, as well as remove now dead code. + + * Api/qwebhistory.cpp: + (operator<<): + (operator>>): + * Api/qwebhistory.h: + +2009-10-28 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Holger Freyther. + + [Qt] QWebHistory::saveState() is inconsistent with the Qt API + https://bugs.webkit.org/show_bug.cgi?id=30710 + + Remove the QWebHistory::saveState() and ::restoreState() as + they are inconsistent with the Qt API. + + Update unittests to reflect the change. + + * Api/qwebhistory.cpp: + (operator<<): + (operator>>): + * Api/qwebhistory.h: + * tests/qwebhistory/tst_qwebhistory.cpp: + (saveHistory): + (restoreHistory): + (tst_QWebHistory::saveAndRestore_crash_1): + (tst_QWebHistory::saveAndRestore_crash_2): + (tst_QWebHistory::saveAndRestore_crash_3): + (tst_QWebHistory::clear): + +2009-10-27 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Holger Freyther. + + Complementary fix to bug 30779. + + By mistake I used QWeakPointer's toStrongRef() method which docs + explicitly say to not be used in this situation (when the tracked + pointer is devired from QObject). Instead QWeakPointer's data() + is recommended. + + * Api/qwebpage.cpp: + (QWebPage::view): + +2009-10-27 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Simon Fraser. + + Change HitTestResult methods to use (3d) transformation aware methods + https://bugs.webkit.org/show_bug.cgi?id=27347 + + The HitTestResult::boundingBox method was removed. The + RenderObject must be used directly. In contrast to the + old HitTestResult::boundingBox method this code must use + a (3d) transformation aware method to not run into an + assert in SVGRenderBase::mapLocalToContainer. + + * Api/qwebframe.cpp: + (QWebHitTestResultPrivate::QWebHitTestResultPrivate): + +2009-10-27 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Rubberstamped by Oliver Hunt. + + Change two methods to be internal for DRT use only. + + Part of [Qt] Review all new API in Qt 4.6 + https://bugs.webkit.org/show_bug.cgi?id=29843#c11 + + * Api/qwebsecurityorigin.cpp: + (qt_drt_whiteListAccessFromOrigin): + (qt_drt_resetOriginAccessWhiteLists): + (QWebSecurityOrigin::localSchemes): + * Api/qwebsecurityorigin.h: + +2009-10-27 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Make sure that initiating a rotation while rotating won't make + it end up at rotation positions that are not a multiply of + 180 degrees. + + * QGVLauncher/main.cpp: + (MainView::animatedFlip): + +2009-10-27 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Unreviewed Qt build fix. + + Update the tests as well to the new API change. + + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::clear): + +2009-10-27 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Rubberstamped by Tor Arne Vestbø. + + [Qt] QWebElement::removeChildren() should be + QWebElement::removeAllChildren() + https://bugs.webkit.org/show_bug.cgi?id=30630 + + * Api/qwebelement.cpp: + (QWebElement::removeAllChildren): + * Api/qwebelement.h: + +2009-10-27 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Antti Koivisto and Holger Freyther. + + Make QWebPagePrivate's (QWidget) view to be a QWeakPointer. + https://bugs.webkit.org/show_bug.cgi?id=30779 + + The fact that it was been set from external objects of qwebpage + and not being deleted internally can lead to dangling references. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::~QGraphicsWebView): + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + (QWebPagePrivate::createContextMenu): + (QWebPagePrivate::handleSoftwareInputPanel): + (QWebPagePrivate::keyPressEvent): + (QWebPage::setView): + (QWebPage::view): + (QWebPage::javaScriptAlert): + (QWebPage::javaScriptConfirm): + (QWebPage::javaScriptPrompt): + (QWebPage::shouldInterruptJavaScript): + (QWebPage::createWindow): + (QWebPage::extension): + (QWebPage::chooseFile): + (QWebPage::userAgentForUrl): + * Api/qwebpage_p.h: + * Api/qwebview.cpp: + (QWebView::~QWebView): + +2009-10-26 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Unreviewed documentation fix from David Boddie (Qt Doc Team) + + Removes the check around the RenderHints property documentation + that was clearly added to synchronize the source and header files + when the #if !defined(Q_OS_SYMBIAN) guards was added to the + property. + + The documentation has also been updated to ensure that Symbian + users know that there is no actual RenderHints property on their + platform. + + * Api/qwebview.cpp: + +2009-10-26 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Unreviewed documentation fix from David Boddie (Qt Doc Team) + + Ensure that qdoc will always see the RenderHints property. + + The property was only defined in the header file if the Q_OS_SYMBIAN + symbol was not defined, resulting in the property not showing up + in the Qt documentation just because one platform doesn't support it. + + A follow up commit will improve the documentation for the property + and note that it is not supported on the Symbiam platform. + + * Api/qwebview.h: + +2009-10-26 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Reintroduce QWebElementCollection + + Revert the patch that has replaced QWebElementCollection + with QList<QWebElement>. Update the tests accordingly. + + Remove the constness of the return type of QWebElement operator[]. + + https://bugs.webkit.org/show_bug.cgi?id=30767 + + * Api/qwebelement.cpp: + (QWebElement::findAll): + (QWebElementCollectionPrivate::QWebElementCollectionPrivate): + (QWebElementCollectionPrivate::create): + (QWebElementCollection::QWebElementCollection): + (QWebElementCollection::operator=): + (QWebElementCollection::~QWebElementCollection): + (QWebElementCollection::operator+): + (QWebElementCollection::append): + (QWebElementCollection::count): + (QWebElementCollection::at): + (QWebElementCollection::toList): + * Api/qwebelement.h: + (const_iterator::begin): + (const_iterator::end): + (const_iterator::operator[]): + * Api/qwebframe.cpp: + (QWebFrame::findAllElements): + * Api/qwebframe.h: + * QtLauncher/main.cpp: + (MainWindow::selectElements): + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::simpleCollection): + (tst_QWebElement::iteration): + (tst_QWebElement::emptyCollection): + (tst_QWebElement::appendCollection): + (tst_QWebElement::nullSelect): + (tst_QWebElement::hasSetFocus): + (tst_QWebElement::render): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + +2009-10-24 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Holger Freyther. + + [Qt] [Symbian] Set the capability and memory required to run QtWebKit for Symbian + https://bugs.webkit.org/show_bug.cgi?id=30476 + + Assign ReadUserData WriteUserData NetworkServices Symbian capabilities + to all QtWebkit executables. + + * QGVLauncher/QGVLauncher.pro: + * QtLauncher/QtLauncher.pro: + * tests/benchmarks/loading/tst_loading.pro: + * tests/benchmarks/painting/tst_painting.pro: + * tests/qgraphicswebview/qgraphicswebview.pro: + * tests/qwebelement/qwebelement.pro: + * tests/qwebframe/qwebframe.pro: + * tests/qwebhistory/qwebhistory.pro: + * tests/qwebhistoryinterface/qwebhistoryinterface.pro: + * tests/qwebpage/qwebpage.pro: + * tests/qwebplugindatabase/qwebplugindatabase.pro: + * tests/qwebview/qwebview.pro: + +2009-10-22 Gavin Barraclough <barraclough@apple.com> + + Reviewed by NOBODY (speculative build fix - qt is currently already broken!) + Build fix following bug #30696. + + * Api/qwebelement.cpp: + (setupScriptContext): + * Api/qwebframe.cpp: + (QWebFrame::evaluateJavaScript): + +2009-10-22 Shu Chang <Chang.Shu@nokia.com> + + Reviewed by Eric Seidel. + + [Qt] Enable track visited links in QWebPage + https://bugs.webkit.org/show_bug.cgi?id=30574 + + Test: fast/history/clicked-link-is-visited.html + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + +2009-10-22 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Eric Seidel. + + [Qt] Add Print Shortcut to QtLauncher + + https://bugs.webkit.org/show_bug.cgi?id=30682 + + * QtLauncher/main.cpp: + (MainWindow::setupUI): + +2009-10-22 Antonio Gomes <tonikitoo@webkit.org> + + Rubberstamped by Tor Arne Vestbø. + + Code standarlization for QGVLauncher. + + 1) Made member initilization lists in constructors + to be per line. + 2) Made applyProxy method inline as all other methods in + WebPage class. + + * QGVLauncher/main.cpp: + (WebPage::WebPage): + (WebPage::applyProxy): + (MainView::MainView): + (MainWindow::MainWindow): + (MainWindow::init): + +2009-10-22 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Add a Y-Axis rotation to QGVLauncher. + + It uses the QStateMachine API from Qt 4.6. + + * QGVLauncher/main.cpp: + (WebView::WebView): + (WebView::setYRotation): + (WebView::yRotation): + (MainView::flip): + (MainView::animatedYFlip): + (SharedScene::SharedScene): + (SharedScene::webView): + (MainWindow::init): + (MainWindow::animatedYFlip): + (MainWindow::buildUI): + +2009-10-20 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed By Adam Barth. + + Add some actions to the menu for cursor debugging. + + GraphicsView based launcher only. + + * QGVLauncher/main.cpp: + (MainView::setWaitCursor): + (MainView::resetCursor): + (MainView::flip): + (MainWindow::setWaitCursor): + (MainWindow::resetCursor): + (MainWindow::buildUI): + +2009-10-20 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Rubberstamped by Adam Barth. + + Remove clipRenderToViewport as agreed upon in + https://bugs.webkit.org/show_bug.cgi?id=29843 + + * Api/qwebframe.cpp: + * Api/qwebframe.h: + * Api/qwebframe_p.h: + (QWebFramePrivate::QWebFramePrivate): + +2009-10-20 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Adam Barth. + + Update the tests to test the new render functionality, and take + into consideration that render() clips to the frame itself as well + as the viewport. + + QWebFrame::render() now always clips, so the old tests were bogus. + + Rendering pure contents (no scrollbars etc) without clipping can now + be accomplished using QWebFrame::documentElement()->render(...) + + * Api/qwebframe.cpp: + * Api/qwebframe.h: + * Api/qwebframe_p.h: + (QWebFramePrivate::QWebFramePrivate): + * tests/qwebframe/tst_qwebframe.cpp: + +2009-10-20 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Rubberstamped by Adam Barth. + + As we do not support rendering a QWebFrame without it being clipped + the the frame as well as the viewport, we now set the viewport size + to the size of the contents. + + Rendering pure contents (no scrollbars etc) without clipping can be + acomplished using QWebFrame::documentElement()->render(...) + + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::render): + +2009-10-20 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Add menu item to dump the plugin list to the console, + which can be handy for debugging. + + * QtLauncher/main.cpp: + (MainWindow::dumpPlugins): + (MainWindow::setupUI): + +2009-10-19 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Introduce new render method on QWebFrame, which supports specifying + which layers to render (scrollbars, contents, pan-icon). + + * Api/qwebframe.cpp: + (QWebFramePrivate::renderPrivate): + (QWebFrame::render): + * Api/qwebframe.h: + * Api/qwebframe_p.h: + +2009-10-19 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Ariya Hidayat. + + [Qt] Infinite loop (leading to crash) when setting cursor in QGraphicsWebView + https://bugs.webkit.org/show_bug.cgi?id=30549 + + Patch reimplements QGraphicsItem's itemChange method, and make + CursorChange event to be emitted after cursor has already been + set. + + QWidget::setCursor send the event just after it sets the cursor, + then patch makes both behaviors compatible. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::itemChange): + * Api/qgraphicswebview.h: + 2009-10-19 Nate Chapin <japhet@chromium.org> Unreviewed, build fix. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 81ccbe8..1ed9b21 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -708,7 +708,7 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c WebCore::ResourceError FrameLoaderClientQt::cancelledError(const WebCore::ResourceRequest& request) { ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url().prettyURL(), - QCoreApplication::translate("QWebFrame", "Request cancelled", 0, QCoreApplication::UnicodeUTF8)); + QCoreApplication::translate("QWebFrame", "Request canceled", 0, QCoreApplication::UnicodeUTF8)); error.setIsCancellation(true); return error; } @@ -746,7 +746,7 @@ WebCore::ResourceError FrameLoaderClientQt::interruptForPolicyChangeError(const WebCore::ResourceError FrameLoaderClientQt::cannotShowMIMETypeError(const WebCore::ResourceResponse& response) { return ResourceError("WebKit", WebKitErrorCannotShowMIMEType, response.url().string(), - QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0, QCoreApplication::UnicodeUTF8)); + QCoreApplication::translate("QWebFrame", "Cannot show MIME type", 0, QCoreApplication::UnicodeUTF8)); } WebCore::ResourceError FrameLoaderClientQt::fileDoesNotExistError(const WebCore::ResourceResponse& response) diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc index 09dfae5..408478c 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc @@ -31,7 +31,7 @@ the module under the appropriate version of the GNU LGPL; version 2.1 for applications and libraries licensed under the GNU GPL version 2, or version 3 for applications and libraries licensed under the GNU - GPL version 2. + GPL version 3. \legalese WebKit is licensed under the GNU Library General Public License. diff --git a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro index 80717c2..bc5e75f 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro @@ -5,4 +5,7 @@ SOURCES += tst_loading.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0xA000E541 +symbian { + TARGET.UID3 = 0xA000E541 + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro index f45d804..48c7072 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro @@ -5,4 +5,7 @@ SOURCES += tst_painting.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0xA000E542 +symbian { + TARGET.UID3 = 0xA000E542 + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro index cba6f11..57b4437 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro @@ -4,3 +4,7 @@ include(../../../../WebKit.pri) SOURCES += tst_qgraphicswebview.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian { + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro index 0a140ad..c45a9ac 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro @@ -6,4 +6,7 @@ RESOURCES += qwebelement.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0xA000E53A +symbian { + TARGET.UID3 = 0xA000E53A + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp index db2f7d7..cf83fe8 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp @@ -70,7 +70,10 @@ private slots: void attributesNS(); void classes(); void namespaceURI(); + void iteration(); void foreachManipulation(); + void emptyCollection(); + void appendCollection(); void evaluateJavaScript(); void documentElement(); void frame(); @@ -134,7 +137,7 @@ void tst_QWebElement::simpleCollection() m_mainFrame->setHtml(html); QWebElement body = m_mainFrame->documentElement(); - QList<QWebElement> list = body.findAll("p"); + QWebElementCollection list = body.findAll("p"); QCOMPARE(list.count(), 2); QCOMPARE(list.at(0).toPlainText(), QString("first para")); QCOMPARE(list.at(1).toPlainText(), QString("second para")); @@ -267,6 +270,41 @@ void tst_QWebElement::namespaceURI() } +void tst_QWebElement::iteration() +{ + QString html = "<body><p>first para</p><p>second para</p></body>"; + m_mainFrame->setHtml(html); + QWebElement body = m_mainFrame->documentElement(); + + QWebElementCollection paras = body.findAll("p"); + QList<QWebElement> referenceList = paras.toList(); + + QList<QWebElement> foreachList; + foreach(QWebElement p, paras) { + foreachList.append(p); + } + QVERIFY(foreachList.count() == 2); + QCOMPARE(foreachList.count(), referenceList.count()); + QCOMPARE(foreachList.at(0), referenceList.at(0)); + QCOMPARE(foreachList.at(1), referenceList.at(1)); + + QList<QWebElement> forLoopList; + for (int i = 0; i < paras.count(); ++i) { + forLoopList.append(paras.at(i)); + } + QVERIFY(foreachList.count() == 2); + QCOMPARE(foreachList.count(), referenceList.count()); + QCOMPARE(foreachList.at(0), referenceList.at(0)); + QCOMPARE(foreachList.at(1), referenceList.at(1)); + + for (int i = 0; i < paras.count(); ++i) { + QCOMPARE(paras.at(i), paras[i]); + } + + QCOMPARE(paras.at(0), paras.first()); + QCOMPARE(paras.at(1), paras.last()); +} + void tst_QWebElement::foreachManipulation() { QString html = "<body><p>first para</p><p>second para</p></body>"; @@ -280,6 +318,43 @@ void tst_QWebElement::foreachManipulation() QCOMPARE(body.findAll("div").count(), 4); } +void tst_QWebElement::emptyCollection() +{ + QWebElementCollection emptyCollection; + QCOMPARE(emptyCollection.count(), 0); +} + +void tst_QWebElement::appendCollection() +{ + QString html = "<body><span class='a'>aaa</span><p>first para</p><div>foo</div>" + "<span class='b'>bbb</span><p>second para</p><div>bar</div></body>"; + m_mainFrame->setHtml(html); + QWebElement body = m_mainFrame->documentElement(); + + QWebElementCollection collection = body.findAll("p"); + QCOMPARE(collection.count(), 2); + + collection.append(body.findAll("div")); + QCOMPARE(collection.count(), 4); + + collection += body.findAll("span.a"); + QCOMPARE(collection.count(), 5); + + QWebElementCollection all = collection + body.findAll("span.b"); + QCOMPARE(all.count(), 6); + QCOMPARE(collection.count(), 5); + + all += collection; + QCOMPARE(all.count(), 11); + + QCOMPARE(collection.count(), 5); + QWebElementCollection test; + test.append(collection); + QCOMPARE(test.count(), 5); + test.append(QWebElementCollection()); + QCOMPARE(test.count(), 5); +} + void tst_QWebElement::evaluateJavaScript() { QVariant result; @@ -629,7 +704,7 @@ void tst_QWebElement::clear() QCOMPARE(body.findAll("div").count(), 1); QCOMPARE(body.findAll("p").count(), 3); - body.findFirst("div").removeChildren(); + body.findFirst("div").removeAllChildren(); QCOMPARE(body.findAll("div").count(), 1); QCOMPARE(body.findAll("p").count(), 2); } @@ -773,7 +848,7 @@ void tst_QWebElement::nullSelect() { m_mainFrame->setHtml("<body><p>Test"); - QList<QWebElement> collection = m_mainFrame->findAllElements("invalid{syn(tax;;%#$f223e>>"); + QWebElementCollection collection = m_mainFrame->findAllElements("invalid{syn(tax;;%#$f223e>>"); QVERIFY(collection.count() == 0); } @@ -815,7 +890,7 @@ void tst_QWebElement::hasSetFocus() "<input type='text' id='input2'/>" \ "</body></html>"); - QList<QWebElement> inputs = m_mainFrame->documentElement().findAll("input"); + QWebElementCollection inputs = m_mainFrame->documentElement().findAll("input"); QWebElement input1 = inputs.at(0); input1.setFocus(); QVERIFY(input1.hasFocus()); @@ -851,7 +926,10 @@ void tst_QWebElement::render() waitForSignal(&page, SIGNAL(loadFinished(bool))); QCOMPARE(loadSpy.count(), 1); - QList<QWebElement> imgs = page.mainFrame()->findAllElements("img"); + QSize size = page.mainFrame()->contentsSize(); + page.setViewportSize(size); + + QWebElementCollection imgs = page.mainFrame()->findAllElements("img"); QCOMPARE(imgs.count(), 1); QImage resource(":/image.png"); @@ -882,7 +960,7 @@ void tst_QWebElement::render() // compare table rendered through QWebElement::render to whole page table rendering QRect tableRect(0, 0, 300, 300); - QList<QWebElement> tables = page.mainFrame()->findAllElements("table"); + QWebElementCollection tables = page.mainFrame()->findAllElements("table"); QCOMPARE(tables.count(), 1); QImage image3(300, 300, QImage::Format_ARGB32); @@ -893,7 +971,6 @@ void tst_QWebElement::render() QImage image4(300, 300, QImage::Format_ARGB32); QPainter painter4(&image4); - page.mainFrame()->setClipRenderToViewport(false); page.mainFrame()->render(&painter4, tableRect); painter4.end(); diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro index 4c92e91..0e540e5 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -7,4 +7,7 @@ QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR DEFINES += SRCDIR=\\\"$$PWD/resources\\\" -symbian:TARGET.UID3 = 0xA000E53D +symbian { + TARGET.UID3 = 0xA000E53D + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/image2.png b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/image2.png Binary files differnew file mode 100644 index 0000000..8d70364 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/image2.png diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 100f272..5445ce8 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -2668,26 +2668,24 @@ void tst_QWebFrame::render() QPicture picture; - // render clipping to Viewport - frame->setClipRenderToViewport(true); + QSize size = page.mainFrame()->contentsSize(); + page.setViewportSize(size); + + // render contents layer only (the iframe is smaller than the image, so it will have scrollbars) QPainter painter1(&picture); - frame->render(&painter1); + frame->render(&painter1, QWebFrame::ContentsLayer); painter1.end(); - QSize size = page.mainFrame()->contentsSize(); - page.setViewportSize(size); - QCOMPARE(size.width(), picture.boundingRect().width()); // 100px - QCOMPARE(size.height(), picture.boundingRect().height()); // 100px + QCOMPARE(size.width(), picture.boundingRect().width() + frame->scrollBarGeometry(Qt::Vertical).width()); + QCOMPARE(size.height(), picture.boundingRect().height() + frame->scrollBarGeometry(Qt::Horizontal).height()); - // render without clipping to Viewport - frame->setClipRenderToViewport(false); + // render everything, should be the size of the iframe QPainter painter2(&picture); - frame->render(&painter2); + frame->render(&painter2, QWebFrame::AllLayers); painter2.end(); - QImage resource(":/image.png"); - QCOMPARE(resource.width(), picture.boundingRect().width()); // resource width: 128px - QCOMPARE(resource.height(), picture.boundingRect().height()); // resource height: 128px + QCOMPARE(size.width(), picture.boundingRect().width()); // width: 100px + QCOMPARE(size.height(), picture.boundingRect().height()); // height: 100px } void tst_QWebFrame::scrollPosition() diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro index 8ee63cc..7445e3b 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro @@ -6,4 +6,7 @@ RESOURCES += tst_qwebhistory.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0xA000E53B +symbian { + TARGET.UID3 = 0xA000E53B + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp index 4f4d3c4..ec2d497 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp @@ -56,9 +56,6 @@ private slots: void serialize_1(); //QWebHistory countity void serialize_2(); //QWebHistory index void serialize_3(); //QWebHistoryItem - void saveAndRestore_1(); //simple checks saveState and restoreState - void saveAndRestore_2(); //bad parameters saveState and restoreState - void saveAndRestore_3(); //try use different version void saveAndRestore_crash_1(); void saveAndRestore_crash_2(); void saveAndRestore_crash_3(); @@ -294,67 +291,40 @@ void tst_QWebHistory::serialize_3() QVERIFY(load.atEnd()); } -/** Simple checks should be a bit redundant to streaming operators */ -void tst_QWebHistory::saveAndRestore_1() +static void saveHistory(QWebHistory* history, QByteArray* in) { - QAction* actionBack = page->action(QWebPage::Back); - hist->back(); - waitForLoadFinished.exec(); - QVERIFY(actionBack->isEnabled()); - QByteArray buffer(hist->saveState()); - hist->clear(); - QVERIFY(!actionBack->isEnabled()); - QVERIFY(hist->count() == 1); - hist->restoreState(buffer); - - //check only few values, do not make full test - //because most of the code is shared with streaming operators - //and these are checked before - QCOMPARE(hist->count(), histsize); - QCOMPARE(hist->currentItemIndex(), histsize - 2); - QCOMPARE(hist->itemAt(0).title(), QString("page1")); - QCOMPARE(hist->itemAt(histsize - 1).title(), QString("page") + QString::number(histsize)); - QVERIFY(actionBack->isEnabled()); + in->clear(); + QDataStream save(in, QIODevice::WriteOnly); + save << *history; } -/** Check returns value if there are bad parameters. Actually, result - * is no so importent. The test shouldn't crash :-) */ -void tst_QWebHistory::saveAndRestore_2() +static void restoreHistory(QWebHistory* history, QByteArray* out) { - QByteArray buffer; - hist->restoreState(buffer); - QVERIFY(hist->count() == 1); - QVERIFY(hist->itemAt(0).isValid()); -} - -/** Try to use bad version value */ -void tst_QWebHistory::saveAndRestore_3() -{ - QByteArray tmp = hist->saveState((QWebHistory::HistoryStateVersion)29999); - QVERIFY(hist->saveState((QWebHistory::HistoryStateVersion)29999).isEmpty()); - QVERIFY(hist->count() == histsize); - QVERIFY(hist->itemAt(3).isValid()); + QDataStream load(out, QIODevice::ReadOnly); + load >> *history; } /** The test shouldn't crash */ void tst_QWebHistory::saveAndRestore_crash_1() { - QByteArray tmp = hist->saveState(); - for (unsigned i = 0; i < 5; i++){ - hist->restoreState(tmp); - hist->saveState(); + QByteArray buffer; + saveHistory(hist, &buffer); + for (unsigned i = 0; i < 5; i++) { + restoreHistory(hist, &buffer); + saveHistory(hist, &buffer); } } /** The test shouldn't crash */ void tst_QWebHistory::saveAndRestore_crash_2() { - QByteArray tmp = hist->saveState(); + QByteArray buffer; + saveHistory(hist, &buffer); QWebPage* page2 = new QWebPage(this); QWebHistory* hist2 = page2->history(); - for (unsigned i = 0; i < 5; i++){ - hist2->restoreState(tmp); - hist2->saveState(); + for (unsigned i = 0; i < 5; i++) { + restoreHistory(hist2, &buffer); + saveHistory(hist2, &buffer); } delete page2; } @@ -362,17 +332,18 @@ void tst_QWebHistory::saveAndRestore_crash_2() /** The test shouldn't crash */ void tst_QWebHistory::saveAndRestore_crash_3() { - QByteArray tmp = hist->saveState(); + QByteArray buffer; + saveHistory(hist, &buffer); QWebPage* page2 = new QWebPage(this); QWebHistory* hist1 = hist; QWebHistory* hist2 = page2->history(); - for (unsigned i = 0; i < 5; i++){ - hist1->restoreState(tmp); - hist2->restoreState(tmp); + for (unsigned i = 0; i < 5; i++) { + restoreHistory(hist1, &buffer); + restoreHistory(hist2, &buffer); QVERIFY(hist1->count() == hist2->count()); QVERIFY(hist1->count() == histsize); hist2->back(); - tmp = hist2->saveState(); + saveHistory(hist2, &buffer); hist2->clear(); } delete page2; @@ -381,15 +352,16 @@ void tst_QWebHistory::saveAndRestore_crash_3() /** ::clear */ void tst_QWebHistory::clear() { + QByteArray buffer; + QAction* actionBack = page->action(QWebPage::Back); QVERIFY(actionBack->isEnabled()); - hist->saveState(); + saveHistory(hist, &buffer); QVERIFY(hist->count() > 1); hist->clear(); QVERIFY(hist->count() == 1); // Leave current item. QVERIFY(!actionBack->isEnabled()); - QWebPage* page2 = new QWebPage(this); QWebHistory* hist2 = page2->history(); QVERIFY(hist2->count() == 0); diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro index 53e1afe..764f806 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro @@ -5,4 +5,7 @@ SOURCES += tst_qwebhistoryinterface.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0xA000E53C +symbian { + TARGET.UID3 = 0xA000E53C + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro index 101837a..6b28efd 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -7,4 +7,7 @@ QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR DEFINES += SRCDIR=\\\"$$PWD/\\\" -symbian:TARGET.UID3 = 0xA000E53E +symbian { + TARGET.UID3 = 0xA000E53E + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 21b3bc7..0cf85ee 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1270,7 +1270,7 @@ void tst_QWebPage::inputMethods() "</body></html>"); m_view->page()->mainFrame()->setFocus(); - QList<QWebElement> inputs = m_view->page()->mainFrame()->documentElement().findAll("input"); + QWebElementCollection inputs = m_view->page()->mainFrame()->documentElement().findAll("input"); QMouseEvent evpres(QEvent::MouseButtonPress, inputs.at(0).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); m_view->page()->event(&evpres); diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro index 1376ca5..569146a 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro @@ -5,4 +5,7 @@ SOURCES += tst_qwebplugindatabase.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0xA000E540 +symbian { + TARGET.UID3 = 0xA000E540 + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro index bba7c39..e67bb7a 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro @@ -6,4 +6,7 @@ QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR DEFINES += SRCDIR=\\\"$$PWD/\\\" -symbian:TARGET.UID3 = 0xA000E53F +symbian { + TARGET.UID3 = 0xA000E53F + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp index 9204223..fda979e 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -41,8 +41,6 @@ public slots: private slots: void renderHints(); - void guessUrlFromString_data(); - void guessUrlFromString(); void getWebKitVersion(); void reusePage_data(); @@ -105,68 +103,6 @@ void tst_QWebView::renderHints() QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing)); } -void tst_QWebView::guessUrlFromString_data() -{ - QTest::addColumn<QString>("string"); - QTest::addColumn<QUrl>("guessUrlFromString"); - - // Null - QTest::newRow("null") << QString() << QUrl(); - - // File - QDirIterator it(QDir::homePath()); - QString fileString; - int c = 0; - while (it.hasNext()) { - it.next(); - QTest::newRow(QString("file-%1").arg(c++).toLatin1()) << it.filePath() << QUrl::fromLocalFile(it.filePath()); - } - - // basic latin1 - QTest::newRow("unicode-0") << QString::fromUtf8("å.com/") << QUrl::fromEncoded(QString::fromUtf8("http://å.com/").toUtf8(), QUrl::TolerantMode); - // unicode - QTest::newRow("unicode-1") << QString::fromUtf8("λ.com/") << QUrl::fromEncoded(QString::fromUtf8("http://λ.com/").toUtf8(), QUrl::TolerantMode); - - // no scheme - QTest::newRow("add scheme-0") << "webkit.org" << QUrl("http://webkit.org"); - QTest::newRow("add scheme-1") << "www.webkit.org" << QUrl("http://www.webkit.org"); - QTest::newRow("add scheme-2") << "ftp.webkit.org" << QUrl("ftp://ftp.webkit.org"); - QTest::newRow("add scheme-3") << "webkit" << QUrl("webkit"); - - // QUrl's tolerant parser should already handle this - QTest::newRow("not-encoded-0") << "http://webkit.org/test page.html" << QUrl("http://webkit.org/test%20page.html"); - - // Make sure the :80, i.e. port doesn't screw anything up - QUrl portUrl("http://webkit.org"); - portUrl.setPort(80); - QTest::newRow("port-0") << "webkit.org:80" << portUrl; - QTest::newRow("port-1") << "http://webkit.org:80" << portUrl; - - // mailto doesn't have a ://, but is valid - QUrl mailto("ben@meyerhome.net"); - mailto.setScheme("mailto"); - QTest::newRow("mailto") << "mailto:ben@meyerhome.net" << mailto; - - // misc - QTest::newRow("localhost-0") << "localhost" << QUrl("http://localhost"); - QTest::newRow("localhost-1") << "localhost:80" << QUrl("http://localhost:80"); - QTest::newRow("spaces-0") << " http://webkit.org/test page.html " << QUrl("http://webkit.org/test%20page.html"); - - // FYI: The scheme in the resulting url user - QUrl authUrl("user:pass@domain.com"); - QTest::newRow("misc-1") << "user:pass@domain.com" << authUrl; -} - -// public static QUrl guessUrlFromString(QString const& string) -void tst_QWebView::guessUrlFromString() -{ - QFETCH(QString, string); - QFETCH(QUrl, guessUrlFromString); - - QUrl url = QWebView::guessUrlFromString(string); - QCOMPARE(url, guessUrlFromString); -} - void tst_QWebView::getWebKitVersion() { QVERIFY(qWebKitVersion().toDouble() > 0); diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h index 3d9539e..58565d6 100644 --- a/src/corelib/global/qconfig-minimal.h +++ b/src/corelib/global/qconfig-minimal.h @@ -123,9 +123,6 @@ #endif /* Images */ -#ifndef QT_NO_ICON -# define QT_NO_ICON -#endif #ifndef QT_NO_IMAGEFORMATPLUGIN # define QT_NO_IMAGEFORMATPLUGIN #endif @@ -258,9 +255,6 @@ #ifndef QT_NO_TEXTHTMLPARSER # define QT_NO_TEXTHTMLPARSER #endif -#ifndef QT_NO_THREAD -# define QT_NO_THREAD -#endif #ifndef QT_NO_CONCURRENT # define QT_NO_CONCURRENT #endif diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index 36c2cf9..9b3e817 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -43,6 +43,7 @@ * All features and their dependencies. * * This list is generated from $QTDIR/src/corelib/global/qfeatures.txt + * by $QTSRCDIR/util/scripts/make_qfeatures_dot_h */ // QAction @@ -54,6 +55,9 @@ // Color Names //#define QT_NO_COLORNAMES +// QtConcurrent +//#define QT_NO_CONCURRENT + // QCopChannel //#define QT_NO_COP @@ -75,15 +79,15 @@ // Effects //#define QT_NO_EFFECTS +// QFileSystemWatcher +//#define QT_NO_FILESYSTEMWATCHER + // Freetype Font Engine //#define QT_NO_FREETYPE // QGroupBox //#define QT_NO_GROUPBOX -// QIcon -//#define QT_NO_ICON - // QImageIOPlugin //#define QT_NO_IMAGEFORMATPLUGIN @@ -147,15 +151,15 @@ // Phonon::ObjectDescriptionModel //#define QT_NO_PHONON_OBJECTDESCRIPTIONMODEL -// Phonon::PlatformPlugin -//#define QT_NO_PHONON_PLATFORMPLUGIN - // Phonon::VideoWidget //#define QT_NO_PHONON_VIDEO // QPicture //#define QT_NO_PICTURE +// QProcess +//#define QT_NO_PROCESS + // QProgressBar //#define QT_NO_PROGRESSBAR @@ -174,9 +178,6 @@ // Decoration //#define QT_NO_QWS_DECORATION_DEFAULT -// QWSInputMethod -//#define QT_NO_QWS_INPUTMETHODS - // Keyboard //#define QT_NO_QWS_KEYBOARD @@ -261,6 +262,9 @@ // QSystemSemaphore //#define QT_NO_SYSTEMSEMAPHORE +// QSystemTrayIcon +//#define QT_NO_SYSTEMTRAYICON + // QTabletEvent //#define QT_NO_TABLETEVENT @@ -279,9 +283,6 @@ // QTextStream //#define QT_NO_TEXTSTREAM -// QThread -//#define QT_NO_THREAD - // QToolTip //#define QT_NO_TOOLTIP @@ -306,11 +307,6 @@ // //#define QT_NO_XMLSTREAM -// Accessibility -#if !defined(QT_NO_ACCESSIBILITY) && (defined(QT_NO_PROPERTIES)) -#define QT_NO_ACCESSIBILITY -#endif - // Animation #if !defined(QT_NO_ANIMATION) && (defined(QT_NO_PROPERTIES)) #define QT_NO_ANIMATION @@ -331,11 +327,6 @@ #define QT_NO_CODECS #endif -// QtConcurrent -#if !defined(QT_NO_CONCURRENT) && (defined(QT_NO_THREAD)) -#define QT_NO_CONCURRENT -#endif - // QDate/QTime/QDateTime #if !defined(QT_NO_DATESTRING) && (defined(QT_NO_TEXTDATE)) #define QT_NO_DATESTRING @@ -346,9 +337,9 @@ #define QT_NO_DIAL #endif -// QFileSystemWatcher -#if !defined(QT_NO_FILESYSTEMWATCHER) && (defined(QT_NO_THREAD)) -#define QT_NO_FILESYSTEMWATCHER +// QFileSystemModel +#if !defined(QT_NO_FILESYSTEMMODEL) && (defined(QT_NO_FILESYSTEMWATCHER)) +#define QT_NO_FILESYSTEMMODEL #endif // QHostInfo @@ -386,16 +377,6 @@ #define QT_NO_PHONON_VOLUMEFADEREFFECT #endif -// Phonon::VolumeSlider -#if !defined(QT_NO_PHONON_VOLUMESLIDER) && (defined(QT_NO_SLIDER)) -#define QT_NO_PHONON_VOLUMESLIDER -#endif - -// QProcess -#if !defined(QT_NO_PROCESS) && (defined(QT_NO_THREAD)) -#define QT_NO_PROCESS -#endif - // QProgressDialog #if !defined(QT_NO_PROGRESSDIALOG) && (defined(QT_NO_PROGRESSBAR)) #define QT_NO_PROGRESSDIALOG @@ -426,6 +407,16 @@ #define QT_NO_QWS_MANAGER #endif +// QVncTransformed +#if !defined(QT_NO_QWS_TRANSFORMED) && (defined(QT_NO_QWS_PROXYSCREEN)) +#define QT_NO_QWS_TRANSFORMED +#endif + +// QVncScreen +#if !defined(QT_NO_QWS_VNC) && (defined(QT_NO_QWS_PROXYSCREEN)) +#define QT_NO_QWS_VNC +#endif + // QScrollBar #if !defined(QT_NO_SCROLLBAR) && (defined(QT_NO_SLIDER)) #define QT_NO_SCROLLBAR @@ -441,6 +432,11 @@ #define QT_NO_SOCKS5 #endif +// QSoftKeyManager +#if !defined(QT_NO_SOFTKEYMANAGER) && (defined(QT_NO_ACTION)) +#define QT_NO_SOFTKEYMANAGER +#endif + // QSplitter #if !defined(QT_NO_SPLITTER) && (defined(QT_NO_RUBBERBAND)) #define QT_NO_SPLITTER @@ -466,9 +462,9 @@ #define QT_NO_SXE #endif -// QSystemTrayIcon -#if !defined(QT_NO_SYSTEMTRAYICON) && (defined(QT_NO_ICON)) -#define QT_NO_SYSTEMTRAYICON +// QToolButton +#if !defined(QT_NO_TOOLBUTTON) && (defined(QT_NO_ACTION)) +#define QT_NO_TOOLBUTTON #endif // QUndoStack @@ -501,11 +497,6 @@ #define QT_NO_CONTEXTMENU #endif -// QFileSystemModel -#if !defined(QT_NO_FILESYSTEMMODEL) && (defined(QT_NO_FILESYSTEMWATCHER)) -#define QT_NO_FILESYSTEMMODEL -#endif - // File Transfer Protocol #if !defined(QT_NO_FTP) && (defined(QT_NO_URLINFO) || defined(QT_NO_TEXTDATE)) #define QT_NO_FTP @@ -521,9 +512,9 @@ #define QT_NO_LIBRARY #endif -// QPrinter -#if !defined(QT_NO_PRINTER) && (defined(QT_NO_TEXTSTREAM) || defined(QT_NO_PICTURE)) -#define QT_NO_PRINTER +// Phonon::AbstractMediaStream +#if !defined(QT_NO_PHONON_SETTINGSGROUP) && (defined(QT_NO_SETTINGS)) +#define QT_NO_PHONON_SETTINGSGROUP #endif // QScrollArea @@ -531,21 +522,36 @@ #define QT_NO_SCROLLAREA #endif +// QWindowsVistaStyle +#if !defined(QT_NO_STYLE_WINDOWSVISTA) && (defined(QT_NO_STYLE_WINDOWSXP)) +#define QT_NO_STYLE_WINDOWSVISTA +#endif + +// QTabBar +#if !defined(QT_NO_TABBAR) && (defined(QT_NO_TOOLBUTTON)) +#define QT_NO_TABBAR +#endif + // OdfWriter #if !defined(QT_NO_TEXTODFWRITER) && (defined(QT_NO_XMLSTREAMWRITER)) #define QT_NO_TEXTODFWRITER #endif -// QToolButton -#if !defined(QT_NO_TOOLBUTTON) && (defined(QT_NO_ICON) || defined(QT_NO_ACTION)) -#define QT_NO_TOOLBUTTON -#endif - // Translation (UTF-8 representation) #if !defined(QT_NO_TRANSLATION_UTF8) && (defined(QT_NO_TRANSLATION) || defined(QT_NO_TEXTCODEC)) #define QT_NO_TRANSLATION_UTF8 #endif +// QUndoGroup +#if !defined(QT_NO_UNDOGROUP) && (defined(QT_NO_UNDOSTACK)) +#define QT_NO_UNDOGROUP +#endif + +// QWhatsThis +#if !defined(QT_NO_WHATSTHIS) && (defined(QT_NO_TOOLBUTTON)) +#define QT_NO_WHATSTHIS +#endif + // Drag and drop #if !defined(QT_NO_DRAGANDDROP) && (defined(QT_NO_QWS_PROPERTIES) || defined(QT_NO_IMAGEFORMAT_XPM)) #define QT_NO_DRAGANDDROP @@ -556,11 +562,31 @@ #define QT_NO_GRAPHICSVIEW #endif +// QInputContext +#if !defined(QT_NO_IM) && (defined(QT_NO_LIBRARY)) +#define QT_NO_IM +#endif + // QMdiArea #if !defined(QT_NO_MDIAREA) && (defined(QT_NO_SCROLLAREA)) #define QT_NO_MDIAREA #endif +// Phonon::PlatformPlugin +#if !defined(QT_NO_PHONON_PLATFORMPLUGIN) && (defined(QT_NO_LIBRARY)) +#define QT_NO_PHONON_PLATFORMPLUGIN +#endif + +// Phonon::VolumeSlider +#if !defined(QT_NO_PHONON_VOLUMESLIDER) && (defined(QT_NO_SLIDER) || defined(QT_NO_TOOLBUTTON)) +#define QT_NO_PHONON_VOLUMESLIDER +#endif + +// QPrinter +#if !defined(QT_NO_PRINTER) && (defined(QT_NO_TEXTSTREAM) || defined(QT_NO_PICTURE) || defined(QT_NO_TEMPORARYFILE)) +#define QT_NO_PRINTER +#endif + // QSpinBox #if !defined(QT_NO_SPINBOX) && (defined(QT_NO_SPINWIDGET) || defined(QT_NO_LINEEDIT) || defined(QT_NO_VALIDATOR)) #define QT_NO_SPINBOX @@ -591,24 +617,19 @@ #define QT_NO_STYLE_WINDOWSMOBILE #endif -// QWindowsVistaStyle -#if !defined(QT_NO_STYLE_WINDOWSVISTA) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_STYLE_WINDOWSXP)) -#define QT_NO_STYLE_WINDOWSVISTA -#endif - // QtSvg module #if !defined(QT_NO_SVG) && (defined(QT_NO_XMLSTREAMREADER) || defined(QT_NO_CSSPARSER)) #define QT_NO_SVG #endif -// QTabBar -#if !defined(QT_NO_TABBAR) && (defined(QT_NO_TOOLBUTTON)) -#define QT_NO_TABBAR +// Q3TabDialog +#if !defined(QT_NO_TABDIALOG) && (defined(QT_NO_TABBAR)) +#define QT_NO_TABDIALOG #endif -// QUndoGroup -#if !defined(QT_NO_UNDOGROUP) && (defined(QT_NO_UNDOCOMMAND) || defined(QT_NO_UNDOSTACK)) -#define QT_NO_UNDOGROUP +// QColorDialog +#if !defined(QT_NO_COLORDIALOG) && (defined(QT_NO_SPINBOX)) +#define QT_NO_COLORDIALOG #endif // The Model/View Framework @@ -616,6 +637,16 @@ #define QT_NO_ITEMVIEWS #endif +// QMenuBar +#if !defined(QT_NO_MENUBAR) && (defined(QT_NO_MENU) || defined(QT_NO_TOOLBUTTON)) +#define QT_NO_MENUBAR +#endif + +// QWSInputMethod +#if !defined(QT_NO_QWS_INPUTMETHODS) && (defined(QT_NO_IM)) +#define QT_NO_QWS_INPUTMETHODS +#endif + // Sound Server #if !defined(QT_NO_QWS_SOUNDSERVER) && (defined(QT_NO_SOUND) || defined(QT_NO_HOSTINFO) || defined(QT_NO_QWS_MULTIPROCESS)) #define QT_NO_QWS_SOUNDSERVER @@ -631,9 +662,9 @@ #define QT_NO_SVGRENDERER #endif -// Q3TabDialog -#if !defined(QT_NO_TABDIALOG) && (defined(QT_NO_TABBAR)) -#define QT_NO_TABDIALOG +// QTabWidget +#if !defined(QT_NO_TABWIDGET) && (defined(QT_NO_TABBAR) || defined(QT_NO_STACKEDWIDGET)) +#define QT_NO_TABWIDGET #endif // QTextCodecPlugin @@ -646,16 +677,6 @@ #define QT_NO_TEXTEDIT #endif -// QWhatsThis -#if !defined(QT_NO_WHATSTHIS) && (defined(QT_NO_TOOLBUTTON) || defined(QT_NO_ACTION)) -#define QT_NO_WHATSTHIS -#endif - -// QDirModel -#if !defined(QT_NO_DIRMODEL) && (defined(QT_NO_ITEMVIEWS)) -#define QT_NO_DIRMODEL -#endif - // QErrorMessage #if !defined(QT_NO_ERRORMESSAGE) && (defined(QT_NO_TEXTEDIT)) #define QT_NO_ERRORMESSAGE @@ -666,9 +687,9 @@ #define QT_NO_LISTVIEW #endif -// QMenuBar -#if !defined(QT_NO_MENUBAR) && (defined(QT_NO_MENU) || defined(QT_NO_TOOLBUTTON)) -#define QT_NO_MENUBAR +// QMainWindow +#if !defined(QT_NO_MAINWINDOW) && (defined(QT_NO_MENU) || defined(QT_NO_RESIZEHANDLER) || defined(QT_NO_TOOLBUTTON)) +#define QT_NO_MAINWINDOW #endif // QAbstractProxyModel @@ -701,24 +722,24 @@ #define QT_NO_TABLEVIEW #endif -// QTabWidget -#if !defined(QT_NO_TABWIDGET) && (defined(QT_NO_TABBAR) || defined(QT_NO_STACKEDWIDGET)) -#define QT_NO_TABWIDGET -#endif - // QTextBrowser #if !defined(QT_NO_TEXTBROWSER) && (defined(QT_NO_TEXTEDIT)) #define QT_NO_TEXTBROWSER #endif +// QToolBox +#if !defined(QT_NO_TOOLBOX) && (defined(QT_NO_TOOLBUTTON) || defined(QT_NO_SCROLLAREA)) +#define QT_NO_TOOLBOX +#endif + // QTreeView #if !defined(QT_NO_TREEVIEW) && (defined(QT_NO_ITEMVIEWS)) #define QT_NO_TREEVIEW #endif -// QColorDialog -#if !defined(QT_NO_COLORDIALOG) && (defined(QT_NO_LINEEDIT) || defined(QT_NO_VALIDATOR) || defined(QT_NO_SPINBOX)) -#define QT_NO_COLORDIALOG +// Accessibility +#if !defined(QT_NO_ACCESSIBILITY) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_MENUBAR)) +#define QT_NO_ACCESSIBILITY #endif // QColumnView @@ -731,11 +752,6 @@ #define QT_NO_COMPLETER #endif -// Common UNIX Printing System -#if !defined(QT_NO_CUPS) && (defined(QT_NO_PRINTER) || defined(QT_NO_LIBRARY)) -#define QT_NO_CUPS -#endif - // QDataWidgetMapper #if !defined(QT_NO_DATAWIDGETMAPPER) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_PROPERTIES)) #define QT_NO_DATAWIDGETMAPPER @@ -746,11 +762,6 @@ #define QT_NO_LISTWIDGET #endif -// QMainWindow -#if !defined(QT_NO_MAINWINDOW) && (defined(QT_NO_MENU) || defined(QT_NO_RESIZEHANDLER) || defined(QT_NO_TOOLBUTTON)) -#define QT_NO_MAINWINDOW -#endif - // QSortFilterProxyModel #if !defined(QT_NO_SORTFILTERPROXYMODEL) && (defined(QT_NO_PROXYMODEL)) #define QT_NO_SORTFILTERPROXYMODEL @@ -761,24 +772,24 @@ #define QT_NO_TABLEWIDGET #endif +// QToolBar +#if !defined(QT_NO_TOOLBAR) && (defined(QT_NO_MAINWINDOW)) +#define QT_NO_TOOLBAR +#endif + // QTreeWidget #if !defined(QT_NO_TREEWIDGET) && (defined(QT_NO_TREEVIEW)) #define QT_NO_TREEWIDGET #endif -// QPrintPreviewWidget -#if !defined(QT_NO_PRINTPREVIEWWIDGET) && (defined(QT_NO_GRAPHICSVIEW) || defined(QT_NO_PRINTER)) -#define QT_NO_PRINTPREVIEWWIDGET -#endif - -// QToolBar -#if !defined(QT_NO_TOOLBAR) && (defined(QT_NO_MAINWINDOW)) -#define QT_NO_TOOLBAR +// Common UNIX Printing System +#if !defined(QT_NO_CUPS) && (defined(QT_NO_PRINTER) || defined(QT_NO_LIBRARY)) +#define QT_NO_CUPS #endif -// QToolBox -#if !defined(QT_NO_TOOLBOX) && (defined(QT_NO_ICON) || defined(QT_NO_TOOLBUTTON) || defined(QT_NO_SCROLLAREA)) -#define QT_NO_TOOLBOX +// QDirModel +#if !defined(QT_NO_DIRMODEL) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_FILESYSTEMMODEL)) +#define QT_NO_DIRMODEL #endif // QDockwidget @@ -791,6 +802,11 @@ #define QT_NO_UNDOVIEW #endif +// QCompleter +#if !defined(QT_NO_FSCOMPLETER) && (defined(QT_NO_FILESYSTEMMODEL) || defined(QT_NO_COMPLETER)) +#define QT_NO_FSCOMPLETER +#endif + // QGraphicsSvgItem #if !defined(QT_NO_GRAPHICSSVGITEM) && (defined(QT_NO_SVGRENDERER) || defined(QT_NO_GRAPHICSVIEW)) #define QT_NO_GRAPHICSSVGITEM @@ -801,6 +817,16 @@ #define QT_NO_COMBOBOX #endif +// QWorkSpace +#if !defined(QT_NO_WORKSPACE) && (defined(QT_NO_SCROLLBAR) || defined(QT_NO_MAINWINDOW) || defined(QT_NO_MENUBAR)) +#define QT_NO_WORKSPACE +#endif + +// QPrintPreviewWidget +#if !defined(QT_NO_PRINTPREVIEWWIDGET) && (defined(QT_NO_GRAPHICSVIEW) || defined(QT_NO_PRINTER) || defined(QT_NO_MAINWINDOW)) +#define QT_NO_PRINTPREVIEWWIDGET +#endif + // QCalendarWidget #if !defined(QT_NO_CALENDARWIDGET) && (defined(QT_NO_TABLEVIEW) || defined(QT_NO_MENU) || defined(QT_NO_TEXTDATE) || defined(QT_NO_SPINBOX) || defined(QT_NO_TOOLBUTTON)) #define QT_NO_CALENDARWIDGET @@ -831,23 +857,18 @@ #define QT_NO_FONTDIALOG #endif -// QWorkSpace -#if !defined(QT_NO_WORKSPACE) && (defined(QT_NO_SCROLLBAR) || defined(QT_NO_RESIZEHANDLER) || defined(QT_NO_MENU) || defined(QT_NO_TOOLBUTTON) || defined(QT_NO_MAINWINDOW) || defined(QT_NO_TOOLBAR) || defined(QT_NO_MENUBAR)) -#define QT_NO_WORKSPACE -#endif - // QPrintDialog -#if !defined(QT_NO_PRINTDIALOG) && (defined(QT_NO_PRINTER) || defined(QT_NO_COMBOBOX) || defined(QT_NO_BUTTONGROUP) || defined(QT_NO_SPINBOX) || defined(QT_NO_TREEVIEW) || defined(QT_NO_STACKEDWIDGET) || defined(QT_NO_TABWIDGET)) +#if !defined(QT_NO_PRINTDIALOG) && (defined(QT_NO_PRINTER) || defined(QT_NO_COMBOBOX) || defined(QT_NO_BUTTONGROUP) || defined(QT_NO_SPINBOX) || defined(QT_NO_TREEVIEW) || defined(QT_NO_TABWIDGET)) #define QT_NO_PRINTDIALOG #endif // QFileDialog -#if !defined(QT_NO_FILEDIALOG) && (defined(QT_NO_DIRMODEL) || defined(QT_NO_TREEVIEW) || defined(QT_NO_COMBOBOX) || defined(QT_NO_TOOLBUTTON) || defined(QT_NO_BUTTONGROUP) || defined(QT_NO_TOOLTIP) || defined(QT_NO_SPLITTER) || defined(QT_NO_STACKEDWIDGET) || defined(QT_NO_FILESYSTEMMODEL)) +#if !defined(QT_NO_FILEDIALOG) && (defined(QT_NO_DIRMODEL) || defined(QT_NO_TREEVIEW) || defined(QT_NO_COMBOBOX) || defined(QT_NO_TOOLBUTTON) || defined(QT_NO_BUTTONGROUP) || defined(QT_NO_TOOLTIP) || defined(QT_NO_SPLITTER) || defined(QT_NO_STACKEDWIDGET) || defined(QT_NO_PROXYMODEL)) #define QT_NO_FILEDIALOG #endif // QPrintPreviewDialog -#if !defined(QT_NO_PRINTPREVIEWDIALOG) && (defined(QT_NO_PRINTPREVIEWWIDGET) || defined(QT_NO_PRINTDIALOG) || defined(QT_NO_MAINWINDOW)) +#if !defined(QT_NO_PRINTPREVIEWDIALOG) && (defined(QT_NO_PRINTPREVIEWWIDGET) || defined(QT_NO_PRINTDIALOG) || defined(QT_NO_TOOLBAR)) #define QT_NO_PRINTPREVIEWDIALOG #endif diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index ec47883..ff34006 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -28,17 +28,10 @@ Requires: Name: CssParser SeeAlso: ??? -Feature: THREAD -Description: Supports multithreaded programming. -Section: Kernel -Requires: -Name: QThread -SeeAlso: ??? - Feature: CONCURRENT Description: Provides a high-level multi-threaded APIs Section: Kernel -Requires: THREAD +Requires: Name: QtConcurrent SeeAlso: ??? @@ -70,6 +63,13 @@ Requires: Name: QAction SeeAlso: ??? +Feature: SOFTKEYMANAGER +Description: Supports softkeys. +Section: Gui +Requires: ACTION +Name: QSoftKeyManager +SeeAlso: ??? + Feature: CURSOR Description: Supports mouse cursors. Section: Kernel @@ -147,6 +147,12 @@ Requires: XMLSTREAM Name: QXmlStreamWriter SeeAlso: ??? +Feature: IM +Description: Inputmethods with QInputContext +Section: Kernel +Requires: LIBRARY +Name: QInputContext +SeeAlso: ??? # Data structures Feature: STL @@ -182,7 +188,7 @@ SeeAlso: ??? Feature: PROCESS Description: Supports external process invocation. Section: File I/O -Requires: THREAD +Requires: Name: QProcess SeeAlso: ??? @@ -232,7 +238,7 @@ Feature: FILESYSTEMWATCHER Description: Provides an interface for monitoring files and directories for modications. Section: File I/O -Requires: THREAD +Requires: Name: QFileSystemWatcher SeeAlso: ??? @@ -339,7 +345,7 @@ SeeAlso: ??? Feature: COMBOBOX Description: Supports comboboxes presenting a list of options to the user. Section: Widgets -Requires: LINEEDIT STANDARDITEMMODEL LISTVIEW +Requires: LINEEDIT STANDARDITEMMODEL LISTVIEW Name: QComboBox SeeAlso: ??? @@ -353,7 +359,7 @@ SeeAlso: ??? Feature: TOOLBUTTON Description: Supports quick-access buttons to commands and options. Section: Widgets -Requires: ICON ACTION +Requires: ACTION Name: QToolButton SeeAlso: ??? @@ -367,7 +373,7 @@ SeeAlso: ??? Feature: TOOLBOX Description: Supports columns of tabbed widget items. Section: Widgets -Requires: ICON TOOLBUTTON SCROLLAREA +Requires: TOOLBUTTON SCROLLAREA Name: QToolBox SeeAlso: ??? @@ -403,7 +409,7 @@ SeeAlso: ??? Feature: WORKSPACE Description: Supports workspace windows, e.g. used in an MDI application. Section: Widgets -Requires: SCROLLBAR RESIZEHANDLER MENU TOOLBUTTON MAINWINDOW TOOLBAR MENUBAR +Requires: SCROLLBAR MAINWINDOW MENUBAR Name: QWorkSpace SeeAlso: ??? @@ -537,7 +543,7 @@ SeeAlso: ??? Feature: WHATSTHIS Description: Supports displaying "What's this" help. Section: Widgets -Requires: TOOLBUTTON ACTION +Requires: TOOLBUTTON Name: QWhatsThis SeeAlso: ??? @@ -567,7 +573,7 @@ Feature: PRINTPREVIEWWIDGET Description: Provides a widget for previewing page layouts for printer output. a date. Section: Widgets -Requires: GRAPHICSVIEW PRINTER +Requires: GRAPHICSVIEW PRINTER MAINWINDOW Name: QPrintPreviewWidget SeeAlso: ??? @@ -584,14 +590,14 @@ SeeAlso: ??? Feature: COLORDIALOG Description: Supports a dialog widget for specifying colors. Section: Dialogs -Requires: LINEEDIT VALIDATOR SPINBOX +Requires: SPINBOX Name: QColorDialog SeeAlso: ??? Feature: FILEDIALOG Description: Supports a dialog widget for selecting files or directories. Section: Dialogs -Requires: DIRMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET FILESYSTEMMODEL +Requires: DIRMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET PROXYMODEL Name: QFileDialog SeeAlso: ??? @@ -605,14 +611,14 @@ SeeAlso: ??? Feature: PRINTDIALOG Description: Supports a dialog widget for specifying printer configuration. Section: Dialogs -Requires: PRINTER COMBOBOX BUTTONGROUP SPINBOX TREEVIEW STACKEDWIDGET TABWIDGET +Requires: PRINTER COMBOBOX BUTTONGROUP SPINBOX TREEVIEW TABWIDGET Name: QPrintDialog SeeAlso: ??? Feature: PRINTPREVIEWDIALOG Description: Provides a dialog for previewing and configuring page layouts for printer output. Section: Dialogs -Requires: PRINTPREVIEWWIDGET PRINTDIALOG MAINWINDOW +Requires: PRINTPREVIEWWIDGET PRINTDIALOG TOOLBAR Name: QPrintPreviewDialog SeeAlso: ??? @@ -664,7 +670,7 @@ SeeAlso: ??? Feature: DIRMODEL Description: Supports a data model for the local filesystem. Section: ItemViews -Requires: ITEMVIEWS +Requires: ITEMVIEWS FILESYSTEMMODEL Name: QDirModel SeeAlso: ??? @@ -772,7 +778,7 @@ SeeAlso: ??? Feature: STYLE_WINDOWSVISTA Description: Supports a Microsoft WindowsVista-like look and feel. Section: Styles -Requires: STYLE_WINDOWS STYLE_WINDOWSXP +Requires: STYLE_WINDOWSXP Name: QWindowsVistaStyle SeeAlso: ??? @@ -813,13 +819,6 @@ Requires: Name: QImageIOPlugin SeeAlso: ??? -Feature: ICON -Description: Supports scalable icons in different modes and states. -Section: Images -Requires: -Name: QIcon -SeeAlso: ??? - Feature: MOVIE Description: Supports animated images. Section: Images @@ -910,7 +909,7 @@ SeeAlso: ??? Feature: PRINTER Description: Supports printing Section: Painting -Requires: TEXTSTREAM PICTURE +Requires: TEXTSTREAM PICTURE TEMPORARYFILE Name: QPrinter SeeAlso: ??? @@ -1014,7 +1013,7 @@ SeeAlso: ??? Feature: QWS_INPUTMETHODS Description: Supports international input methods. Section: Internationalization -Requires: +Requires: IM Name: QWSInputMethod SeeAlso: ??? @@ -1101,6 +1100,13 @@ Requires: PROXYMODEL Name: QCompleter SeeAlso: ??? +Feature: FSCOMPLETER +Description: Provides completions based on an item model. +Section: Utilities +Requires: FILESYSTEMMODEL COMPLETER +Name: QCompleter +SeeAlso: ??? + Feature: DESKTOPSERVICES Description: Provides methods for accessing common desktop services. Section: Utilities @@ -1111,7 +1117,7 @@ SeeAlso: ??? Feature: SYSTEMTRAYICON Description: Provides an icon for an application in the system tray. Section: Utilities -Requires: ICON +Requires: Name: QSystemTrayIcon SeeAlso: ??? @@ -1132,7 +1138,7 @@ SeeAlso: ??? Feature: UNDOGROUP Description: Section: Utilities -Requires: UNDOCOMMAND UNDOSTACK +Requires: UNDOSTACK Name: QUndoGroup SeeAlso: ??? @@ -1146,7 +1152,7 @@ SeeAlso: ??? Feature: ACCESSIBILITY Description: Provides accessibility support. Section: Utilities -Requires: PROPERTIES +Requires: PROPERTIES MENUBAR Name: Accessibility SeeAlso: ??? @@ -1317,6 +1323,20 @@ Requires: Name: QProxyScreen SeeAlso: ??? +Feature: QWS_VNC +Description: Provides VNC screen driver +Section: Qt for Embedded Linux +Requires: QWS_PROXYSCREEN +Name: QVncScreen +SeeAlso: ??? + +Feature: QWS_TRANSFORMED +Description: Provides Transformed screen driver +Section: Qt for Embedded Linux +Requires: QWS_PROXYSCREEN +Name: QVncTransformed +SeeAlso: ??? + Feature: QWS_DYNAMICSCREENTRANSFORMATION Description: Enables dynamic setting of screen transformation/rotation. Section: Qt for Embedded Linux @@ -1338,7 +1358,7 @@ SeeAlso: ??? Feature: PHONON_PLATFORMPLUGIN Description: Support for platform plugin Section: Phonon -Requires: +Requires: LIBRARY Name: Phonon::PlatformPlugin SeeAlso: ??? @@ -1403,7 +1423,7 @@ SeeAlso: ??? Feature: PHONON_VOLUMESLIDER Description: Support for the Volume Slider class Section: Phonon -Requires: SLIDER +Requires: SLIDER TOOLBUTTON Name: Phonon::VolumeSlider SeeAlso: ??? @@ -1420,3 +1440,10 @@ Section: Phonon Requires: Name: Phonon::AbstractMediaStream SeeAlso: ??? + +Feature: PHONON_SETTINGSGROUP +Description: Phonon settingsgroup +Section: Phonon +Requires: SETTINGS +Name: Phonon::AbstractMediaStream +SeeAlso: ??? diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 7d47944..33c6a34 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2513,10 +2513,19 @@ Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value void qsrand(uint seed) { #if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) - SeedStorageType *pseed = randTLS()->localData(); - if (!pseed) - randTLS()->setLocalData(pseed = new SeedStorageType); - *pseed = seed; + SeedStorage *seedStorage = randTLS(); + if (seedStorage) { + SeedStorageType *pseed = seedStorage->localData(); + if (!pseed) + seedStorage->setLocalData(pseed = new SeedStorageType); + *pseed = seed; + } else { + //golbal static seed storage should always exist, + //except after being deleted by QGlobalStaticDeleter. + //But since it still can be called from destructor of another + //global static object, fallback to sqrand(seed) + srand(seed); + } #else // On Windows srand() and rand() already use Thread-Local-Storage // to store the seed between calls @@ -2536,21 +2545,24 @@ void qsrand(uint seed) void qsrand() { #if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) - SeedStorageType *pseed = randTLS()->localData(); - if (pseed) { - // already seeded - return; - } - randTLS()->setLocalData(pseed = new SeedStorageType); - // start beyond 1 to avoid the sequence reset - static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); - *pseed = QDateTime::currentDateTime().toTime_t() - + quintptr(&pseed) - + serial.fetchAndAddRelaxed(1); + SeedStorage *seedStorage = randTLS(); + if (seedStorage) { + SeedStorageType *pseed = seedStorage->localData(); + if (pseed) { + // already seeded + return; + } + seedStorage->setLocalData(pseed = new SeedStorageType); + // start beyond 1 to avoid the sequence reset + static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); + *pseed = QDateTime::currentDateTime().toTime_t() + + quintptr(&pseed) + + serial.fetchAndAddRelaxed(1); #if defined(Q_OS_WIN) - // for Windows the srand function must still be called. - srand(*pseed); + // for Windows the srand function must still be called. + srand(*pseed); #endif + } #elif defined(Q_OS_WIN) static unsigned int seed = 0; @@ -2584,12 +2596,21 @@ void qsrand() int qrand() { #if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) - SeedStorageType *pseed = randTLS()->localData(); - if (!pseed) { - randTLS()->setLocalData(pseed = new SeedStorageType); - *pseed = 1; + SeedStorage *seedStorage = randTLS(); + if (seedStorage) { + SeedStorageType *pseed = seedStorage->localData(); + if (!pseed) { + seedStorage->setLocalData(pseed = new SeedStorageType); + *pseed = 1; + } + return rand_r(pseed); + } else { + //golbal static seed storage should always exist, + //except after being deleted by QGlobalStaticDeleter. + //But since it still can be called from destructor of another + //global static object, fallback to qrand() + return rand(); } - return rand_r(pseed); #else // On Windows srand() and rand() already use Thread-Local-Storage // to store the seed between calls diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 5ee1815..1dbdc6d 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1207,6 +1207,11 @@ class QDataStream; # else # define Q_SVG_EXPORT Q_DECL_IMPORT # endif +# if defined(QT_BUILD_DECLARATIVE_LIB) +# define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT +# else +# define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT +# endif # if defined(QT_BUILD_OPENGL_LIB) # define Q_OPENGL_EXPORT Q_DECL_EXPORT # else @@ -1259,6 +1264,7 @@ class QDataStream; # define Q_SQL_EXPORT Q_DECL_IMPORT # define Q_NETWORK_EXPORT Q_DECL_IMPORT # define Q_SVG_EXPORT Q_DECL_IMPORT +# define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT # define Q_CANVAS_EXPORT Q_DECL_IMPORT # define Q_OPENGL_EXPORT Q_DECL_IMPORT # define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT @@ -1287,6 +1293,7 @@ class QDataStream; # define Q_SQL_EXPORT Q_DECL_EXPORT # define Q_NETWORK_EXPORT Q_DECL_EXPORT # define Q_SVG_EXPORT Q_DECL_EXPORT +# define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT # define Q_OPENGL_EXPORT Q_DECL_EXPORT # define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT # define Q_OPENVG_EXPORT Q_DECL_EXPORT @@ -1301,6 +1308,7 @@ class QDataStream; # define Q_SQL_EXPORT # define Q_NETWORK_EXPORT # define Q_SVG_EXPORT +# define Q_DECLARATIVE_EXPORT # define Q_OPENGL_EXPORT # define Q_MULTIMEDIA_EXPORT # define Q_XML_EXPORT @@ -2065,6 +2073,9 @@ Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE); Q_CORE_EXPORT void *qMalloc(size_t size); Q_CORE_EXPORT void qFree(void *ptr); Q_CORE_EXPORT void *qRealloc(void *ptr, size_t size); +Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment); +Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size_t alignment); +Q_CORE_EXPORT void qFreeAligned(void *ptr); Q_CORE_EXPORT void *qMemCopy(void *dest, const void *src, size_t n); Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n); @@ -2459,6 +2470,7 @@ Q_CORE_EXPORT int qt_symbian_exception2Error(const std::exception& ex); #define QT_MODULE_SCRIPTTOOLS 0x10000 #define QT_MODULE_OPENVG 0x20000 #define QT_MODULE_MULTIMEDIA 0x40000 +#define QT_MODULE_DECLARATIVE 0x80000 /* Qt editions */ #define QT_EDITION_CONSOLE (QT_MODULE_CORE \ @@ -2489,6 +2501,7 @@ Q_CORE_EXPORT int qt_symbian_exception2Error(const std::exception& ex); | QT_MODULE_QT3SUPPORTLIGHT \ | QT_MODULE_QT3SUPPORT \ | QT_MODULE_SVG \ + | QT_MODULE_DECLARATIVE \ | QT_MODULE_GRAPHICSVIEW \ | QT_MODULE_HELP \ | QT_MODULE_TEST \ @@ -2560,6 +2573,9 @@ QT_LICENSED_MODULE(Qt3Support) #if (QT_EDITION & QT_MODULE_SVG) QT_LICENSED_MODULE(Svg) #endif +#if (QT_EDITION & QT_MODULE_DECLARATIVE) +QT_LICENSED_MODULE(Declarative) +#endif #if (QT_EDITION & QT_MODULE_ACTIVEQT) QT_LICENSED_MODULE(ActiveQt) #endif diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 32693e0..15a06d7 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -215,8 +215,7 @@ QLibraryInfo::buildKey() QDate QLibraryInfo::buildDate() { - return QDate(); - //return QDate::fromString(QString::fromLatin1(qt_configure_installation + 12), Qt::ISODate); + return QDate::fromString(QString::fromLatin1(qt_configure_installation + 12), Qt::ISODate); } /*! diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp index a9f103c..4aab1bd 100644 --- a/src/corelib/global/qmalloc.cpp +++ b/src/corelib/global/qmalloc.cpp @@ -65,4 +65,62 @@ void *qRealloc(void *ptr, size_t size) return ::realloc(ptr, size); } +void *qMallocAligned(size_t size, size_t alignment) +{ + return qReallocAligned(0, size, 0, alignment); +} + +void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t alignment) +{ + // fake an aligned allocation + Q_UNUSED(oldsize); + + void *actualptr = oldptr ? static_cast<void **>(oldptr)[-1] : 0; + if (alignment <= sizeof(void*)) { + // special, fast case + void **newptr = static_cast<void **>(qRealloc(actualptr, newsize + sizeof(void*))); + if (!newptr) + return 0; + if (newptr == actualptr) { + // realloc succeeded without reallocating + return oldptr; + } + + *newptr = newptr; + return newptr + 1; + } + + union { void *ptr; void **pptr; quintptr n; } real, faked; + + // qMalloc returns pointers aligned at least at sizeof(size_t) boundaries + // but usually more (8- or 16-byte boundaries). + // So we overallocate by alignment-sizeof(size_t) bytes, so we're guaranteed to find a + // somewhere within the first alignment-sizeof(size_t) that is properly aligned. + + // However, we need to store the actual pointer, so we need to allocate actually size + + // alignment anyway. + + real.ptr = qRealloc(actualptr, newsize + alignment); + if (!real.ptr) + return 0; + + faked.n = real.n + alignment; + faked.n &= ~(alignment - 1); + + // now save the value of the real pointer at faked-sizeof(void*) + // by construction, alignment > sizeof(void*) and is a power of 2, so + // faked-sizeof(void*) is properly aligned for a pointer + faked.pptr[-1] = real.ptr; + + return faked.ptr; +} + +void qFreeAligned(void *ptr) +{ + if (!ptr) + return; + void **ptr2 = static_cast<void **>(ptr); + free(ptr2[-1]); +} + QT_END_NAMESPACE diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index aeaca54..b198276 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1732,11 +1732,6 @@ public: NavigationModeCursorAuto, NavigationModeCursorForceVisible }; - - enum RenderHint { - QualityHint, - PerformanceHint - }; } #ifdef Q_MOC_RUN ; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 4e369c9..c6f32d2 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2965,18 +2965,3 @@ \sa QApplication::setNavigationMode() \sa QApplication::navigationMode() */ - -/*! - \enum Qt::RenderHint - \since 4.6 - - This enum describes the possible hints that can be used to control various - rendering operations. - - \value QualityHint Indicates that rendering quality is the most important factor, - at the potential cost of lower performance. - - \value PerformanceHint Indicates that rendering performance is the most important factor, - at the potential cost of lower quality. -*/ - diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 99296c7..f040d16 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -108,6 +108,10 @@ QT_END_NAMESPACE QT_BEGIN_NAMESPACE +// POSIX requires PIPE_BUF to be 512 or larger +// so we will use 512 +static const int errorBufferMax = 512; + #ifdef Q_OS_INTEGRITY static inline char *strdup(const char *data) { @@ -752,18 +756,19 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv } // notify failure + QString error = qt_error_string(errno); #if defined (QPROCESS_DEBUG) - fprintf(stderr, "QProcessPrivate::execChild() failed, notifying parent process\n"); + fprintf(stderr, "QProcessPrivate::execChild() failed (%s), notifying parent process\n", qPrintable(error)); #endif - qt_safe_write(childStartedPipe[1], "", 1); + qt_safe_write(childStartedPipe[1], error.data(), error.length() * sizeof(QChar)); qt_safe_close(childStartedPipe[1]); childStartedPipe[1] = -1; } bool QProcessPrivate::processStarted() { - char c; - int i = qt_safe_read(childStartedPipe[0], &c, 1); + ushort buf[errorBufferMax]; + int i = qt_safe_read(childStartedPipe[0], &buf, sizeof buf); if (startupSocketNotifier) { startupSocketNotifier->setEnabled(false); startupSocketNotifier->deleteLater(); @@ -775,6 +780,11 @@ bool QProcessPrivate::processStarted() #if defined (QPROCESS_DEBUG) qDebug("QProcessPrivate::processStarted() == %s", i <= 0 ? "true" : "false"); #endif + + // did we read an error message? + if (i > 0) + q_func()->setErrorString(QString::fromUtf16(buf, i / sizeof(QChar))); + return i <= 0; } diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index f98c449..6e6da19 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -574,8 +574,8 @@ int QMetaObjectPrivate::indexOfSignalRelative(const QMetaObject **baseObject, co if (i >= 0 && m && m->d.superdata) { int conflict = m->d.superdata->indexOfMethod(signal); if (conflict >= 0) - qWarning("QMetaObject::indexOfSignal:%s: Conflict with %s::%s", - m->d.stringdata, m->d.superdata->d.stringdata, signal); + qWarning("QMetaObject::indexOfSignal: signal %s from %s redefined in %s", + signal, m->d.superdata->d.stringdata, m->d.stringdata); } #endif return i; @@ -2237,7 +2237,10 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const // -1 (unchanged): normal qt_metacall, result stored in argv[0] // changed: result stored directly in value, return the value of status int status = -1; - void *argv[] = { 0, &v, &status }; + // the flags variable is used by the declarative module to implement + // interception of property writes. + int flags = 0; + void *argv[] = { 0, &v, &status, &flags }; if (t == QVariant::LastType) argv[0] = &v; else diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 5303975..1260d47 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -582,7 +582,7 @@ int QMetaCallEvent::placeMetaCall(QObject *object) QObjects organize themselves in object trees. When you create a QObject with another object as parent, the object will automatically add itself to the parent's children() list. The - parent takes ownership of the object i.e. it will automatically + parent takes ownership of the object; i.e., it will automatically delete its children in its destructor. You can look for an object by name and optionally type using findChild() or findChildren(). @@ -646,7 +646,7 @@ int QMetaCallEvent::placeMetaCall(QObject *object) to be stored in one of the container classes. You must store pointers. - \section2 Auto-Connection + \section1 Auto-Connection Qt's meta-object system provides a mechanism to automatically connect signals and slots between QObject subclasses and their children. As long @@ -660,7 +660,7 @@ int QMetaCallEvent::placeMetaCall(QObject *object) given in the \l{Using a Designer UI File in Your Application} section of the \QD manual. - \section2 Dynamic Properties + \section1 Dynamic Properties From Qt 4.2, dynamic properties can be added to and removed from QObject instances at run-time. Dynamic properties do not need to be declared at @@ -673,6 +673,15 @@ int QMetaCallEvent::placeMetaCall(QObject *object) and both standard Qt widgets and user-created forms can be given dynamic properties. + \section1 Internationalization (i18n) + + All QObject subclasses support Qt's translation features, making it possible + to translate an application's user interface into different languages. + + To make user-visible text translatable, it must be wrapped in calls to + the tr() function. This is explained in detail in the + \l{Writing Source Code for Translation} document. + \sa QMetaObject, QPointer, QObjectCleanupHandler, Q_DISABLE_COPY() {Object Trees and Object Ownership} */ @@ -2150,65 +2159,10 @@ void QObject::deleteLater() otherwise returns \a sourceText itself if no appropriate translated string is available. - See the sections below on Disambiguation and Handling Plurals for more - information about the optional \a disambiguation and \a n parameters. - - QObject and its subclasses obtain translated strings from any translator - objects that have been installed on the application object; see the - QTranslator documentation for details about this mechanism. - - A translatable string is referenced by its translation context; - this is the name of the QObject subclass whose tr() function is invoked, - as in the following example: - + Example: \snippet mainwindows/sdi/mainwindow.cpp implicit tr context \dots - Here, the context is \c MainWindow because it is the \c MainWindow::tr() - function that is invoked. Translation contexts can be given explicitly - by fully qualifying the call to tr(); for example: - - \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp explicit tr context - - This call obtains the translated text for "Page up" from the \c QScrollBar - context. - - \section1 Defining Translation Contexts - - The translation context for QObject and each QObject subclass is the - class name itself. Developers subclassing QObject must use the - Q_OBJECT macro in their class definition to override the translation - context. This macro sets the context to the name of the subclass. - - If Q_OBJECT is not used in a class definition, the context will be - inherited from the base class. For example, since all QObject-based - classes in Qt provide a context, a new QWidget subclass defined without - a Q_OBJECT macro will use the "QWidget" context if its tr() function - is invoked. - - \section1 Translator Comments - - Developers can include information about each translatable string to - help translators with the translation process. These are extracted - when \l lupdate is used to process the source files. The recommended - way to add comments is to annotate the tr() calls in your code with - comments of the form: - - \tt{//: ...} - - or - - \tt{\begincomment: ... \endcomment} - - Examples: - - \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 40 - - In these examples, the comments will be associated with the strings - passed to tr() in the context of each call. - - \section1 Disambiguation - If the same \a sourceText is used in different roles within the same context, an additional identifying string may be passed in \a disambiguation (0 by default). In Qt 4.4 and earlier, this was @@ -2217,76 +2171,12 @@ void QObject::deleteLater() Example: \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 17 + \dots - \section1 Meta Data - - Additional data can be attached to each translatable message. - The syntax: - - \tt{//= <id>} - - can be used to give the message a unique identifier to support tools - which need it. - The syntax: - - \tt{//~ <field name> <field contents>} - - can be used to attach meta data to the message. The field name should consist - of a domain prefix (possibly the conventional file extension of the file format - the field is inspired by), a hyphen and the actual field name in - underscore-delimited notation. For storage in TS files, the field name together - with the prefix "extra-" will form an XML element name. The field contents will - be XML-escaped, but otherwise appear verbatim as the element's contents. - Any number of unique fields can be added to each message. - - Example: - - \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp meta data - - Meta data appearing right in front of a magic TRANSLATOR comment applies to the - whole TS file. - - \section1 Character Encodings - - You can set the encoding for \a sourceText by calling QTextCodec::setCodecForTr(). - By default \a sourceText is assumed to be in Latin-1 encoding. - - \section1 Handling Plurals - - If \a n >= 0, all occurrences of \c %n in the resulting string - are replaced with a decimal representation of \a n. In addition, - depending on \a n's value, the translation text may vary. - - Example: - - \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 18 - - The table below shows what string is returned depending on the - active translation: - - \table - \header \o \o{3,1} Active Translation - \header \o \a n \o No Translation \o French \o English - \row \o 0 \o "0 message(s) saved" \o "0 message sauvegard\unicode{0xE9}" \o "0 message\bold{s} saved" - \row \o 1 \o "1 message(s) saved" \o "1 message sauvegard\unicode{0xE9}" \o "1 message saved" - \row \o 2 \o "2 message(s) saved" \o "2 message\bold{s} sauvegard\unicode{0xE9}\bold{s}" \o "2 message\bold{s} saved" - \row \o 37 \o "37 message(s) saved" \o "37 message\bold{s} sauvegard\unicode{0xE9}\bold{s}" \o "37 message\bold{s} saved" - \endtable - - This idiom is more flexible than the traditional approach; e.g., - - \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 19 - - because it also works with target languages that have several - plural forms (e.g., Irish has a special "dual" form that should - be used when \c n is 2), and it handles the \e n == 0 case - correctly for languages such as French that require the singular. - See the \l{Qt Linguist Manual} for details. - - Instead of \c %n, you can use \c %Ln to produce a localized - representation of \a n. The conversion uses the default locale, - set using QLocale::setDefault(). (If no default locale was - specified, the "C" locale is used.) + See \l{Writing Source Code for Translation} for a detailed description of + Qt's translation mechanisms in general, and the + \l{Writing Source Code for Translation#Disambiguation}{Disambiguation} + section for information on disambiguation. \warning This method is reentrant only if all translators are installed \e before calling this method. Installing or removing diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index 1165fb1..40b9f04 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -49,8 +49,6 @@ #include <errno.h> -#ifndef QT_NO_SHAREDMEMORY - #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> @@ -61,6 +59,7 @@ #include "private/qcore_unix_p.h" +#ifndef QT_NO_SHAREDMEMORY QT_BEGIN_NAMESPACE QSharedMemoryPrivate::QSharedMemoryPrivate() diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 2b463a1..6496876 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -659,7 +659,10 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) #endif if (!pHnd) { #ifdef Q_OS_WIN + //avoid 'Bad Image' message box + UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); hTempModule = ::LoadLibraryEx((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, DONT_RESOLVE_DLL_REFERENCES); + SetErrorMode(oldmode); #else # if defined(Q_OS_SYMBIAN) //Guard against accidentally trying to load non-plugin libraries by making sure the stub exists diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 5dc310b..cf718a5 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -140,10 +140,10 @@ void QStatePrivate::emitFinished() emit q->finished(); } -void QStatePrivate::emitPolished() +void QStatePrivate::emitPropertiesAssigned() { Q_Q(QState); - emit q->polished(); + emit q->propertiesAssigned(); } /*! @@ -229,7 +229,7 @@ QList<QAbstractTransition*> QStatePrivate::transitions() const Instructs this state to set the property with the given \a name of the given \a object to the given \a value when the state is entered. - \sa polished() + \sa propertiesAssigned() */ void QState::assignProperty(QObject *object, const char *name, const QVariant &value) @@ -287,15 +287,14 @@ void QState::setErrorState(QAbstractState *state) /*! Adds the given \a transition. The transition has this state as the source. - This state takes ownership of the transition. If the transition is successfully - added, the function will return the \a transition pointer. Otherwise it will return null. + This state takes ownership of the transition. */ -QAbstractTransition *QState::addTransition(QAbstractTransition *transition) +void QState::addTransition(QAbstractTransition *transition) { Q_D(QState); if (!transition) { qWarning("QState::addTransition: cannot add null transition"); - return 0; + return ; } transition->setParent(this); @@ -304,18 +303,17 @@ QAbstractTransition *QState::addTransition(QAbstractTransition *transition) QAbstractState *t = targets.at(i).data(); if (!t) { qWarning("QState::addTransition: cannot add transition to null state"); - return 0; + return ; } if ((QAbstractStatePrivate::get(t)->machine() != d->machine()) && QAbstractStatePrivate::get(t)->machine() && d->machine()) { qWarning("QState::addTransition: cannot add transition " "to a state in a different state machine"); - return 0; + return ; } } if (machine() != 0 && machine()->configuration().contains(this)) QStateMachinePrivate::get(machine())->registerTransitions(this); - return transition; } /*! @@ -380,7 +378,8 @@ QAbstractTransition *QState::addTransition(QAbstractState *target) return 0; } UnconditionalTransition *trans = new UnconditionalTransition(target); - return addTransition(trans); + addTransition(trans); + return trans; } /*! @@ -493,9 +492,15 @@ bool QState::event(QEvent *e) */ /*! - \fn QState::polished() + \fn QState::propertiesAssigned() + + This signal is emitted when all properties have been assigned their final value. If the state + assigns a value to one or more properties for which an animation exists (either set on the + transition or as a default animation on the state machine), then the signal will not be emitted + until all such animations have finished playing. - This signal is emitted when all properties have been assigned their final value. + If there are no relevant animations, or no property assignments defined for the state, then + the signal will be emitted immediately before the state is entered. \sa QState::assignProperty(), QAbstractTransition::addAnimation() */ diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index 7a47447..423f940 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -76,7 +76,7 @@ public: QAbstractState *errorState() const; void setErrorState(QAbstractState *state); - QAbstractTransition *addTransition(QAbstractTransition *transition); + void addTransition(QAbstractTransition *transition); QSignalTransition *addTransition(QObject *sender, const char *signal, QAbstractState *target); QAbstractTransition *addTransition(QAbstractState *target); void removeTransition(QAbstractTransition *transition); @@ -94,7 +94,7 @@ public: Q_SIGNALS: void finished(); - void polished(); + void propertiesAssigned(); protected: void onEntry(QEvent *event); diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h index 34c8838..7fe6279 100644 --- a/src/corelib/statemachine/qstate_p.h +++ b/src/corelib/statemachine/qstate_p.h @@ -94,7 +94,7 @@ public: QList<QAbstractTransition*> transitions() const; void emitFinished(); - void emitPolished(); + void emitPropertiesAssigned(); QAbstractState *errorState; QAbstractState *initialState; diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index ea5587e..cf951c9 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -159,12 +159,12 @@ QT_BEGIN_NAMESPACE \brief the restore policy for states of this state machine. The default value of this property is - QStateMachine::DoNotRestoreProperties. + QStateMachine::DontRestoreProperties. */ #ifndef QT_NO_ANIMATION /*! - \property QStateMachine::animationsEnabled + \property QStateMachine::animated \brief whether animations are enabled @@ -187,10 +187,10 @@ QStateMachinePrivate::QStateMachinePrivate() stop = false; stopProcessingReason = EventQueueEmpty; error = QStateMachine::NoError; - globalRestorePolicy = QStateMachine::DoNotRestoreProperties; + globalRestorePolicy = QStateMachine::DontRestoreProperties; signalEventGenerator = 0; #ifndef QT_NO_ANIMATION - animationsEnabled = true; + animated = true; #endif } @@ -744,7 +744,7 @@ void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &tr // Find the animations to use for the state change. QList<QAbstractAnimation*> selectedAnimations; - if (animationsEnabled) { + if (animated) { for (int i = 0; i < transitionList.size(); ++i) { QAbstractTransition *transition = transitionList.at(i); @@ -809,7 +809,7 @@ void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &tr if (anim->state() == QAbstractAnimation::Running) { // The animation is still running. This can happen if the // animation is a group, and one of its children just finished, - // and that caused a state to emit its polished() signal, and + // and that caused a state to emit its propertiesAssigned() signal, and // that triggered a transition in the machine. // Just stop the animation so it is correctly restarted again. anim->stop(); @@ -831,7 +831,7 @@ void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &tr } } - // Emit polished signal for entered states that have no animated properties. + // Emit propertiesAssigned signal for entered states that have no animated properties. for (int i = 0; i < enteredStates.size(); ++i) { QState *s = toStandardState(enteredStates.at(i)); if (s @@ -839,7 +839,7 @@ void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &tr && !animationsForState.contains(s) #endif ) - QStatePrivate::get(s)->emitPolished(); + QStatePrivate::get(s)->emitPropertiesAssigned(); } } @@ -1130,7 +1130,7 @@ void QStateMachinePrivate::_q_animationFinished() animations.removeOne(anim); if (animations.isEmpty()) { animationsForState.erase(it); - QStatePrivate::get(toStandardState(state))->emitPolished(); + QStatePrivate::get(toStandardState(state))->emitPropertiesAssigned(); } } @@ -1726,7 +1726,7 @@ QStateMachine::~QStateMachine() already been saved by the state machine, it will not be overwritten until the property has been successfully restored. - \value DoNotRestoreProperties The state machine should not save the initial values of properties + \value DontRestoreProperties The state machine should not save the initial values of properties and restore them later. \value RestoreProperties The state machine should save the initial values of properties and restore them later. @@ -1776,7 +1776,7 @@ QStateMachine::RestorePolicy QStateMachine::globalRestorePolicy() const /*! Sets the restore policy of the state machine to \a restorePolicy. The default - restore policy is QAbstractState::DoNotRestoreProperties. + restore policy is QAbstractState::DontRestoreProperties. \sa globalRestorePolicy() */ @@ -2146,19 +2146,19 @@ void QStateMachine::onExit(QEvent *event) /*! Returns whether animations are enabled for this state machine. */ -bool QStateMachine::animationsEnabled() const +bool QStateMachine::isAnimated() const { Q_D(const QStateMachine); - return d->animationsEnabled; + return d->animated; } /*! Sets whether animations are \a enabled for this state machine. */ -void QStateMachine::setAnimationsEnabled(bool enabled) +void QStateMachine::setAnimated(bool enabled) { Q_D(QStateMachine); - d->animationsEnabled = enabled; + d->animated = enabled; } /*! diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h index 13b6fe2..ff2b667 100644 --- a/src/corelib/statemachine/qstatemachine.h +++ b/src/corelib/statemachine/qstatemachine.h @@ -67,7 +67,7 @@ class Q_CORE_EXPORT QStateMachine : public QState Q_PROPERTY(RestorePolicy globalRestorePolicy READ globalRestorePolicy WRITE setGlobalRestorePolicy) Q_ENUMS(RestorePolicy) #ifndef QT_NO_ANIMATION - Q_PROPERTY(bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled) + Q_PROPERTY(bool animated READ isAnimated WRITE setAnimated) #endif public: class SignalEvent : public QEvent @@ -109,7 +109,7 @@ public: }; enum RestorePolicy { - DoNotRestoreProperties, + DontRestoreProperties, RestoreProperties }; @@ -133,8 +133,8 @@ public: bool isRunning() const; #ifndef QT_NO_ANIMATION - bool animationsEnabled() const; - void setAnimationsEnabled(bool enabled); + bool isAnimated() const; + void setAnimated(bool enabled); void addDefaultAnimation(QAbstractAnimation *animation); QList<QAbstractAnimation *> defaultAnimations() const; diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h index 01c9361..aad5c67 100644 --- a/src/corelib/statemachine/qstatemachine_p.h +++ b/src/corelib/statemachine/qstatemachine_p.h @@ -207,7 +207,7 @@ public: QSet<QAbstractState *> pendingErrorStatesForDefaultEntry; #ifndef QT_NO_ANIMATION - bool animationsEnabled; + bool animated; QPair<QList<QAbstractAnimation*>, QList<QAbstractAnimation*> > initializeAnimation(QAbstractAnimation *abstractAnimation, diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp index b0ed701..dd7cab6 100644 --- a/src/corelib/tools/qcontiguouscache.cpp +++ b/src/corelib/tools/qcontiguouscache.cpp @@ -56,6 +56,16 @@ void QContiguousCacheData::dump() const } #endif +QContiguousCacheData *QContiguousCacheData::allocate(int size, int alignment) +{ + return static_cast<QContiguousCacheData *>(qMallocAligned(size, alignment)); +} + +void QContiguousCacheData::free(QContiguousCacheData *data) +{ + qFreeAligned(data); +} + /*! \class QContiguousCache \brief The QContiguousCache class is a template class that provides a contiguous cache. \ingroup tools diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index ad78d1f..3785938 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -62,6 +62,15 @@ struct Q_CORE_EXPORT QContiguousCacheData int start; int offset; uint sharable : 1; + uint reserved : 31; + + // total is 24 bytes (HP-UX aCC: 40 bytes) + // the next entry is already aligned to 8 bytes + // there will be an 8 byte gap here if T requires 16-byte alignment + // (such as long double on 64-bit platforms, __int128, __float128) + + static QContiguousCacheData *allocate(int size, int alignment); + static void free(QContiguousCacheData *data); #ifdef QT_QCONTIGUOUSCACHE_DEBUG void dump() const; @@ -69,33 +78,32 @@ struct Q_CORE_EXPORT QContiguousCacheData }; template <typename T> -struct QContiguousCacheTypedData +struct QContiguousCacheTypedData: private QContiguousCacheData { - QBasicAtomicInt ref; - int alloc; - int count; - int start; - int offset; - uint sharable : 1; - // uint unused : 31; - - // total is 24 bytes (HP-UX aCC: 40 bytes) - // the next entry is already aligned to 8 bytes - // there will be an 8 byte gap here if T requires 16-byte alignment - // (such as long double on 64-bit platforms, __int128, __float128) - + // private inheritance to avoid aliasing warningss T array[1]; + + static inline void free(QContiguousCacheTypedData *data) { QContiguousCacheData::free(data); } }; template<typename T> class QContiguousCache { typedef QContiguousCacheTypedData<T> Data; - union { QContiguousCacheData *p; QContiguousCacheTypedData<T> *d; }; + union { QContiguousCacheData *d; QContiguousCacheTypedData<T> *p; }; public: + // STL compatibility + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef ptrdiff_t difference_type; + typedef int size_type; + explicit QContiguousCache(int capacity = 0); QContiguousCache(const QContiguousCache<T> &v) : d(v.d) { d->ref.ref(); if (!d->sharable) detach_helper(); } - inline ~QContiguousCache() { if (!d) return; if (!d->ref.deref()) free(d); } + inline ~QContiguousCache() { if (!d) return; if (!d->ref.deref()) free(p); } inline void detach() { if (d->ref != 1) detach_helper(); } inline bool isDetached() const { return d->ref == 1; } @@ -128,10 +136,10 @@ public: inline int firstIndex() const { return d->offset; } inline int lastIndex() const { return d->offset + d->count - 1; } - inline const T &first() const { Q_ASSERT(!isEmpty()); return d->array[d->start]; } - inline const T &last() const { Q_ASSERT(!isEmpty()); return d->array[(d->start + d->count -1) % d->alloc]; } - inline T &first() { Q_ASSERT(!isEmpty()); detach(); return d->array[d->start]; } - inline T &last() { Q_ASSERT(!isEmpty()); detach(); return d->array[(d->start + d->count -1) % d->alloc]; } + inline const T &first() const { Q_ASSERT(!isEmpty()); return p->array[d->start]; } + inline const T &last() const { Q_ASSERT(!isEmpty()); return p->array[(d->start + d->count -1) % d->alloc]; } + inline T &first() { Q_ASSERT(!isEmpty()); detach(); return p->array[d->start]; } + inline T &last() { Q_ASSERT(!isEmpty()); detach(); return p->array[(d->start + d->count -1) % d->alloc]; } void removeFirst(); T takeFirst(); @@ -156,23 +164,32 @@ private: // count the padding at the end return reinterpret_cast<const char *>(&(reinterpret_cast<const Data *>(this))->array[1]) - reinterpret_cast<const char *>(this); } + int alignOfTypedData() const + { +#ifdef Q_ALIGNOF + return qMax<int>(sizeof(void*), Q_ALIGNOF(Data)); +#else + return 0; +#endif + } }; template <typename T> void QContiguousCache<T>::detach_helper() { - union { QContiguousCacheData *p; QContiguousCacheTypedData<T> *d; } x; + union { QContiguousCacheData *d; QContiguousCacheTypedData<T> *p; } x; - x.p = malloc(d->alloc); + x.d = malloc(d->alloc); x.d->ref = 1; x.d->count = d->count; x.d->start = d->start; x.d->offset = d->offset; x.d->alloc = d->alloc; x.d->sharable = true; + x.d->reserved = 0; - T *dest = x.d->array + x.d->start; - T *src = d->array + d->start; + T *dest = x.p->array + x.d->start; + T *src = p->array + d->start; int oldcount = x.d->count; while (oldcount--) { if (QTypeInfo<T>::isComplex) { @@ -181,15 +198,15 @@ void QContiguousCache<T>::detach_helper() *dest = *src; } dest++; - if (dest == x.d->array + x.d->alloc) - dest = x.d->array; + if (dest == x.p->array + x.d->alloc) + dest = x.p->array; src++; - if (src == d->array + d->alloc) - src = d->array; + if (src == p->array + d->alloc) + src = p->array; } if (!d->ref.deref()) - free(d); + free(p); d = x.d; } @@ -199,14 +216,14 @@ void QContiguousCache<T>::setCapacity(int asize) if (asize == d->alloc) return; detach(); - union { QContiguousCacheData *p; QContiguousCacheTypedData<T> *d; } x; - x.p = malloc(asize); + union { QContiguousCacheData *d; QContiguousCacheTypedData<T> *p; } x; + x.d = malloc(asize); x.d->alloc = asize; x.d->count = qMin(d->count, asize); x.d->offset = d->offset + d->count - x.d->count; x.d->start = x.d->offset % x.d->alloc; - T *dest = x.d->array + (x.d->start + x.d->count-1) % x.d->alloc; - T *src = d->array + (d->start + d->count-1) % d->alloc; + T *dest = x.p->array + (x.d->start + x.d->count-1) % x.d->alloc; + T *src = p->array + (d->start + d->count-1) % d->alloc; int oldcount = x.d->count; while (oldcount--) { if (QTypeInfo<T>::isComplex) { @@ -214,15 +231,15 @@ void QContiguousCache<T>::setCapacity(int asize) } else { *dest = *src; } - if (dest == x.d->array) - dest = x.d->array + x.d->alloc; + if (dest == x.p->array) + dest = x.p->array + x.d->alloc; dest--; - if (src == d->array) - src = d->array + d->alloc; + if (src == p->array) + src = p->array + d->alloc; src--; } /* free old */ - free(d); + free(p); d = x.d; } @@ -232,24 +249,24 @@ void QContiguousCache<T>::clear() if (d->ref == 1) { if (QTypeInfo<T>::isComplex) { int oldcount = d->count; - T * i = d->array + d->start; - T * e = d->array + d->alloc; + T * i = p->array + d->start; + T * e = p->array + d->alloc; while (oldcount--) { i->~T(); i++; if (i == e) - i = d->array; + i = p->array; } } d->count = d->start = d->offset = 0; } else { - union { QContiguousCacheData *p; QContiguousCacheTypedData<T> *d; } x; - x.p = malloc(d->alloc); + union { QContiguousCacheData *d; QContiguousCacheTypedData<T> *p; } x; + x.d = malloc(d->alloc); x.d->ref = 1; x.d->alloc = d->alloc; x.d->count = x.d->start = x.d->offset = 0; x.d->sharable = true; - if (!d->ref.deref()) free(d); + if (!d->ref.deref()) free(p); d = x.d; } } @@ -257,13 +274,13 @@ void QContiguousCache<T>::clear() template <typename T> inline QContiguousCacheData *QContiguousCache<T>::malloc(int aalloc) { - return static_cast<QContiguousCacheData *>(qMalloc(sizeOfTypedData() + (aalloc - 1) * sizeof(T))); + return QContiguousCacheData::allocate(sizeOfTypedData() + (aalloc - 1) * sizeof(T), alignOfTypedData()); } template <typename T> QContiguousCache<T>::QContiguousCache(int cap) { - p = malloc(cap); + d = malloc(cap); d->ref = 1; d->alloc = cap; d->count = d->start = d->offset = 0; @@ -303,16 +320,16 @@ void QContiguousCache<T>::free(Data *x) { if (QTypeInfo<T>::isComplex) { int oldcount = d->count; - T * i = d->array + d->start; - T * e = d->array + d->alloc; + T * i = p->array + d->start; + T * e = p->array + d->alloc; while (oldcount--) { i->~T(); i++; if (i == e) - i = d->array; + i = p->array; } } - qFree(x); + x->free(x); } template <typename T> void QContiguousCache<T>::append(const T &value) @@ -320,10 +337,10 @@ void QContiguousCache<T>::append(const T &value) detach(); if (QTypeInfo<T>::isComplex) { if (d->count == d->alloc) - (d->array + (d->start+d->count) % d->alloc)->~T(); - new (d->array + (d->start+d->count) % d->alloc) T(value); + (p->array + (d->start+d->count) % d->alloc)->~T(); + new (p->array + (d->start+d->count) % d->alloc) T(value); } else { - d->array[(d->start+d->count) % d->alloc] = value; + p->array[(d->start+d->count) % d->alloc] = value; } if (d->count == d->alloc) { @@ -349,12 +366,12 @@ void QContiguousCache<T>::prepend(const T &value) d->count++; else if (d->count == d->alloc) - (d->array + d->start)->~T(); + (p->array + d->start)->~T(); if (QTypeInfo<T>::isComplex) - new (d->array + d->start) T(value); + new (p->array + d->start) T(value); else - d->array[d->start] = value; + p->array[d->start] = value; } template<typename T> @@ -364,9 +381,9 @@ void QContiguousCache<T>::insert(int pos, const T &value) detach(); if (containsIndex(pos)) { if(QTypeInfo<T>::isComplex) - new (d->array + pos % d->alloc) T(value); + new (p->array + pos % d->alloc) T(value); else - d->array[pos % d->alloc] = value; + p->array[pos % d->alloc] = value; } else if (pos == d->offset-1) prepend(value); else if (pos == d->offset+d->count) @@ -378,18 +395,18 @@ void QContiguousCache<T>::insert(int pos, const T &value) d->start = pos % d->alloc; d->count = 1; if (QTypeInfo<T>::isComplex) - new (d->array + d->start) T(value); + new (p->array + d->start) T(value); else - d->array[d->start] = value; + p->array[d->start] = value; } } template <typename T> inline const T &QContiguousCache<T>::at(int pos) const -{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache<T>::at", "index out of range"); return d->array[pos % d->alloc]; } +{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache<T>::at", "index out of range"); return p->array[pos % d->alloc]; } template <typename T> inline const T &QContiguousCache<T>::operator[](int pos) const -{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache<T>::at", "index out of range"); return d->array[pos % d->alloc]; } +{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache<T>::at", "index out of range"); return p->array[pos % d->alloc]; } template <typename T> inline T &QContiguousCache<T>::operator[](int pos) @@ -397,7 +414,7 @@ inline T &QContiguousCache<T>::operator[](int pos) detach(); if (!containsIndex(pos)) insert(pos, T()); - return d->array[pos % d->alloc]; + return p->array[pos % d->alloc]; } template <typename T> @@ -407,7 +424,7 @@ inline void QContiguousCache<T>::removeFirst() detach(); d->count--; if (QTypeInfo<T>::isComplex) - (d->array + d->start)->~T(); + (p->array + d->start)->~T(); d->start = (d->start + 1) % d->alloc; d->offset++; } @@ -419,7 +436,7 @@ inline void QContiguousCache<T>::removeLast() detach(); d->count--; if (QTypeInfo<T>::isComplex) - (d->array + (d->start + d->count) % d->alloc)->~T(); + (p->array + (d->start + d->count) % d->alloc)->~T(); } template <typename T> diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index f33aba9..c82c389 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -166,29 +166,38 @@ static int countBits(int hint) const int MinNumBits = 4; QHashData QHashData::shared_null = { - 0, 0, Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, MinNumBits, 0, 0, true + 0, 0, Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, MinNumBits, 0, 0, true, false, 0 }; void *QHashData::allocateNode() { - void *ptr = qMalloc(nodeSize); + return allocateNode(0); +} + +void *QHashData::allocateNode(int nodeAlign) +{ + void *ptr = strictAlignment ? qMallocAligned(nodeSize, nodeAlign) : qMalloc(nodeSize); Q_CHECK_PTR(ptr); return ptr; } void QHashData::freeNode(void *node) { - qFree(node); + if (strictAlignment) + qFreeAligned(node); + else + qFree(node); } QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *), int nodeSize) { - return detach_helper( node_duplicate, 0, nodeSize ); + return detach_helper2( node_duplicate, 0, nodeSize, 0 ); } -QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *), - void (*node_delete)(Node *), - int nodeSize) +QHashData *QHashData::detach_helper2(void (*node_duplicate)(Node *, void *), + void (*node_delete)(Node *), + int nodeSize, + int nodeAlign) { union { QHashData *d; @@ -204,6 +213,8 @@ QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *), d->numBits = numBits; d->numBuckets = numBuckets; d->sharable = true; + d->strictAlignment = nodeAlign > 8; + d->reserved = 0; if (numBuckets) { QT_TRY { @@ -222,7 +233,7 @@ QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *), Node *oldNode = buckets[i]; while (oldNode != this_e) { QT_TRY { - Node *dup = static_cast<Node *>(allocateNode()); + Node *dup = static_cast<Node *>(allocateNode(nodeAlign)); QT_TRY { node_duplicate(oldNode, dup); @@ -262,6 +273,7 @@ void QHashData::free_helper(void (*node_delete)(Node *)) while (cur != this_e) { Node *next = cur->next; node_delete(cur); + freeNode(cur); cur = next; } } diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index b65f1d3..1918229 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -125,12 +125,15 @@ struct Q_CORE_EXPORT QHashData short numBits; int numBuckets; uint sharable : 1; + uint strictAlignment : 1; + uint reserved : 30; - void *allocateNode(); + void *allocateNode(); // ### Qt5 remove me + void *allocateNode(int nodeAlign); void freeNode(void *node); QHashData *detach_helper(void (*node_duplicate)(Node *, void *), int nodeSize); // ### Qt5 remove me - QHashData *detach_helper(void (*node_duplicate)(Node *, void *), void (*node_delete)(Node *), - int nodeSize); + QHashData *detach_helper2(void (*node_duplicate)(Node *, void *), void (*node_delete)(Node *), + int nodeSize, int nodeAlign); void mightGrow(); bool willGrow(); void hasShrunk(); @@ -267,6 +270,14 @@ class QHash return reinterpret_cast<Node *>(node); } +#ifdef Q_ALIGNOF + static inline int alignOfNode() { return qMax<int>(sizeof(void*), Q_ALIGNOF(Node)); } + static inline int alignOfDummyNode() { return qMax<int>(sizeof(void*), Q_ALIGNOF(DummyNode)); } +#else + static inline int alignOfNode() { return 0; } + static inline int alignOfDummyNode() { return 0; } +#endif + public: inline QHash() : d(&QHashData::shared_null) { d->ref.ref(); } inline QHash(const QHash<Key, T> &other) : d(other.d) { d->ref.ref(); if (!d->sharable) detach(); } @@ -483,7 +494,7 @@ private: Node **findNode(const Key &key, uint *hp = 0) const; Node *createNode(uint h, const Key &key, const T &value, Node **nextNode); void deleteNode(Node *node); - static void deleteNode(QHashData::Node *node); + static void deleteNode2(QHashData::Node *node); static void duplicateNode(QHashData::Node *originalNode, void *newNode); }; @@ -492,12 +503,12 @@ private: template <class Key, class T> Q_INLINE_TEMPLATE void QHash<Key, T>::deleteNode(Node *node) { - deleteNode(reinterpret_cast<QHashData::Node*>(node)); + deleteNode2(reinterpret_cast<QHashData::Node*>(node)); + d->freeNode(node); } - template <class Key, class T> -Q_INLINE_TEMPLATE void QHash<Key, T>::deleteNode(QHashData::Node *node) +Q_INLINE_TEMPLATE void QHash<Key, T>::deleteNode2(QHashData::Node *node) { #ifdef Q_CC_BOR concrete(node)->~QHashNode<Key, T>(); @@ -506,7 +517,6 @@ Q_INLINE_TEMPLATE void QHash<Key, T>::deleteNode(QHashData::Node *node) #else concrete(node)->~Node(); #endif - qFree(node); } template <class Key, class T> @@ -527,9 +537,9 @@ QHash<Key, T>::createNode(uint ah, const Key &akey, const T &avalue, Node **anex Node *node; if (QTypeInfo<T>::isDummy) { - node = reinterpret_cast<Node *>(new (d->allocateNode()) DummyNode(akey)); + node = reinterpret_cast<Node *>(new (d->allocateNode(alignOfDummyNode())) DummyNode(akey)); } else { - node = new (d->allocateNode()) Node(akey, avalue); + node = new (d->allocateNode(alignOfNode())) Node(akey, avalue); } node->h = ah; @@ -554,7 +564,7 @@ Q_INLINE_TEMPLATE QHash<Key, T> &QHash<Key, T>::unite(const QHash<Key, T> &other template <class Key, class T> Q_OUTOFLINE_TEMPLATE void QHash<Key, T>::freeData(QHashData *x) { - x->free_helper(deleteNode); + x->free_helper(deleteNode2); } template <class Key, class T> @@ -566,8 +576,9 @@ Q_INLINE_TEMPLATE void QHash<Key, T>::clear() template <class Key, class T> Q_OUTOFLINE_TEMPLATE void QHash<Key, T>::detach_helper() { - QHashData *x = d->detach_helper(duplicateNode, deleteNode, - QTypeInfo<T>::isDummy ? sizeof(DummyNode) : sizeof(Node)); + QHashData *x = d->detach_helper2(duplicateNode, deleteNode2, + QTypeInfo<T>::isDummy ? sizeof(DummyNode) : sizeof(Node), + QTypeInfo<T>::isDummy ? alignOfDummyNode() : alignOfNode()); if (!d->ref.deref()) freeData(d); d = x; diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 1385810..3b48c3f 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -53,11 +53,16 @@ QT_BEGIN_NAMESPACE QMapData QMapData::shared_null = { &shared_null, { &shared_null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true + Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true, false, 0 }; QMapData *QMapData::createData() { + return createData(0); +} + +QMapData *QMapData::createData(int alignment) +{ QMapData *d = new QMapData; Q_CHECK_PTR(d); Node *e = reinterpret_cast<Node *>(d); @@ -69,6 +74,8 @@ QMapData *QMapData::createData() d->randomBits = 0; d->insertInOrder = false; d->sharable = true; + d->strictAlignment = alignment > 8; + d->reserved = 0; return d; } @@ -80,11 +87,19 @@ void QMapData::continueFreeData(int offset) while (cur != e) { prev = cur; cur = cur->forward[0]; - qFree(reinterpret_cast<char *>(prev) - offset); + if (strictAlignment) + qFreeAligned(reinterpret_cast<char *>(prev) - offset); + else + qFree(reinterpret_cast<char *>(prev) - offset); } delete this; } +QMapData::Node *QMapData::node_create(Node *update[], int offset) +{ + return node_create(update, offset, 0); +} + /*! Creates a new node inside the data structure. @@ -94,10 +109,12 @@ void QMapData::continueFreeData(int offset) \a offset is an amount of bytes that needs to reserved just before the QMapData::Node structure. + \a alignment dictates the alignment for the data. + \internal \since 4.6 */ -QMapData::Node *QMapData::node_create(Node *update[], int offset) +QMapData::Node *QMapData::node_create(Node *update[], int offset, int alignment) { int level = 0; uint mask = (1 << Sparseness) - 1; @@ -118,7 +135,9 @@ QMapData::Node *QMapData::node_create(Node *update[], int offset) if (level == 3 && !insertInOrder) randomBits = qrand(); - void *concreteNode = qMalloc(offset + sizeof(Node) + level * sizeof(Node *)); + void *concreteNode = strictAlignment ? + qMallocAligned(offset + sizeof(Node) + level * sizeof(Node *), alignment) : + qMalloc(offset + sizeof(Node) + level * sizeof(Node *)); Q_CHECK_PTR(concreteNode); Node *abstractNode = reinterpret_cast<Node *>(reinterpret_cast<char *>(concreteNode) + offset); @@ -145,7 +164,10 @@ void QMapData::node_delete(Node *update[], int offset, Node *node) update[i]->forward[i] = node->forward[i]; } --size; - qFree(reinterpret_cast<char *>(node) - offset); + if (strictAlignment) + qFreeAligned(reinterpret_cast<char *>(node) - offset); + else + qFree(reinterpret_cast<char *>(node) - offset); } #ifdef QT_QMAP_DEBUG diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 688aca6..65c3d2a 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -74,10 +74,14 @@ struct Q_CORE_EXPORT QMapData uint randomBits; uint insertInOrder : 1; uint sharable : 1; + uint strictAlignment : 1; + uint reserved : 29; - static QMapData *createData(); + static QMapData *createData(); // ### Qt5 remove me + static QMapData *createData(int alignment); void continueFreeData(int offset); - Node *node_create(Node *update[], int offset); + Node *node_create(Node *update[], int offset); // ### Qt5 remove me + Node *node_create(Node *update[], int offset, int alignment); void node_delete(Node *update[], int offset, Node *node); #ifdef QT_QMAP_DEBUG uint adjust_ptr(Node *node); @@ -145,6 +149,13 @@ class QMap }; static inline int payload() { return sizeof(PayloadNode) - sizeof(QMapData::Node *); } + static inline int alignment() { +#ifdef Q_ALIGNOF + return qMax(sizeof(void*), Q_ALIGNOF(Node)); +#else + return 0; +#endif + } static inline Node *concrete(QMapData::Node *node) { return reinterpret_cast<Node *>(reinterpret_cast<char *>(node) - payload()); } @@ -414,7 +425,7 @@ template <class Key, class T> Q_INLINE_TEMPLATE typename QMapData::Node * QMap<Key, T>::node_create(QMapData *adt, QMapData::Node *aupdate[], const Key &akey, const T &avalue) { - QMapData::Node *abstractNode = adt->node_create(aupdate, payload()); + QMapData::Node *abstractNode = adt->node_create(aupdate, payload(), alignment()); QT_TRY { Node *concreteNode = concrete(abstractNode); new (&concreteNode->key) Key(akey); @@ -715,7 +726,7 @@ template <class Key, class T> Q_OUTOFLINE_TEMPLATE void QMap<Key, T>::detach_helper() { union { QMapData *d; QMapData::Node *e; } x; - x.d = QMapData::createData(); + x.d = QMapData::createData(alignment()); if (d->size) { x.d->insertInOrder = true; QMapData::Node *update[QMapData::LastLevel + 1]; @@ -905,7 +916,7 @@ Q_OUTOFLINE_TEMPLATE bool QMap<Key, T>::operator==(const QMap<Key, T> &other) co template <class Key, class T> Q_OUTOFLINE_TEMPLATE QMap<Key, T>::QMap(const std::map<Key, T> &other) { - d = QMapData::createData(); + d = QMapData::createData(alignment()); d->insertInOrder = true; typename std::map<Key,T>::const_iterator it = other.end(); while (it != other.begin()) { diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index 20f3a80..8bb1074 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -45,7 +45,14 @@ QT_BEGIN_NAMESPACE -QVectorData QVectorData::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, true, false }; +static inline int alignmentThreshold() +{ + // malloc on 32-bit platforms should return pointers that are 8-byte aligned or more + // while on 64-bit platforms they should be 16-byte aligned or more + return 2 * sizeof(void*); +} + +QVectorData QVectorData::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, true, false, 0 }; QVectorData *QVectorData::malloc(int sizeofTypedData, int size, int sizeofT, QVectorData *init) { @@ -55,6 +62,26 @@ QVectorData *QVectorData::malloc(int sizeofTypedData, int size, int sizeofT, QVe return p; } +QVectorData *QVectorData::allocate(int size, int alignment) +{ + return static_cast<QVectorData *>(alignment > alignmentThreshold() ? qMallocAligned(size, alignment) : qMalloc(size)); +} + +QVectorData *QVectorData::reallocate(QVectorData *x, int newsize, int oldsize, int alignment) +{ + if (alignment > alignmentThreshold()) + return static_cast<QVectorData *>(qReallocAligned(x, newsize, oldsize, alignment)); + return static_cast<QVectorData *>(qRealloc(x, newsize)); +} + +void QVectorData::free(QVectorData *x, int alignment) +{ + if (alignment > alignmentThreshold()) + qFreeAligned(x); + else + qFree(x); +} + int QVectorData::grow(int sizeofTypedData, int size, int sizeofT, bool excessive) { if (excessive) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index b77b53a..7402d77 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -72,6 +72,7 @@ struct Q_CORE_EXPORT QVectorData #else uint sharable : 1; uint capacity : 1; + uint reserved : 30; #endif static QVectorData shared_null; @@ -79,6 +80,9 @@ struct Q_CORE_EXPORT QVectorData // some debugges when the QVector is member of a class within an unnamed namespace. // ### Qt 5: can be removed completely. (Ralf) static QVectorData *malloc(int sizeofTypedData, int size, int sizeofT, QVectorData *init); + static QVectorData *allocate(int size, int alignment); + static QVectorData *reallocate(QVectorData *old, int newsize, int oldsize, int alignment); + static void free(QVectorData *data, int alignment); static int grow(int sizeofTypedData, int size, int sizeofT, bool excessive); }; @@ -87,6 +91,8 @@ struct QVectorTypedData : private QVectorData { // private inheritance as we must not access QVectorData member thought QVectorTypedData // as this would break strict aliasing rules. (in the case of shared_null) T array[1]; + + static inline void free(QVectorTypedData *x, int alignment) { QVectorData::free(x, alignment); } }; class QRegion; @@ -302,6 +308,14 @@ private: // count the padding at the end return reinterpret_cast<const char *>(&(reinterpret_cast<const Data *>(this))->array[1]) - reinterpret_cast<const char *>(this); } + inline int alignOfTypedData() const + { +#ifdef Q_ALIGNOF + return qMax<int>(sizeof(void*), Q_ALIGNOF(Data)); +#else + return 0; +#endif + } }; template <typename T> @@ -373,7 +387,7 @@ QVector<T> &QVector<T>::operator=(const QVector<T> &v) template <typename T> inline QVectorData *QVector<T>::malloc(int aalloc) { - QVectorData *vectordata = static_cast<QVectorData *>(qMalloc(sizeOfTypedData() + (aalloc - 1) * sizeof(T))); + QVectorData *vectordata = QVectorData::allocate(sizeOfTypedData() + (aalloc - 1) * sizeof(T), alignOfTypedData()); Q_CHECK_PTR(vectordata); return vectordata; } @@ -420,7 +434,7 @@ void QVector<T>::free(Data *x) while (i-- != b) i->~T(); } - qFree(x); + x->free(x, alignOfTypedData()); } template <typename T> @@ -459,7 +473,8 @@ void QVector<T>::realloc(int asize, int aalloc) } } else { QT_TRY { - QVectorData *mem = static_cast<QVectorData *>(qRealloc(p, sizeOfTypedData() + (aalloc - 1) * sizeof(T))); + QVectorData *mem = QVectorData::reallocate(d, sizeOfTypedData() + (aalloc - 1) * sizeof(T), + sizeOfTypedData() + (d->alloc - 1) * sizeof(T), alignOfTypedData()); Q_CHECK_PTR(mem); x.d = d = mem; x.d->size = d->size; @@ -472,6 +487,7 @@ void QVector<T>::realloc(int asize, int aalloc) x.d->alloc = aalloc; x.d->sharable = true; x.d->capacity = d->capacity; + x.d->reserved = 0; } if (QTypeInfo<T>::isComplex) { diff --git a/src/corelib/xml/qxmlstream.g b/src/corelib/xml/qxmlstream.g index 3bf0e7d..6c0c0cf 100644 --- a/src/corelib/xml/qxmlstream.g +++ b/src/corelib/xml/qxmlstream.g @@ -243,7 +243,7 @@ public: class QXmlStreamEntityResolver; - +#ifndef QT_NO_XMLSTREAMREADER class QXmlStreamReaderPrivate : public QXmlStreamReader_Table, public QXmlStreamPrivateTagStack{ QXmlStreamReader *q_ptr; Q_DECLARE_PUBLIC(QXmlStreamReader) @@ -1840,4 +1840,6 @@ nmtoken ::= COLON; } return false; } +#endif //QT_NO_XMLSTREAMREADER.xml + ./ diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index ed65409..eee3a13 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -736,9 +736,9 @@ public: } }; - class QXmlStreamEntityResolver; +#ifndef QT_NO_XMLSTREAMREADER class QXmlStreamReaderPrivate : public QXmlStreamReader_Table, public QXmlStreamPrivateTagStack{ QXmlStreamReader *q_ptr; Q_DECLARE_PUBLIC(QXmlStreamReader) @@ -1959,5 +1959,6 @@ bool QXmlStreamReaderPrivate::parse() return false; } +#endif //QT_NO_XMLSTREAMREADER #endif // QXMLSTREAM_P_H diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro index 57c6a58..9ab3920 100644 --- a/src/dbus/dbus.pro +++ b/src/dbus/dbus.pro @@ -1,77 +1,87 @@ -TARGET = QtDBus -QPRO_PWD = $$PWD -QT = core xml -CONFIG += link_pkgconfig -DEFINES += QDBUS_MAKEDLL DBUS_API_SUBJECT_TO_CHANGE +TARGET = QtDBus +QPRO_PWD = $$PWD +QT = core \ + xml +CONFIG += link_pkgconfig +DEFINES += QDBUS_MAKEDLL \ + DBUS_API_SUBJECT_TO_CHANGE QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS - -contains(QT_CONFIG, dbus-linked) { +contains(QT_CONFIG, dbus-linked) { LIBS_PRIVATE += $$QT_LIBS_DBUS - DEFINES += QT_LINKED_LIBDBUS + DEFINES += QT_LINKED_LIBDBUS } -#INCLUDEPATH += . - -unix { - QMAKE_PKGCONFIG_DESCRIPTION = Qt DBus module - QMAKE_PKGCONFIG_REQUIRES = QtCore QtXml +# INCLUDEPATH += . +unix { + QMAKE_PKGCONFIG_DESCRIPTION = Qt \ + DBus \ + module + QMAKE_PKGCONFIG_REQUIRES = QtCore \ + QtXml } - -win32 { - LIBS_PRIVATE += -lws2_32 -ladvapi32 -lnetapi32 -luser32 - CONFIG(debug, debug|release):LIBS_PRIVATE += -ldbus-1d - else:LIBS_PRIVATE += -ldbus-1 +win32 { + LIBS_PRIVATE += -lws2_32 \ + -ladvapi32 \ + -lnetapi32 \ + -luser32 + CONFIG(debug, debug|release):LIBS_PRIVATE += -ldbus-1d + else:LIBS_PRIVATE += -ldbus-1 } - include(../qbase.pri) - -PUB_HEADERS = qdbusargument.h \ - qdbusconnectioninterface.h \ - qdbusmacros.h \ - qdbuserror.h \ - qdbusextratypes.h \ - qdbusmessage.h \ - qdbusserver.h \ - qdbusconnection.h \ - qdbusabstractinterface.h \ - qdbusinterface.h \ - qdbusabstractadaptor.h \ - qdbusreply.h \ - qdbusmetatype.h \ - qdbuspendingcall.h \ - qdbuspendingreply.h \ - qdbuscontext.h - +PUB_HEADERS = qdbusargument.h \ + qdbusconnectioninterface.h \ + qdbusmacros.h \ + qdbuserror.h \ + qdbusextratypes.h \ + qdbusmessage.h \ + qdbusserver.h \ + qdbusconnection.h \ + qdbusabstractinterface.h \ + qdbusinterface.h \ + qdbusabstractadaptor.h \ + qdbusreply.h \ + qdbusmetatype.h \ + qdbuspendingcall.h \ + qdbuspendingreply.h \ + qdbuscontext.h HEADERS += $$PUB_HEADERS \ - qdbusconnection_p.h qdbusmessage_p.h \ - qdbusinterface_p.h qdbusxmlparser_p.h qdbusabstractadaptor_p.h \ - qdbusargument_p.h qdbusutil_p.h qdbusabstractinterface_p.h \ - qdbuscontext_p.h qdbusthreaddebug_p.h qdbusintegrator_p.h \ - qdbuspendingcall_p.h qdbus_symbols_p.h - -SOURCES += qdbusconnection.cpp \ - qdbusconnectioninterface.cpp \ - qdbuserror.cpp \ - qdbusintegrator.cpp \ - qdbusmessage.cpp \ - qdbusserver.cpp \ - qdbusabstractinterface.cpp \ - qdbusinterface.cpp \ - qdbusxmlparser.cpp \ - qdbusutil.cpp \ - qdbusintrospection.cpp \ - qdbusabstractadaptor.cpp \ - qdbusinternalfilters.cpp \ - qdbusmetaobject.cpp \ - qdbusxmlgenerator.cpp \ - qdbusmisc.cpp \ - qdbusargument.cpp \ - qdbusreply.cpp \ - qdbusmetatype.cpp \ - qdbusextratypes.cpp \ - qdbusmarshaller.cpp \ - qdbuscontext.cpp \ - qdbuspendingcall.cpp \ - qdbuspendingreply.cpp \ - qdbus_symbols.cpp - + qdbusconnection_p.h \ + qdbusmessage_p.h \ + qdbusinterface_p.h \ + qdbusxmlparser_p.h \ + qdbusabstractadaptor_p.h \ + qdbusargument_p.h \ + qdbusutil_p.h \ + qdbusabstractinterface_p.h \ + qdbuscontext_p.h \ + qdbusthreaddebug_p.h \ + qdbusintegrator_p.h \ + qdbuspendingcall_p.h \ + qdbus_symbols_p.h \ + qdbusservicewatcher.h +SOURCES += qdbusconnection.cpp \ + qdbusconnectioninterface.cpp \ + qdbuserror.cpp \ + qdbusintegrator.cpp \ + qdbusmessage.cpp \ + qdbusserver.cpp \ + qdbusabstractinterface.cpp \ + qdbusinterface.cpp \ + qdbusxmlparser.cpp \ + qdbusutil.cpp \ + qdbusintrospection.cpp \ + qdbusabstractadaptor.cpp \ + qdbusinternalfilters.cpp \ + qdbusmetaobject.cpp \ + qdbusxmlgenerator.cpp \ + qdbusmisc.cpp \ + qdbusargument.cpp \ + qdbusreply.cpp \ + qdbusmetatype.cpp \ + qdbusextratypes.cpp \ + qdbusmarshaller.cpp \ + qdbuscontext.cpp \ + qdbuspendingcall.cpp \ + qdbuspendingreply.cpp \ + qdbus_symbols.cpp \ + qdbusservicewatcher.cpp diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 61a9d95..994da10 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -279,9 +279,17 @@ QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d, : QDBusAbstractInterfaceBase(d, parent) { // keep track of the service owner - if (!d_func()->currentOwner.isEmpty()) - QObject::connect(d_func()->connectionPrivate(), SIGNAL(serviceOwnerChanged(QString,QString,QString)), - this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); + if (d.isValid && + d.connection.isConnected() + && !d.service.isEmpty() + && !d.service.startsWith(QLatin1Char(':'))) + d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service + QString(), // path + QLatin1String(DBUS_INTERFACE_DBUS), // interface + QLatin1String("NameOwnerChanged"), + QStringList() << d.service, + QString(), // signature + this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } /*! @@ -296,9 +304,17 @@ QDBusAbstractInterface::QDBusAbstractInterface(const QString &service, const QSt con, false), parent) { // keep track of the service owner - if (d_func()->connection.isConnected()) - QObject::connect(d_func()->connectionPrivate(), SIGNAL(serviceOwnerChanged(QString,QString,QString)), - this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); + if (d_func()->isValid && + d_func()->connection.isConnected() + && !service.isEmpty() + && !service.startsWith(QLatin1Char(':'))) + d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service + QString(), // path + QLatin1String(DBUS_INTERFACE_DBUS), // interface + QLatin1String("NameOwnerChanged"), + QStringList() << service, + QString(), //signature + this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } /*! @@ -544,9 +560,16 @@ void QDBusAbstractInterface::connectNotify(const char *signal) return; QDBusConnectionPrivate *conn = d->connectionPrivate(); - if (conn) - conn->connectRelay(d->service, d->currentOwner, d->path, d->interface, + if (conn) { + // do we know what our owner is? + QString owner; + if (!d->service.isEmpty() && d->currentOwner.isNull()) + owner = QLatin1String(""); + else + owner = d->currentOwner; + conn->connectRelay(d->service, owner, d->path, d->interface, this, signal); + } } /*! diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index bb0d06f..d7088ff 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -557,42 +557,61 @@ QDBusPendingCall QDBusConnection::asyncCall(const QDBusMessage &message, int tim bool QDBusConnection::connect(const QString &service, const QString &path, const QString& interface, const QString &name, QObject *receiver, const char *slot) { - return connect(service, path, interface, name, QString(), receiver, slot); + return connect(service, path, interface, name, QStringList(), QString(), receiver, slot); } /*! - Disconnects the signal specified by the \a service, \a path, \a interface and \a name parameters from - the slot \a slot in object \a receiver. The arguments \a service and \a path can be empty, - denoting a disconnection from all signals of the (\a interface, \a name) pair, from all remote - applications. + \overload - Returns true if the disconnection was successful. + Connects the signal to the slot \a slot in object \a + receiver. Unlike the previous connect() overload, this function + allows one to specify the parameter signature to be connected + using the \a signature variable. The function will then verify + that this signature can be delivered to the slot specified by \a + slot and return false otherwise. + + Returns true if the connection was successful. + + \note This function verifies that the signal signature matches the + slot's parameters, but it does not verify that the actual + signal exists with the given signature in the remote + service. */ -bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString &interface, - const QString &name, QObject *receiver, const char *slot) +bool QDBusConnection::connect(const QString &service, const QString &path, const QString& interface, + const QString &name, const QString &signature, + QObject *receiver, const char *slot) { - return disconnect(service, path, interface, name, QString(), receiver, slot); + return connect(service, path, interface, name, QStringList(), signature, receiver, slot); } /*! \overload + \since 4.6 Connects the signal to the slot \a slot in object \a - receiver. Unlike the other connect() overload, this function + receiver. Unlike the previous connect() overload, this function allows one to specify the parameter signature to be connected using the \a signature variable. The function will then verify that this signature can be delivered to the slot specified by \a slot and return false otherwise. + The \a argumentMatch parameter lists the string parameters to be matched, + in sequential order. Note that, to match an empty string, you need to + pass a QString that is empty but not null (i.e., QString("")). A null + QString skips matching at that position. + + Returns true if the connection was successful. + \note This function verifies that the signal signature matches the slot's parameters, but it does not verify that the actual signal exists with the given signature in the remote service. */ bool QDBusConnection::connect(const QString &service, const QString &path, const QString& interface, - const QString &name, const QString &signature, + const QString &name, const QStringList &argumentMatch, const QString &signature, QObject *receiver, const char *slot) { + if (!receiver || !slot || !d || !d->connection) return false; if (!interface.isEmpty() && !QDBusUtil::isValidInterfaceName(interface)) @@ -600,53 +619,57 @@ bool QDBusConnection::connect(const QString &service, const QString &path, const if (interface.isEmpty() && name.isEmpty()) return false; - // check the slot - QDBusConnectionPrivate::SignalHook hook; - QString key; - QString name2 = name; - if (name2.isNull()) - name2.detach(); - QString owner = d->getNameOwner(service); // we don't care if the owner is empty - hook.signature = signature; // it might get started later - if (!d->prepareHook(hook, key, service, owner, path, interface, name, receiver, slot, 0, false)) - return false; // don't connect - - // avoid duplicating: + // it might get started later QDBusWriteLocker locker(ConnectAction, d); - QDBusConnectionPrivate::SignalHookHash::ConstIterator it = d->signalHooks.find(key); - QDBusConnectionPrivate::SignalHookHash::ConstIterator end = d->signalHooks.constEnd(); - for ( ; it != end && it.key() == key; ++it) { - const QDBusConnectionPrivate::SignalHook &entry = it.value(); - if (entry.service == hook.service && - entry.owner == hook.owner && - entry.path == hook.path && - entry.signature == hook.signature && - entry.obj == hook.obj && - entry.midx == hook.midx) { - // no need to compare the parameters if it's the same slot - return true; // already there - } - } + return d->connectSignal(service, owner, path, interface, name, argumentMatch, signature, receiver, slot); +} + +/*! + Disconnects the signal specified by the \a service, \a path, \a interface + and \a name parameters from the slot \a slot in object \a receiver. The + arguments must be the same as passed to the connect() function. - d->connectSignal(key, hook); - return true; + Returns true if the disconnection was successful. +*/ +bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString &interface, + const QString &name, QObject *receiver, const char *slot) +{ + return disconnect(service, path, interface, name, QStringList(), QString(), receiver, slot); } /*! \overload - Disconnects the signal from the slot \a slot in object \a - receiver. Unlike the other disconnect() overload, this function - allows one to specify the parameter signature to be disconnected - using the \a signature variable. The function will then verify - that this signature is connected to the slot specified by \a slot - and return false otherwise. + Disconnects the signal specified by the \a service, \a path, \a + interface, \a name, and \a signature parameters from the slot \a slot in + object \a receiver. The arguments must be the same as passed to the + connect() function. + + Returns true if the disconnection was successful. */ bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString& interface, const QString &name, const QString &signature, QObject *receiver, const char *slot) { + return disconnect(service, path, interface, name, QStringList(), signature, receiver, slot); +} + +/*! + \overload + \since 4.6 + + Disconnects the signal specified by the \a service, \a path, \a + interface, \a name, \a argumentMatch, and \a signature parameters from + the slot \a slot in object \a receiver. The arguments must be the same as + passed to the connect() function. + + Returns true if the disconnection was successful. +*/ +bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString& interface, + const QString &name, const QStringList &argumentMatch, const QString &signature, + QObject *receiver, const char *slot) +{ if (!receiver || !slot || !d || !d->connection) return false; if (!interface.isEmpty() && !QDBusUtil::isValidInterfaceName(interface)) @@ -654,38 +677,8 @@ bool QDBusConnection::disconnect(const QString &service, const QString &path, co if (interface.isEmpty() && name.isEmpty()) return false; - // check the slot - QDBusConnectionPrivate::SignalHook hook; - QString key; - QString name2 = name; - if (name2.isNull()) - name2.detach(); - - QString owner = d->getNameOwner(service); // we don't care of owner is empty - hook.signature = signature; - if (!d->prepareHook(hook, key, service, owner, path, interface, name, receiver, slot, 0, false)) - return false; // don't disconnect - - // avoid duplicating: QDBusWriteLocker locker(DisconnectAction, d); - QDBusConnectionPrivate::SignalHookHash::Iterator it = d->signalHooks.find(key); - QDBusConnectionPrivate::SignalHookHash::Iterator end = d->signalHooks.end(); - for ( ; it != end && it.key() == key; ++it) { - const QDBusConnectionPrivate::SignalHook &entry = it.value(); - if (entry.service == hook.service && - entry.owner == hook.owner && - entry.path == hook.path && - entry.signature == hook.signature && - entry.obj == hook.obj && - entry.midx == hook.midx) { - // no need to compare the parameters if it's the same slot - d->disconnectSignal(it); - return true; // it was there - } - } - - // the slot was not found - return false; + return d->disconnectSignal(service, path, interface, name, argumentMatch, signature, receiver, slot); } /*! @@ -1012,14 +1005,10 @@ void QDBusConnectionPrivate::setBusService(const QDBusConnection &connection) busService = new QDBusConnectionInterface(connection, this); ref.deref(); // busService has increased the refcounting to us // avoid cyclic refcounting -// if (mode != PeerMode) - QObject::connect(busService, SIGNAL(serviceOwnerChanged(QString,QString,QString)), - this, SIGNAL(serviceOwnerChanged(QString,QString,QString))); QObject::connect(this, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)), busService, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)), Qt::QueuedConnection); - } /*! diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h index 85fc7c2..82ae726 100644 --- a/src/dbus/qdbusconnection.h +++ b/src/dbus/qdbusconnection.h @@ -132,15 +132,21 @@ public: bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot); - bool disconnect(const QString &service, const QString &path, const QString &interface, - const QString &name, QObject *receiver, const char *slot); - bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, const QString& signature, QObject *receiver, const char *slot); + bool connect(const QString &service, const QString &path, const QString &interface, + const QString &name, const QStringList &argumentMatch, const QString& signature, + QObject *receiver, const char *slot); + + bool disconnect(const QString &service, const QString &path, const QString &interface, + const QString &name, QObject *receiver, const char *slot); bool disconnect(const QString &service, const QString &path, const QString &interface, const QString &name, const QString& signature, QObject *receiver, const char *slot); + bool disconnect(const QString &service, const QString &path, const QString &interface, + const QString &name, const QStringList &argumentMatch, const QString& signature, + QObject *receiver, const char *slot); bool registerObject(const QString &path, QObject *object, RegisterOptions options = ExportAdaptors); diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index ab96457..ed29e4e 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -154,6 +154,7 @@ public: typedef QMultiHash<QString, SignalHook> SignalHookHash; typedef QHash<QString, QDBusMetaObject* > MetaObjectHash; typedef QHash<QByteArray, int> MatchRefCountHash; + typedef QHash<QString, int> WatchedServicesHash; public: // public methods are entry points from other objects @@ -175,8 +176,14 @@ public: QDBusPendingCallPrivate *sendWithReplyAsync(const QDBusMessage &message, int timeout = -1); int sendWithReplyAsync(const QDBusMessage &message, QObject *receiver, const char *returnMethod, const char *errorMethod, int timeout = -1); + bool connectSignal(const QString &service, const QString &owner, const QString &path, const QString& interface, + const QString &name, const QStringList &argumentMatch, const QString &signature, + QObject *receiver, const char *slot); void connectSignal(const QString &key, const SignalHook &hook); SignalHookHash::Iterator disconnectSignal(SignalHookHash::Iterator &it); + bool disconnectSignal(const QString &service, const QString &path, const QString& interface, + const QString &name, const QStringList &argumentMatch, const QString &signature, + QObject *receiver, const char *slot); void registerObject(const ObjectTreeNode *node); void connectRelay(const QString &service, const QString ¤tOwner, const QString &path, const QString &interface, @@ -264,6 +271,7 @@ public: QDBusError lastError; QStringList serviceNames; + WatchedServicesHash watchedServiceNames; SignalHookHash signalHooks; MatchRefCountHash matchRefCounts; ObjectTreeNode rootNode; @@ -278,6 +286,7 @@ public: static bool prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key, const QString &service, const QString &owner, const QString &path, const QString &interface, const QString &name, + const QStringList &argMatch, QObject *receiver, const char *signal, int minMIdx, bool buildSignature); static DBusHandlerResult messageFilter(DBusConnection *, DBusMessage *, void *); diff --git a/src/dbus/qdbusconnectioninterface.cpp b/src/dbus/qdbusconnectioninterface.cpp index 8670ed5..414d318 100644 --- a/src/dbus/qdbusconnectioninterface.cpp +++ b/src/dbus/qdbusconnectioninterface.cpp @@ -336,8 +336,14 @@ void QDBusConnectionInterface::connectNotify(const char *signalName) else if (qstrcmp(signalName, SIGNAL(serviceUnregistered(QString))) == 0) QDBusAbstractInterface::connectNotify(SIGNAL(NameLost(QString))); - else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0) + else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0) { + static bool warningPrinted = false; + if (!warningPrinted) { + qWarning("Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)"); + warningPrinted = true; + } QDBusAbstractInterface::connectNotify(SIGNAL(NameOwnerChanged(QString,QString,QString))); + } } /*! diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 686b56f..748658d 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -392,7 +392,7 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v static QByteArray buildMatchRule(const QString &service, const QString & /*owner*/, const QString &objectPath, const QString &interface, - const QString &member, const QString & /*signature*/) + const QString &member, const QStringList &argMatch, const QString & /*signature*/) { QString result = QLatin1String("type='signal',"); QString keyValue = QLatin1String("%1='%2',"); @@ -406,6 +406,14 @@ static QByteArray buildMatchRule(const QString &service, const QString & /*owner if (!member.isEmpty()) result += keyValue.arg(QLatin1String("member"), member); + // add the argument string-matching now + if (!argMatch.isEmpty()) { + keyValue = QLatin1String("arg%1='%2',"); + for (int i = 0; i < argMatch.count(); ++i) + if (!argMatch.at(i).isNull()) + result += keyValue.arg(i).arg(argMatch.at(i)); + } + result.chop(1); // remove ending comma return result.toLatin1(); } @@ -493,6 +501,11 @@ static QObject *findChildObject(const QDBusConnectionPrivate::ObjectTreeNode *ro return 0; } +static bool shouldWatchService(const QString &service) +{ + return !service.isEmpty() && !service.startsWith(QLatin1Char(':')); +} + extern QDBUS_EXPORT void qDBusAddSpyHook(QDBusSpyHook); void qDBusAddSpyHook(QDBusSpyHook hook) { @@ -933,6 +946,7 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) QDBusMetaTypeId::init(); rootNode.flags = 0; + watchedServiceNames[QLatin1String(DBUS_SERVICE_DBUS)] = 1; connect(this, SIGNAL(serviceOwnerChanged(QString,QString,QString)), this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); @@ -1195,6 +1209,7 @@ int QDBusConnectionPrivate::findSlot(QObject* obj, const QByteArray &normalizedN bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key, const QString &service, const QString &owner, const QString &path, const QString &interface, const QString &name, + const QStringList &argMatch, QObject *receiver, const char *signal, int minMIdx, bool buildSignature) { @@ -1235,7 +1250,7 @@ bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hoo hook.signature += QLatin1String( QDBusMetaType::typeToSignature( hook.params.at(i) ) ); } - hook.matchRule = buildMatchRule(service, owner, path, interface, mname, hook.signature); + hook.matchRule = buildMatchRule(service, owner, path, interface, mname, argMatch, hook.signature); return true; // connect to this signal } @@ -1478,7 +1493,7 @@ void QDBusConnectionPrivate::handleSignal(const QString &key, const QDBusMessage //qDBusDebug() << signalHooks.keys(); for ( ; it != end && it.key() == key; ++it) { const SignalHook &hook = it.value(); - if (!hook.owner.isEmpty() && hook.owner != msg.service()) + if (!hook.owner.isNull() && hook.owner != msg.service()) continue; if (!hook.path.isEmpty() && hook.path != msg.path()) continue; @@ -1933,6 +1948,42 @@ int QDBusConnectionPrivate::sendWithReplyAsync(const QDBusMessage &message, QObj return 1; } +bool QDBusConnectionPrivate::connectSignal(const QString &service, const QString &owner, + const QString &path, const QString &interface, const QString &name, + const QStringList &argumentMatch, const QString &signature, + QObject *receiver, const char *slot) +{ + // check the slot + QDBusConnectionPrivate::SignalHook hook; + QString key; + QString name2 = name; + if (name2.isNull()) + name2.detach(); + + hook.signature = signature; + if (!prepareHook(hook, key, service, owner, path, interface, name, argumentMatch, receiver, slot, 0, false)) + return false; // don't connect + + // avoid duplicating: + QDBusConnectionPrivate::SignalHookHash::ConstIterator it = signalHooks.find(key); + QDBusConnectionPrivate::SignalHookHash::ConstIterator end = signalHooks.constEnd(); + for ( ; it != end && it.key() == key; ++it) { + const QDBusConnectionPrivate::SignalHook &entry = it.value(); + if (entry.service == hook.service && + entry.owner == hook.owner && + entry.path == hook.path && + entry.signature == hook.signature && + entry.obj == hook.obj && + entry.midx == hook.midx) { + // no need to compare the parameters if it's the same slot + return true; // already there + } + } + + connectSignal(key, hook); + return true; +} + void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook &hook) { signalHooks.insertMulti(key, hook); @@ -1960,15 +2011,81 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook hook.obj->metaObject()->method(hook.midx).signature(), qPrintable(qerror.name()), qPrintable(qerror.message())); Q_ASSERT(false); + } else { + // Successfully connected the signal + // Do we need to watch for this name? + if (shouldWatchService(hook.service)) { + WatchedServicesHash::Iterator it = watchedServiceNames.find(hook.service); + if (it != watchedServiceNames.end()) { + // already watching + ++it.value(); + } else { + // we need to watch for this service changing + QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS); + connectSignal(dbusServerService, dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS), + QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), + this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); + } + } } } } +bool QDBusConnectionPrivate::disconnectSignal(const QString &service, + const QString &path, const QString &interface, const QString &name, + const QStringList &argumentMatch, const QString &signature, + QObject *receiver, const char *slot) +{ + // check the slot + QDBusConnectionPrivate::SignalHook hook; + QString key; + QString name2 = name; + if (name2.isNull()) + name2.detach(); + + hook.signature = signature; + if (!prepareHook(hook, key, service, QString(), path, interface, name, argumentMatch, receiver, slot, 0, false)) + return false; // don't disconnect + + // avoid duplicating: + QDBusConnectionPrivate::SignalHookHash::Iterator it = signalHooks.find(key); + QDBusConnectionPrivate::SignalHookHash::Iterator end = signalHooks.end(); + for ( ; it != end && it.key() == key; ++it) { + const QDBusConnectionPrivate::SignalHook &entry = it.value(); + if (entry.service == hook.service && + //entry.owner == hook.owner && + entry.path == hook.path && + entry.signature == hook.signature && + entry.obj == hook.obj && + entry.midx == hook.midx) { + // no need to compare the parameters if it's the same slot + disconnectSignal(it); + return true; // it was there + } + } + + // the slot was not found + return false; +} + QDBusConnectionPrivate::SignalHookHash::Iterator QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it) { const SignalHook &hook = it.value(); + WatchedServicesHash::Iterator sit = watchedServiceNames.find(hook.service); + if (sit != watchedServiceNames.end()) { + if (sit.value() == 1) { + watchedServiceNames.erase(sit); + QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS); + disconnectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS), + QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), + this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); + } else { + --sit.value(); + } + } + bool erase = false; MatchRefCountHash::iterator i = matchRefCounts.find(hook.matchRule); if (i == matchRefCounts.end()) { @@ -2027,7 +2144,7 @@ void QDBusConnectionPrivate::connectRelay(const QString &service, const QString SignalHook hook; QString key; - if (!prepareHook(hook, key, service, owner, path, interface, QString(), receiver, signal, + if (!prepareHook(hook, key, service, owner, path, interface, QString(), QStringList(), receiver, signal, QDBusAbstractInterface::staticMetaObject.methodCount(), true)) return; // don't connect @@ -2059,7 +2176,7 @@ void QDBusConnectionPrivate::disconnectRelay(const QString &service, const QStri SignalHook hook; QString key; - if (!prepareHook(hook, key, service, owner, path, interface, QString(), receiver, signal, + if (!prepareHook(hook, key, service, owner, path, interface, QString(), QStringList(), receiver, signal, QDBusAbstractInterface::staticMetaObject.methodCount(), true)) return; // don't connect diff --git a/src/dbus/qdbusservicewatcher.cpp b/src/dbus/qdbusservicewatcher.cpp new file mode 100644 index 0000000..4872732 --- /dev/null +++ b/src/dbus/qdbusservicewatcher.cpp @@ -0,0 +1,374 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdbusservicewatcher.h" +#include "qdbusconnection.h" +#include "qdbus_symbols_p.h" + +#include <QStringList> + +#include <private/qobject_p.h> + +Q_GLOBAL_STATIC_WITH_ARGS(QString, busService, (QLatin1String(DBUS_SERVICE_DBUS))) +Q_GLOBAL_STATIC_WITH_ARGS(QString, busPath, (QLatin1String(DBUS_PATH_DBUS))) +Q_GLOBAL_STATIC_WITH_ARGS(QString, busInterface, (QLatin1String(DBUS_INTERFACE_DBUS))) +Q_GLOBAL_STATIC_WITH_ARGS(QString, signalName, (QLatin1String("NameOwnerChanged"))) + +class QDBusServiceWatcherPrivate: public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QDBusServiceWatcher) +public: + QDBusServiceWatcherPrivate(const QDBusConnection &c, QDBusServiceWatcher::WatchMode wm) + : connection(c), watchMode(wm) + { + } + + QStringList servicesWatched; + QDBusConnection connection; + QDBusServiceWatcher::WatchMode watchMode; + + void _q_serviceOwnerChanged(const QString &, const QString &, const QString &); + void setConnection(const QStringList &services, const QDBusConnection &c, QDBusServiceWatcher::WatchMode watchMode); + + QStringList matchArgsForService(const QString &service); + void addService(const QString &service); + void removeService(const QString &service); +}; + +void QDBusServiceWatcherPrivate::_q_serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner) +{ + Q_Q(QDBusServiceWatcher); + emit q->serviceOwnerChanged(service, oldOwner, newOwner); + if (oldOwner.isEmpty()) + emit q->serviceRegistered(service); + else if (newOwner.isEmpty()) + emit q->serviceUnregistered(service); +} + +void QDBusServiceWatcherPrivate::setConnection(const QStringList &s, const QDBusConnection &c, QDBusServiceWatcher::WatchMode wm) +{ + if (connection.isConnected()) { + // remove older rules + foreach (const QString &s, servicesWatched) + removeService(s); + } + + connection = c; + watchMode = wm; + servicesWatched = s; + + if (connection.isConnected()) { + // add new rules + foreach (const QString &s, servicesWatched) + addService(s); + } +} + +QStringList QDBusServiceWatcherPrivate::matchArgsForService(const QString &service) +{ + QStringList matchArgs; + matchArgs << service; + + switch (watchMode) { + case QDBusServiceWatcher::WatchForOwnerChange: + break; + + case QDBusServiceWatcher::WatchForRegistration: + matchArgs << QString::fromLatin1("", 0); + break; + + case QDBusServiceWatcher::WatchForUnregistration: + matchArgs << QString() << QString::fromLatin1("", 0); + break; + } + return matchArgs; +} + +void QDBusServiceWatcherPrivate::addService(const QString &service) +{ + QStringList matchArgs = matchArgsForService(service); + connection.connect(*busService(), *busPath(), *busInterface(), *signalName(), + matchArgs, QString(), q_func(), + SLOT(_q_serviceOwnerChanged(QString,QString,QString))); +} + +void QDBusServiceWatcherPrivate::removeService(const QString &service) +{ + QStringList matchArgs = matchArgsForService(service); + connection.disconnect(*busService(), *busPath(), *busInterface(), *signalName(), + matchArgs, QString(), q_func(), + SLOT(_q_serviceOwnerChanged(QString,QString,QString))); +} + +/*! + \class QDBusServiceWatcher + \since 4.6 + \inmodule QtDBus + + \brief The QDBusServiceWatcher class allows the user to watch for a bus service change. + + A QDBusServiceWatcher object can be used to notify the application about + an ownership change of a service name on the bus. It has three watch + modes: + + \list + \o watching for service registration only + \o watching for service unregistration only + \o watching for any kind of service ownership change (the default mode) + \endlist + + Besides being created or deleted, services may change owners without a + unregister/register operation happening. So the \ref serviceRegistered() + and \ref serviceUnregistered() signals may not be emitted if that + happens. + + This class is more efficient than using the + QDBusConnectionInterface::serviceOwnerChanged() signal because it allows + one to receive only the signals for which the class is interested in. + + \sa QDBusConnection +*/ + +/*! + \enum QDBusServiceWatcher::WatchModeFlag + + QDBusServiceWatcher supports three different watch modes, which are configured by this flag: + + \value WatchForRegistration watch for service registration only, ignoring + any signals related to other service ownership change. + + \value WatchForUnregistration watch for service unregistration only, + ignoring any signals related to other service ownership change. + + \value WatchForOwnerChange watch for any kind of service ownership + change. +*/ + +/*! + \property QDBusServiceWatcher::watchMode + + The \c watchMode property holds the current watch mode for this + QDBusServiceWatcher object. The default value for this property is + QDBusServiceWatcher::WatchForOwnershipChange. +*/ + +/*! + \property QDBusServiceWatcher::watchedServices + + The \c servicesWatched property holds the list of services watched. + + Note that modifying this list with setServicesWatched() is an expensive + operation. If you can, prefer to change it by way of addWatchedService() + and removeWatchedService(). +*/ + +/*! + \fn void QDBusServiceWatcher::serviceRegistered(const QString &serviceName) + + This signal is emitted whenever this object detects that the service \a + serviceName became available on the bus. + + \sa serviceUnregistered(), serviceOwnerChanged() +*/ + +/*! + \fn void QDBusServiceWatcher::serviceUnregistered(const QString &serviceName) + + This signal is emitted whenever this object detects that the service \a + serviceName was unregistered from the bus and is no longer available. + + \sa serviceRegistered(), serviceOwnerChanged() +*/ + +/*! + \fn void QDBusServiceWatcher::serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner) + + This signal is emitted whenever this object detects that there was a + service ownership change relating to the \a serviceName service. The \a + oldOwner parameter contains the old owner name and \a newOwner is the new + owner. Both \a oldOwner and \a newOwner are unique connection names. + + Note that this signal is also emitted whenever the \a serviceName service + was registered or unregistered. If it was registered, \a oldOwner will + contain an empty string, whereas if it was unregistered, \a newOwner will + contain an empty string. + + If you need only to find out if the service is registered or unregistered + only, without being notified that the ownership changed, consider using + the specific modes for those operations. This class is more efficient if + you use the more specific modes. + + \sa serviceRegistered(), serviceUnregistered() +*/ + +/*! + Creates a QDBusServiceWatcher object. Note that until you set a + connection with setConnection(), this object will not emit any signals. + + The \a parent parameter is passed to QObject to set the parent of this + object. +*/ +QDBusServiceWatcher::QDBusServiceWatcher(QObject *parent) + : QObject(*new QDBusServiceWatcherPrivate(QDBusConnection(QString()), WatchForOwnerChange), parent) +{ +} + +/*! + Creates a QDBusServiceWatcher object and attaches it to the \a connection + connection. Also, this function immediately starts watching for \a + watchMode changes to service \a service. + + The \a parent parameter is passed to QObject to set the parent of this + object. +*/ +QDBusServiceWatcher::QDBusServiceWatcher(const QString &service, const QDBusConnection &connection, WatchMode watchMode, QObject *parent) + : QObject(*new QDBusServiceWatcherPrivate(connection, watchMode), parent) +{ + d_func()->setConnection(QStringList() << service, connection, watchMode); +} + +/*! + Destroys the QDBusServiceWatcher object and releases any resources + associated with it. +*/ +QDBusServiceWatcher::~QDBusServiceWatcher() +{ +} + +/*! + Returns the list of D-Bus services that are being watched. + + \sa setWatchedServices() +*/ +QStringList QDBusServiceWatcher::watchedServices() const +{ + return d_func()->servicesWatched; +} + +/*! + Sets the list of D-Bus services being watched to be \a services. + + Note that setting the entire list means removing all previous rules for + watching services and adding new ones. This is an expensive operation and + should be avoided, if possible. Instead, use addWatchedService() and + removeWatchedService() if you can to manipulate entries in the list. +*/ +void QDBusServiceWatcher::setWatchedServices(const QStringList &services) +{ + Q_D(QDBusServiceWatcher); + if (services == d->servicesWatched) + return; + d->setConnection(services, d->connection, d->watchMode); +} + +/*! + Adds \a newService to the list of services to be watched by this object. + This function is more efficient than setWatchedServices() and should be + used whenever possible to add services. +*/ +void QDBusServiceWatcher::addWatchedService(const QString &newService) +{ + Q_D(QDBusServiceWatcher); + if (d->servicesWatched.contains(newService)) + return; + d->addService(newService); + d->servicesWatched << newService; +} + +/*! + Removes the \a service from the list of services being watched by this + object. Note that D-Bus notifications are asynchronous, so there may + still be signals pending delivery about \a service. Those signals will + still be emitted whenever the D-Bus messages are processed. + + This function returns true if any services were removed. +*/ +bool QDBusServiceWatcher::removeWatchedService(const QString &service) +{ + Q_D(QDBusServiceWatcher); + d->removeService(service); + return d->servicesWatched.removeOne(service); +} + +QDBusServiceWatcher::WatchMode QDBusServiceWatcher::watchMode() const +{ + return d_func()->watchMode; +} + +void QDBusServiceWatcher::setWatchMode(WatchMode mode) +{ + Q_D(QDBusServiceWatcher); + if (mode == d->watchMode) + return; + d->setConnection(d->servicesWatched, d->connection, mode); +} + +/*! + Returns the QDBusConnection that this object is attached to. + + \sa setConnection() +*/ +QDBusConnection QDBusServiceWatcher::connection() const +{ + return d_func()->connection; +} + +/*! + Sets the D-Bus connection that this object is attached to be \a + connection. All services watched will be transferred to this connection. + + Note that QDBusConnection objects are reference counted: + QDBusServiceWatcher will keep a reference for this connection while it + exists. The connection is not closed until the reference count drops to + zero, so this will ensure that any notifications are received while this + QDBusServiceWatcher object exists. + + \sa connection() +*/ +void QDBusServiceWatcher::setConnection(const QDBusConnection &connection) +{ + Q_D(QDBusServiceWatcher); + if (connection.name() == d->connection.name()) + return; + d->setConnection(d->servicesWatched, connection, d->watchMode); +} + +#include "moc_qdbusservicewatcher.cpp" diff --git a/src/dbus/qdbusservicewatcher.h b/src/dbus/qdbusservicewatcher.h new file mode 100644 index 0000000..a968a9c --- /dev/null +++ b/src/dbus/qdbusservicewatcher.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDBUSSERVICEWATCHER_H +#define QDBUSSERVICEWATCHER_H + +#include <QtCore/qobject.h> +#include <QtDBus/qdbusmacros.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(DBus) + +class QDBusConnection; + +class QDBusServiceWatcherPrivate; +class QDBUS_EXPORT QDBusServiceWatcher: public QObject +{ + Q_OBJECT + Q_PROPERTY(QStringList watchedServices READ watchedServices WRITE setWatchedServices) + Q_PROPERTY(WatchMode watchMode READ watchMode WRITE setWatchMode) +public: + enum WatchModeFlag { + WatchForRegistration = 0x01, + WatchForUnregistration = 0x02, + WatchForOwnerChange = 0x03 + }; + Q_DECLARE_FLAGS(WatchMode, WatchModeFlag) + + explicit QDBusServiceWatcher(QObject *parent = 0); + QDBusServiceWatcher(const QString &service, const QDBusConnection &connection, + WatchMode watchMode = WatchForOwnerChange, QObject *parent = 0); + ~QDBusServiceWatcher(); + + QStringList watchedServices() const; + void setWatchedServices(const QStringList &services); + void addWatchedService(const QString &newService); + bool removeWatchedService(const QString &service); + + WatchMode watchMode() const; + void setWatchMode(WatchMode mode); + + QDBusConnection connection() const; + void setConnection(const QDBusConnection &connection); + +Q_SIGNALS: + void serviceRegistered(const QString &service); + void serviceUnregistered(const QString &service); + void serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner); + +private: + Q_PRIVATE_SLOT(d_func(), void _q_serviceOwnerChanged(QString,QString,QString)) + Q_DISABLE_COPY(QDBusServiceWatcher) + Q_DECLARE_PRIVATE(QDBusServiceWatcher) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusServiceWatcher::WatchMode) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDBUSSERVICEWATCHER_H diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index eab842f..c6b4a77 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -777,7 +777,7 @@ void QFileDialog::setDirectory(const QString &directory) QModelIndex root = d->model->setRootPath(newDirectory); d->qFileDialogUi->newFolderButton->setEnabled(d->model->flags(root) & Qt::ItemIsDropEnabled); if (root != d->rootIndex()) { -#ifndef QT_NO_COMPLETER +#ifndef QT_NO_FSCOMPLETER if (directory.endsWith(QLatin1Char('/'))) d->completer->setCompletionPrefix(newDirectory); else @@ -2177,12 +2177,12 @@ void QFileDialogPrivate::createWidgets() #ifndef QT_NO_SHORTCUT qFileDialogUi->fileNameLabel->setBuddy(qFileDialogUi->fileNameEdit); #endif -#ifndef QT_NO_COMPLETER +#ifndef QT_NO_FSCOMPLETER completer = new QFSCompleter(model, q); qFileDialogUi->fileNameEdit->setCompleter(completer); QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(textChanged(QString)), q, SLOT(_q_autoCompleteFileName(QString))); -#endif // QT_NO_COMPLETER +#endif // QT_NO_FSCOMPLETER QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(textChanged(QString)), q, SLOT(_q_updateOkButton())); @@ -2302,7 +2302,7 @@ void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel) proxyModel->setSourceModel(d->model); d->qFileDialogUi->listView->setModel(d->proxyModel); d->qFileDialogUi->treeView->setModel(d->proxyModel); -#ifndef QT_NO_COMPLETER +#ifndef QT_NO_FSCOMPLETER d->completer->setModel(d->proxyModel); d->completer->proxyModel = d->proxyModel; #endif @@ -2312,7 +2312,7 @@ void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel) d->proxyModel = 0; d->qFileDialogUi->listView->setModel(d->model); d->qFileDialogUi->treeView->setModel(d->model); -#ifndef QT_NO_COMPLETER +#ifndef QT_NO_FSCOMPLETER d->completer->setModel(d->model); d->completer->sourceModel = d->model; d->completer->proxyModel = 0; @@ -3218,7 +3218,7 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e) } } -#ifndef QT_NO_COMPLETER +#ifndef QT_NO_FSCOMPLETER QString QFSCompleter::pathFromIndex(const QModelIndex &index) const { diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h index 32cd397..0e447a3 100644 --- a/src/gui/dialogs/qfiledialog_p.h +++ b/src/gui/dialogs/qfiledialog_p.h @@ -234,9 +234,9 @@ public: QStringList watching; QFileSystemModel *model; -#ifndef QT_NO_COMPLETER +#ifndef QT_NO_FSCOMPLETER QFSCompleter *completer; -#endif //QT_NO_COMPLETER +#endif //QT_NO_FSCOMPLETER QFileDialog::FileMode fileMode; QFileDialog::AcceptMode acceptMode; diff --git a/src/gui/dialogs/qfscompleter_p.h b/src/gui/dialogs/qfscompleter_p.h index cb1b427..1edab2d 100644 --- a/src/gui/dialogs/qfscompleter_p.h +++ b/src/gui/dialogs/qfscompleter_p.h @@ -56,7 +56,7 @@ #include "qcompleter.h" #include <QtGui/qfilesystemmodel.h> QT_BEGIN_NAMESPACE -#ifndef QT_NO_COMPLETER +#ifndef QT_NO_FSCOMPLETER /*! QCompleter that can deal with QFileSystemModel @@ -76,7 +76,7 @@ public: QAbstractProxyModel *proxyModel; QFileSystemModel *sourceModel; }; -#endif // QT_NO_COMPLETER +#endif // QT_NO_FSCOMPLETER QT_END_NAMESPACE #endif // QFSCOMPLETOR_P_H diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp index 7daa273..6fc270d 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/gui/dialogs/qprintdialog_unix.cpp @@ -696,7 +696,7 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p) #ifndef QT_NO_FILESYSTEMMODEL QFileSystemModel *fsm = new QFileSystemModel(widget.filename); fsm->setRootPath(QDir::homePath()); -#if !defined(QT_NO_COMPLETER) && !defined(QT_NO_FILEDIALOG) +#if !defined(QT_NO_FSCOMPLETER) && !defined(QT_NO_FILEDIALOG) widget.filename->setCompleter(new QFSCompleter(fsm, widget.filename)); #endif #endif diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 3815b60..83f4f79 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -97,6 +97,8 @@ */ #include "qgraphicseffect_p.h" +#include "private/qgraphicsitem_p.h" + #include <QtGui/qgraphicsitem.h> #include <QtGui/qimage.h> @@ -210,7 +212,23 @@ const QStyleOption *QGraphicsEffectSource::styleOption() const */ void QGraphicsEffectSource::draw(QPainter *painter) { - d_func()->draw(painter); + Q_D(const QGraphicsEffectSource); + + QPixmap pm; + if (QPixmapCache::find(d->m_cacheKey, &pm)) { + QTransform restoreTransform; + if (d->m_cachedSystem == Qt::DeviceCoordinates) { + restoreTransform = painter->worldTransform(); + painter->setWorldTransform(QTransform()); + } + + painter->drawPixmap(d->m_cachedOffset, pm); + + if (d->m_cachedSystem == Qt::DeviceCoordinates) + painter->setWorldTransform(restoreTransform); + } else { + d_func()->draw(painter); + } } /*! @@ -260,6 +278,12 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse return ((QGraphicsPixmapItem *) item)->pixmap(); } + if (system == Qt::DeviceCoordinates && item + && !static_cast<const QGraphicsItemEffectSourcePrivate *>(d_func())->info) { + qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context"); + return QPixmap(); + } + QPixmap pm; if (d->m_cachedSystem == system && d->m_cachedMode == mode) QPixmapCache::find(d->m_cacheKey, &pm); @@ -279,6 +303,13 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse return pm; } +void QGraphicsEffectSourcePrivate::invalidateCache(bool effectRectChanged) const +{ + if (effectRectChanged && m_cachedMode != QGraphicsEffectSource::ExpandToEffectRectPadMode) + return; + QPixmapCache::remove(m_cacheKey); +} + /*! Constructs a new QGraphicsEffect instance having the specified \a parent. @@ -418,7 +449,7 @@ void QGraphicsEffect::updateBoundingRect() Q_D(QGraphicsEffect); if (d->source) { d->source->d_func()->effectBoundingRectChanged(); - d->source->d_func()->invalidateCache(); + d->source->d_func()->invalidateCache(true); } } @@ -606,6 +637,26 @@ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou */ /*! + \enum QGraphicsBlurEffect::BlurHint + \since 4.6 + + This enum describes the possible hints that can be used to control how + blur effects are applied. The hints might not have an effect in all the + paint engines. + + \value QualityHint Indicates that rendering quality is the most important factor, + at the potential cost of lower performance. + + \value PerformanceHint Indicates that rendering performance is the most important factor, + at the potential cost of lower quality. + + \value AnimationHint Indicates that the blur radius is going to be animated, hinting + that the implementation can keep a cache of blurred verisons of the source pixmap. + Do not use this hint if the source item is going to be dynamically changing. +*/ + + +/*! Constructs a new QGraphicsBlurEffect instance. The \a parent parameter is passed to QGraphicsEffect's constructor. */ @@ -613,7 +664,7 @@ QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent) { Q_D(QGraphicsBlurEffect); - d->filter->setBlurHint(Qt::PerformanceHint); + d->filter->setBlurHint(QGraphicsBlurEffect::PerformanceHint); } /*! @@ -660,20 +711,19 @@ void QGraphicsBlurEffect::setBlurRadius(qreal radius) \property QGraphicsBlurEffect::blurHint \brief the blur hint of the effect. - Use the Qt::PerformanceHint hint to say that you want a faster blur, - and the Qt::QualityHint hint to say that you prefer a higher quality blur. - - When animating the blur radius it's recommended to use Qt::PerformanceHint. + Use the PerformanceHint hint to say that you want a faster blur, + the QualityHint hint to say that you prefer a higher quality blur, + or the AnimationHint when you want to animate the blur radius. - By default, the blur hint is Qt::PerformanceHint. + By default, the blur hint is PerformanceHint. */ -Qt::RenderHint QGraphicsBlurEffect::blurHint() const +QGraphicsBlurEffect::BlurHint QGraphicsBlurEffect::blurHint() const { Q_D(const QGraphicsBlurEffect); return d->filter->blurHint(); } -void QGraphicsBlurEffect::setBlurHint(Qt::RenderHint hint) +void QGraphicsBlurEffect::setBlurHint(QGraphicsBlurEffect::BlurHint hint) { Q_D(QGraphicsBlurEffect); if (d->filter->blurHint() == hint) @@ -684,7 +734,7 @@ void QGraphicsBlurEffect::setBlurHint(Qt::RenderHint hint) } /*! - \fn void QGraphicsBlurEffect::blurHintChanged(Qt::RenderHint hint) + \fn void QGraphicsBlurEffect::blurHintChanged(Qt::BlurHint hint) This signal is emitted whenever the effect's blur hint changes. The \a hint parameter holds the effect's new blur hint. diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index bf18581..7335a25 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -183,22 +183,28 @@ class Q_GUI_EXPORT QGraphicsBlurEffect: public QGraphicsEffect { Q_OBJECT Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) - Q_PROPERTY(Qt::RenderHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged) + Q_PROPERTY(BlurHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged) public: + enum BlurHint { + QualityHint, + PerformanceHint, + AnimationHint + }; + QGraphicsBlurEffect(QObject *parent = 0); ~QGraphicsBlurEffect(); QRectF boundingRectFor(const QRectF &rect) const; qreal blurRadius() const; - Qt::RenderHint blurHint() const; + BlurHint blurHint() const; public Q_SLOTS: void setBlurRadius(qreal blurRadius); - void setBlurHint(Qt::RenderHint hint); + void setBlurHint(BlurHint hint); Q_SIGNALS: void blurRadiusChanged(qreal blurRadius); - void blurHintChanged(Qt::RenderHint hint); + void blurHintChanged(BlurHint hint); protected: void draw(QPainter *painter, QGraphicsEffectSource *source); diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index 1ed7103..0ff5794 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -85,7 +85,7 @@ public: virtual QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset = 0, QGraphicsEffectSource::PixmapPadMode mode = QGraphicsEffectSource::ExpandToTransparentBorderPadMode) const = 0; virtual void effectBoundingRectChanged() = 0; - void invalidateCache() const { QPixmapCache::remove(m_cacheKey); } + void invalidateCache(bool effectRectChanged = false) const; friend class QGraphicsScenePrivate; friend class QGraphicsItem; diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index 22a7cf9..56d70e1 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -123,7 +123,7 @@ */ #include "qgraphicsanchorlayout_p.h" - +#ifndef QT_NO_GRAPHICSVIEW QT_BEGIN_NAMESPACE QGraphicsAnchor::QGraphicsAnchor(QGraphicsAnchorLayout *parentLayout) @@ -536,3 +536,4 @@ QSizeF QGraphicsAnchorLayout::sizeHint(Qt::SizeHint which, const QSizeF &constra } QT_END_NAMESPACE +#endif //QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 9337a36..41aa8aa 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -49,7 +49,7 @@ #endif #include "qgraphicsanchorlayout_p.h" - +#ifndef QT_NO_GRAPHICSVIEW QT_BEGIN_NAMESPACE @@ -2728,3 +2728,4 @@ void QGraphicsAnchorLayoutPrivate::dumpGraph(const QString &name) #endif QT_END_NAMESPACE +#endif //QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 9628d64..7dd0d65 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -60,7 +60,7 @@ #include "qgraphicsanchorlayout.h" #include "qgraph_p.h" #include "qsimplex_p.h" - +#ifndef QT_NO_GRAPHICSVIEW QT_BEGIN_NAMESPACE /* @@ -531,5 +531,6 @@ public: }; QT_END_NAMESPACE +#endif //QT_NO_GRAPHICSVIEW #endif diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 93b9ba9..e69a295 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -9746,12 +9746,14 @@ bool QGraphicsTextItem::sceneEvent(QEvent *event) // Reset the focus widget's input context, regardless // of how this item gained or lost focus. if (QWidget *fw = qApp->focusWidget()) { +#ifndef QT_NO_IM if (QInputContext *qic = fw->inputContext()) { if (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut) qic->reset(); else qic->update(); } +#endif //QT_NO_IM } break; default: diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index b992398..33f5f28 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -746,6 +746,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, focusItem = 0; sendEvent(lastFocusItem, &event); +#ifndef QT_NO_IM if (lastFocusItem && (lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) { // Reset any visible preedit text @@ -761,6 +762,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, views.at(i)->inputContext()->reset(); } } +#endif //QT_NO_IM } if (item) { diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp index e2a3f08..83bc9e1 100644 --- a/src/gui/graphicsview/qgraphicstransform.cpp +++ b/src/gui/graphicsview/qgraphicstransform.cpp @@ -93,8 +93,8 @@ #include <QDebug> #include <QtCore/qmath.h> +#ifndef QT_NO_GRAPHICSVIEW QT_BEGIN_NAMESPACE - void QGraphicsTransformPrivate::setItem(QGraphicsItem *i) { if (item == i) @@ -565,3 +565,4 @@ void QGraphicsRotation::applyTo(QMatrix4x4 *matrix) const #include "moc_qgraphicstransform.cpp" QT_END_NAMESPACE +#endif //QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicstransform.h b/src/gui/graphicsview/qgraphicstransform.h index 58075aa..58e3077 100644 --- a/src/gui/graphicsview/qgraphicstransform.h +++ b/src/gui/graphicsview/qgraphicstransform.h @@ -47,6 +47,7 @@ #include <QtGui/QTransform> #include <QtGui/QMatrix4x4> +#ifndef QT_NO_GRAPHICSVIEW QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -150,5 +151,6 @@ private: QT_END_NAMESPACE QT_END_HEADER +#endif //QT_NO_GRAPHICSVIEW #endif // QFXTRANSFORM_H diff --git a/src/gui/graphicsview/qgraphicstransform_p.h b/src/gui/graphicsview/qgraphicstransform_p.h index 9e708b2..ddf99bb 100644 --- a/src/gui/graphicsview/qgraphicstransform_p.h +++ b/src/gui/graphicsview/qgraphicstransform_p.h @@ -54,7 +54,7 @@ // #include "private/qobject_p.h" - +#ifndef QT_NO_GRAPHICSVIEW QT_BEGIN_NAMESPACE class QGraphicsItem; @@ -73,5 +73,6 @@ public: }; QT_END_NAMESPACE +#endif //QT_NO_GRAPHCISVIEW #endif // QGRAPHICSTRANSFORM_P_H diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index f72aa8a..c88f678 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -281,6 +281,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < #include <QtGui/qstyleoption.h> #include <QtGui/qinputcontext.h> #ifdef Q_WS_X11 +#include <QtGui/qpaintengine.h> #include <private/qt_x11_p.h> #endif @@ -3294,7 +3295,12 @@ void QGraphicsView::paintEvent(QPaintEvent *event) backgroundPainter.setClipRegion(d->backgroundPixmapExposed, Qt::ReplaceClip); if (viewTransformed) backgroundPainter.setTransform(viewTransform); - backgroundPainter.setCompositionMode(QPainter::CompositionMode_Source); +#ifdef Q_WS_X11 +#undef X11 + if (backgroundPainter.paintEngine()->type() != QPaintEngine::X11) +#define X11 qt_x11Data +#endif + backgroundPainter.setCompositionMode(QPainter::CompositionMode_Source); drawBackground(&backgroundPainter, exposedSceneRect); d->backgroundPixmapExposed = QRegion(); } diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index e0779a0..cff9cd2 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -66,6 +66,7 @@ #include "private/qkde_p.h" #endif +#ifndef QT_NO_ICON QT_BEGIN_NAMESPACE /*! @@ -1217,3 +1218,4 @@ QSize QIcon::pixmapSize(Size which) */ QT_END_NAMESPACE +#endif //QT_NO_ICON diff --git a/src/gui/image/qicon_p.h b/src/gui/image/qicon_p.h index fc96a65..43a59a6 100644 --- a/src/gui/image/qicon_p.h +++ b/src/gui/image/qicon_p.h @@ -60,6 +60,7 @@ #include <QtGui/qicon.h> #include <QtGui/qiconengine.h> +#ifndef QT_NO_ICON QT_BEGIN_NAMESPACE class QIconPrivate @@ -134,5 +135,5 @@ private: }; QT_END_NAMESPACE - +#endif //QT_NO_ICON #endif // QICON_P_H diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 46c5431..15af7a2 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - +#ifndef QT_NO_ICON #include <private/qiconloader_p.h> #include <private/qapplication_p.h> @@ -61,7 +61,6 @@ #ifdef Q_WS_X11 #include <private/qt_x11_p.h> -#include <private/gtksymbols_p.h> #endif QT_BEGIN_NAMESPACE @@ -92,11 +91,13 @@ QIconLoader::QIconLoader() : if (m_systemTheme.isEmpty()) m_systemTheme = fallbackTheme(); +#ifndef QT_NO_LIBRARY QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterfaceV2_iid, QLatin1String("/iconengines"), Qt::CaseInsensitive); if (iconFactoryLoader.keys().contains(QLatin1String("svg"))) m_supportsSvg = true; +#endif //QT_NO_LIBRARY } QIconLoader *QIconLoader::instance() @@ -160,7 +161,7 @@ QIconTheme::QIconTheme(const QString &themeName) break; } } - +#ifndef QT_NO_SETTINGS if (themeIndex.exists()) { const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat); QStringListIterator keyIterator(indexReader.allKeys()); @@ -213,6 +214,7 @@ QIconTheme::QIconTheme(const QString &themeName) if (!m_parents.contains(QLatin1String("hicolor"))) m_parents.append(QLatin1String("hicolor")); } +#endif //QT_NO_SETTINGS } QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName, @@ -546,3 +548,5 @@ void QIconLoaderEngine::virtual_hook(int id, void *data) } QT_END_NAMESPACE + +#endif //QT_NO_ICON diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h index b152d46..2a330d3 100644 --- a/src/gui/image/qiconloader_p.h +++ b/src/gui/image/qiconloader_p.h @@ -42,6 +42,7 @@ #ifndef QDESKTOPICON_P_H #define QDESKTOPICON_P_H +#ifndef QT_NO_ICON // // W A R N I N G // ------------- @@ -185,3 +186,5 @@ private: QT_END_NAMESPACE #endif // QDESKTOPICON_P_H + +#endif //QT_NO_ICON diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp index ac30646..35322e9 100644 --- a/src/gui/image/qimagepixmapcleanuphooks.cpp +++ b/src/gui/image/qimagepixmapcleanuphooks.cpp @@ -40,7 +40,8 @@ ****************************************************************************/ #include "qimagepixmapcleanuphooks_p.h" -#include "qpixmapdata_p.h" +#include "private/qpixmapdata_p.h" +#include "private/qimage_p.h" QT_BEGIN_NAMESPACE @@ -132,4 +133,19 @@ void QImagePixmapCleanupHooks::executeImageHooks(qint64 key) qt_image_cleanup_hook_64(key); } +void QImagePixmapCleanupHooks::enableCleanupHooks(const QPixmap &pixmap) +{ + enableCleanupHooks(const_cast<QPixmap &>(pixmap).data_ptr().data()); +} + +void QImagePixmapCleanupHooks::enableCleanupHooks(QPixmapData *pixmapData) +{ + pixmapData->is_cached = true; +} + +void QImagePixmapCleanupHooks::enableCleanupHooks(const QImage &image) +{ + const_cast<QImage &>(image).data_ptr()->is_cached = true; +} + QT_END_NAMESPACE diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h index 16c8974..9e490d7 100644 --- a/src/gui/image/qimagepixmapcleanuphooks_p.h +++ b/src/gui/image/qimagepixmapcleanuphooks_p.h @@ -70,6 +70,10 @@ public: static QImagePixmapCleanupHooks *instance(); + static void enableCleanupHooks(const QImage &image); + static void enableCleanupHooks(const QPixmap &pixmap); + static void enableCleanupHooks(QPixmapData *pixmapData); + // Gets called when a pixmap is about to be modified: void addPixmapModificationHook(_qt_pixmap_cleanup_hook_pm); diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 45ff5f4..c452b9a 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -113,13 +113,10 @@ void QPixmap::init(int w, int h, Type type) void QPixmap::init(int w, int h, int type) { - QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem(); - if (gs) - data = gs->createPixmapData(static_cast<QPixmapData::PixelType>(type)); + if ((w > 0 && h > 0) || type == QPixmapData::BitmapType) + data = QPixmapData::create(w, h, (QPixmapData::PixelType) type); else - data = QGraphicsSystem::createDefaultPixmapData(static_cast<QPixmapData::PixelType>(type)); - - data->resize(w, h); + data = 0; } /*! @@ -307,7 +304,7 @@ QPixmap::QPixmap(const char * const xpm[]) QImage image(xpm); if (!image.isNull()) { - if (data->pixelType() == QPixmapData::BitmapType) + if (data && data->pixelType() == QPixmapData::BitmapType) *this = QBitmap::fromImage(image); else *this = fromImage(image); @@ -322,8 +319,8 @@ QPixmap::QPixmap(const char * const xpm[]) QPixmap::~QPixmap() { - Q_ASSERT(data->ref >= 1); // Catch if ref-counting changes again - if (data->is_cached && data->ref == 1) // ref will be decrememnted after destructor returns + Q_ASSERT(!data || data->ref >= 1); // Catch if ref-counting changes again + if (data && data->is_cached && data->ref == 1) // ref will be decrememnted after destructor returns QImagePixmapCleanupHooks::executePixmapDestructionHooks(this); } @@ -544,7 +541,7 @@ bool QPixmap::isQBitmap() const */ bool QPixmap::isNull() const { - return data->isNull(); + return !data || data->isNull(); } /*! @@ -556,7 +553,7 @@ bool QPixmap::isNull() const */ int QPixmap::width() const { - return data->width(); + return data ? data->width() : 0; } /*! @@ -568,7 +565,7 @@ int QPixmap::width() const */ int QPixmap::height() const { - return data->height(); + return data ? data->height() : 0; } /*! @@ -581,7 +578,7 @@ int QPixmap::height() const */ QSize QPixmap::size() const { - return QSize(data->width(), data->height()); + return data ? QSize(data->width(), data->height()) : QSize(); } /*! @@ -593,7 +590,7 @@ QSize QPixmap::size() const */ QRect QPixmap::rect() const { - return QRect(0, 0, data->width(), data->height()); + return data ? QRect(0, 0, data->width(), data->height()) : QRect(); } /*! @@ -609,7 +606,7 @@ QRect QPixmap::rect() const */ int QPixmap::depth() const { - return data->depth(); + return data ? data->depth() : 0; } /*! @@ -639,7 +636,7 @@ void QPixmap::resize_helper(const QSize &s) return; // Create new pixmap - QPixmap pm(QSize(w, h), data->type); + QPixmap pm(QSize(w, h), data ? data->type : QPixmapData::PixmapType); bool uninit = false; #if defined(Q_WS_X11) QX11PixmapData *x11Data = data->classId() == QPixmapData::X11Class ? static_cast<QX11PixmapData*>(data.data()) : 0; @@ -728,6 +725,9 @@ void QPixmap::setMask(const QBitmap &mask) return; } + if (isNull()) + return; + if (static_cast<const QPixmap &>(mask).data == data) // trying to selfmask return; @@ -826,11 +826,14 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers QFileInfo info(fileName); QString key = QLatin1String("qt_pixmap_") + info.absoluteFilePath() + QLatin1Char('_') + QString::number(info.lastModified().toTime_t()) + QLatin1Char('_') + - QString::number(info.size()) + QLatin1Char('_') + QString::number(data->pixelType()); + QString::number(info.size()) + QLatin1Char('_') + QString::number(data ? data->pixelType() : QPixmapData::PixmapType); if (QPixmapCache::find(key, *this)) return true; + if (!data) + data = QPixmapData::create(0, 0, QPixmapData::PixmapType); + if (data->fromFile(fileName, format, flags)) { QPixmapCache::insert(key, *this); return true; @@ -863,6 +866,9 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::I if (len == 0 || buf == 0) return false; + if (!data) + data = QPixmapData::create(0, 0, QPixmapData::PixmapType); + return data->fromData(buf, len, format, flags); } @@ -1008,6 +1014,9 @@ int QPixmap::serialNumber() const */ qint64 QPixmap::cacheKey() const { + if (isNull()) + return 0; + int classKey = data->classId(); if (classKey >= 1024) classKey = -(classKey >> 10); @@ -1224,7 +1233,7 @@ QPixmap::QPixmap(const QImage& image) QPixmap &QPixmap::operator=(const QImage &image) { - if (data->pixelType() == QPixmapData::BitmapType) + if (data && data->pixelType() == QPixmapData::BitmapType) *this = QBitmap::fromImage(image); else *this = fromImage(image); @@ -1254,7 +1263,7 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Color */ bool QPixmap::convertFromImage(const QImage &image, ColorMode mode) { - if (data->pixelType() == QPixmapData::BitmapType) + if (data && data->pixelType() == QPixmapData::BitmapType) *this = QBitmap::fromImage(image, colorModeToFlags(mode)); else *this = fromImage(image, colorModeToFlags(mode)); @@ -1341,7 +1350,7 @@ Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy, bool QPixmap::isDetached() const { - return data->ref == 1; + return data && data->ref == 1; } /*! \internal @@ -1753,7 +1762,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) */ bool QPixmap::hasAlpha() const { - return (data->hasAlphaChannel() || !data->mask().isNull()); + return data && (data->hasAlphaChannel() || !data->mask().isNull()); } /*! @@ -1764,7 +1773,7 @@ bool QPixmap::hasAlpha() const */ bool QPixmap::hasAlphaChannel() const { - return data->hasAlphaChannel(); + return data && data->hasAlphaChannel(); } /*! @@ -1772,7 +1781,7 @@ bool QPixmap::hasAlphaChannel() const */ int QPixmap::metric(PaintDeviceMetric metric) const { - return data->metric(metric); + return data ? data->metric(metric) : 0; } /*! @@ -1844,7 +1853,7 @@ void QPixmap::setAlphaChannel(const QPixmap &alphaChannel) */ QPixmap QPixmap::alphaChannel() const { - return data->alphaChannel(); + return data ? data->alphaChannel() : QPixmap(); } /*! @@ -1852,7 +1861,7 @@ QPixmap QPixmap::alphaChannel() const */ QPaintEngine *QPixmap::paintEngine() const { - return data->paintEngine(); + return data ? data->paintEngine() : 0; } /*! @@ -1867,7 +1876,7 @@ QPaintEngine *QPixmap::paintEngine() const */ QBitmap QPixmap::mask() const { - return data->mask(); + return data ? data->mask() : QBitmap(); } /*! @@ -1916,6 +1925,9 @@ int QPixmap::defaultDepth() */ void QPixmap::detach() { + if (!data) + return; + QPixmapData::ClassId id = data->classId(); if (id == QPixmapData::RasterClass) { QRasterPixmapData *rasterData = static_cast<QRasterPixmapData*>(data.data()); diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index afa6f83..9209d45 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -305,11 +305,15 @@ void QMacPixmapData::fromImage(const QImage &img, } break; } - case QImage::Format_Indexed8: - for (int x = 0; x < w; ++x) { - *(drow+x) = PREMUL(image.color(*(srow + x))); + case QImage::Format_Indexed8: { + int numColors = image.numColors(); + if (numColors > 0) { + for (int x = 0; x < w; ++x) { + int index = *(srow + x); + *(drow+x) = PREMUL(image.color(qMin(index, numColors))); + } } - break; + } break; case QImage::Format_RGB32: for (int x = 0; x < w; ++x) *(drow+x) = *(((quint32*)srow) + x) | 0xFF000000; @@ -965,6 +969,9 @@ Qt::HANDLE QPixmap::macQDAlphaHandle() const Qt::HANDLE QPixmap::macCGHandle() const { + if (isNull()) + return 0; + if (data->classId() == QPixmapData::MacClass) { QMacPixmapData *d = static_cast<QMacPixmapData *>(data.data()); if (!d->cg_data) diff --git a/src/gui/image/qpixmap_qws.cpp b/src/gui/image/qpixmap_qws.cpp index 6b4283e..a8516a5 100644 --- a/src/gui/image/qpixmap_qws.cpp +++ b/src/gui/image/qpixmap_qws.cpp @@ -114,7 +114,7 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) QRgb* QPixmap::clut() const { - if (data->classId() == QPixmapData::RasterClass) { + if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast<const QRasterPixmapData*>(data.data()); return d->image.colorTable().data(); } @@ -124,7 +124,7 @@ QRgb* QPixmap::clut() const int QPixmap::numCols() const { - if (data->classId() == QPixmapData::RasterClass) { + if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast<const QRasterPixmapData*>(data.data()); return d->image.numColors(); } @@ -134,7 +134,7 @@ int QPixmap::numCols() const const uchar* QPixmap::qwsBits() const { - if (data->classId() == QPixmapData::RasterClass) { + if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast<const QRasterPixmapData*>(data.data()); return d->image.bits(); } @@ -144,7 +144,7 @@ const uchar* QPixmap::qwsBits() const int QPixmap::qwsBytesPerLine() const { - if (data->classId() == QPixmapData::RasterClass) { + if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast<const QRasterPixmapData*>(data.data()); return d->image.bytesPerLine(); } diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 7086341..7f0a504 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -311,7 +311,7 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h) CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const { QPixmapData *data = pixmapData(); - if (data->isNull()) + if (!data || data->isNull()) return 0; return reinterpret_cast<CFbsBitmap*>(data->toNativeType(QPixmapData::FbsBitmap)); @@ -337,8 +337,9 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) if (!bitmap) return QPixmap(); - QPixmap pixmap; - pixmap.pixmapData()->fromNativeType(reinterpret_cast<void*>(bitmap), QPixmapData::FbsBitmap); + QScopedPointer<QS60PixmapData> data(new QS60PixmapData(QPixmapData::PixmapType)); + data->fromNativeType(reinterpret_cast<void*>(bitmap), QPixmapData::FbsBitmap); + QPixmap pixmap(data.take()); return pixmap; } @@ -751,9 +752,9 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage) if (!sgImage) return QPixmap(); - QPixmap pixmap; - pixmap.pixmapData()->fromNativeType(reinterpret_cast<void*>(sgImage), QPixmapData::SgImage); - + QScopedPointer<QS60PixmapData> data(new QS60PixmapData(QPixmapData::PixmapType)); + data->fromNativeType(reinterpret_cast<void*>(bitmap), QPixmapData::SgImage); + QPixmap pixmap(data.take()); return pixmap; } diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index 1b61484..04027c1 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -121,6 +121,9 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h ) HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const { + if (isNull()) + return 0; + HBITMAP bitmap = 0; if (data->classId() == QPixmapData::RasterClass) { QRasterPixmapData* d = static_cast<QRasterPixmapData*>(data.data()); diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index ea9eff9..8a0120a 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1976,6 +1976,9 @@ void QPixmap::x11SetScreen(int screen) return; } + if (isNull()) + return; + if (data->classId() != QPixmapData::X11Class) return; @@ -2078,7 +2081,7 @@ bool QX11PixmapData::hasAlphaChannel() const const QX11Info &QPixmap::x11Info() const { - if (data->classId() == QPixmapData::X11Class) + if (data && data->classId() == QPixmapData::X11Class) return static_cast<QX11PixmapData*>(data.data())->xinfo; else { static QX11Info nullX11Info; @@ -2135,7 +2138,7 @@ QPaintEngine* QX11PixmapData::paintEngine() const Qt::HANDLE QPixmap::x11PictureHandle() const { #ifndef QT_NO_XRENDER - if (data->classId() == QPixmapData::X11Class) + if (data && data->classId() == QPixmapData::X11Class) return static_cast<const QX11PixmapData*>(data.data())->picture; else return 0; diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 1ad1f02..10194e4 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -51,6 +51,19 @@ QT_BEGIN_NAMESPACE const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +QPixmapData *QPixmapData::create(int w, int h, PixelType type) +{ + QPixmapData *data; + QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem(); + if (gs) + data = gs->createPixmapData(static_cast<QPixmapData::PixelType>(type)); + else + data = QGraphicsSystem::createDefaultPixmapData(static_cast<QPixmapData::PixelType>(type)); + data->resize(w, h); + return data; +} + + QPixmapData::QPixmapData(PixelType pixelType, int objectId) : w(0), h(0), diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 2f4f201..d1bb92a 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -122,6 +122,8 @@ public: virtual void fromNativeType(void* pixmap, NativeType type); #endif + static QPixmapData *create(int w, int h, PixelType type); + protected: void setSerialNumber(int serNo); int w; @@ -131,12 +133,11 @@ protected: private: friend class QPixmap; - friend class QGLContextPrivate; friend class QX11PixmapData; friend class QS60PixmapData; + friend class QImagePixmapCleanupHooks; // Needs to set is_cached friend class QGLTextureCache; //Needs to check the reference count friend class QExplicitlySharedDataPointer<QPixmapData>; - friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs to set is_cached QAtomicInt ref; int detach_no; diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index d0de03e..e50cc8b 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -504,10 +504,10 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q class QPixmapBlurFilterPrivate : public QPixmapFilterPrivate { public: - QPixmapBlurFilterPrivate() : radius(5), hint(Qt::PerformanceHint) {} + QPixmapBlurFilterPrivate() : radius(5), hint(QGraphicsBlurEffect::PerformanceHint) {} qreal radius; - Qt::RenderHint hint; + QGraphicsBlurEffect::BlurHint hint; }; @@ -556,12 +556,18 @@ qreal QPixmapBlurFilter::radius() const Setting the blur hint to PerformanceHint causes the implementation to trade off visual quality to blur the image faster. Setting the blur hint to QualityHint causes the implementation to improve - visual quality at the expense of speed. The implementation is free - to ignore this value if it only has a single blur algorithm. + visual quality at the expense of speed. + + AnimationHint causes the implementation to optimize for animating + the blur radius, possibly by caching blurred versions of the source + pixmap. + + The implementation is free to ignore this value if it only has a single + blur algorithm. \internal */ -void QPixmapBlurFilter::setBlurHint(Qt::RenderHint hint) +void QPixmapBlurFilter::setBlurHint(QGraphicsBlurEffect::BlurHint hint) { Q_D(QPixmapBlurFilter); d->hint = hint; @@ -572,7 +578,7 @@ void QPixmapBlurFilter::setBlurHint(Qt::RenderHint hint) \internal */ -Qt::RenderHint QPixmapBlurFilter::blurHint() const +QGraphicsBlurEffect::BlurHint QPixmapBlurFilter::blurHint() const { Q_D(const QPixmapBlurFilter); return d->hint; diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h index fc70795..6a96676 100644 --- a/src/gui/image/qpixmapfilter_p.h +++ b/src/gui/image/qpixmapfilter_p.h @@ -55,6 +55,7 @@ #include <QtCore/qnamespace.h> #include <QtGui/qpixmap.h> +#include <QtGui/qgraphicseffect.h> QT_BEGIN_HEADER @@ -130,10 +131,10 @@ public: ~QPixmapBlurFilter(); void setRadius(qreal radius); - void setBlurHint(Qt::RenderHint hint); + void setBlurHint(QGraphicsBlurEffect::BlurHint hint); qreal radius() const; - Qt::RenderHint blurHint() const; + QGraphicsBlurEffect::BlurHint blurHint() const; QRectF boundingRectFor(const QRectF &rect) const; void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const; diff --git a/src/gui/itemviews/qdirmodel.cpp b/src/gui/itemviews/qdirmodel.cpp index 2973741..942cfd7 100644 --- a/src/gui/itemviews/qdirmodel.cpp +++ b/src/gui/itemviews/qdirmodel.cpp @@ -1351,7 +1351,7 @@ QString QDirModelPrivate::size(const QModelIndex &index) const return QFileSystemModel::tr("%1 MB").arg(QLocale().toString(qreal(bytes) / mb, 'f', 1)); if (bytes >= kb) return QFileSystemModel::tr("%1 KB").arg(QLocale().toString(bytes / kb)); - return QFileSystemModel::tr("%1 bytes").arg(QLocale().toString(bytes)); + return QFileSystemModel::tr("%1 byte(s)").arg(QLocale().toString(bytes)); } QString QDirModelPrivate::type(const QModelIndex &index) const diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp index e3d17ad..6316797 100644 --- a/src/gui/itemviews/qfileiconprovider.cpp +++ b/src/gui/itemviews/qfileiconprovider.cpp @@ -47,24 +47,24 @@ #include <qdir.h> #include <qpixmapcache.h> #if defined(Q_WS_WIN) -#define _WIN32_IE 0x0500 -#include <qt_windows.h> -#include <commctrl.h> -#include <objbase.h> +# define _WIN32_IE 0x0500 +# include <qt_windows.h> +# include <commctrl.h> +# include <objbase.h> #elif defined(Q_WS_MAC) -#include <private/qt_cocoa_helpers_mac_p.h> -#endif - -#if defined(Q_WS_X11) && !defined(Q_NO_STYLE_GTK) -#include <private/qt_x11_p.h> -#include <private/gtksymbols_p.h> +# include <private/qt_cocoa_helpers_mac_p.h> #endif #include <private/qfunctions_p.h> #include <private/qguiplatformplugin_p.h> +#if defined(Q_WS_X11) && !defined(Q_NO_STYLE_GTK) +# include <private/qgtkstyle_p.h> +# include <private/qt_x11_p.h> +#endif + #ifndef SHGFI_ADDOVERLAYS -#define SHGFI_ADDOVERLAYS 0x000000020 +# define SHGFI_ADDOVERLAYS 0x000000020 #endif QT_BEGIN_NAMESPACE @@ -392,7 +392,7 @@ QIcon QFileIconProvider::icon(const QFileInfo &info) const #if defined(Q_WS_X11) && !defined(QT_NO_STYLE_GTK) if (X11->desktopEnvironment == DE_GNOME) { - QIcon gtkIcon = QGtk::getFilesystemIcon(info); + QIcon gtkIcon = QGtkStylePrivate::getFilesystemIcon(info); if (!gtkIcon.isNull()) return gtkIcon; } diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 1ec51da..1694434 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2078,7 +2078,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) } QWidget *prev = focus_widget; focus_widget = focus; - +#ifndef QT_NO_IM if (prev && ((reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason && prev->testAttribute(Qt::WA_InputMethodEnabled)) // Do reset the input context, in case the new focus widget won't accept keyboard input @@ -2091,6 +2091,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) qic->setFocusWidget(0); } } +#endif //QT_NO_IM if(focus_widget) focus_widget->d_func()->setFocus_sys(); @@ -2122,12 +2123,14 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) QApplication::sendEvent(that->style(), &out); } if(focus && QApplicationPrivate::focus_widget == focus) { +#ifndef QT_NO_IM if (focus->testAttribute(Qt::WA_InputMethodEnabled)) { QInputContext *qic = focus->inputContext(); if (qic && focus->testAttribute(Qt::WA_WState_Created) && focus->isEnabled()) qic->setFocusWidget(focus); } +#endif //QT_NO_IM QFocusEvent in(QEvent::FocusIn, reason); QPointer<QWidget> that = focus; QApplication::sendEvent(focus, &in); diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index b0ab760..b71ae73 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -79,7 +79,7 @@ #include <private/qcolor_p.h> #include <private/qcursor_p.h> #include <private/qiconloader_p.h> -#include <private/gtksymbols_p.h> +#include <qgtkstyle.h> #include "qstyle.h" #include "qmetaobject.h" #include "qtimer.h" @@ -2299,7 +2299,7 @@ void qt_init(QApplicationPrivate *priv, int, #if !defined(QT_NO_STYLE_GTK) if (X11->desktopEnvironment == DE_GNOME) { - static bool menusHaveIcons = QGtk::getGConfBool(QLatin1String("/desktop/gnome/interface/menus_have_icons"), true); + static bool menusHaveIcons = QGtkStyle::getGConfBool(QLatin1String("/desktop/gnome/interface/menus_have_icons"), true); QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !menusHaveIcons); } #endif diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index 5ed4dc9..e43f8b5 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -296,12 +296,16 @@ QString QClipboard::text(QString &subtype, Mode mode) const const QByteArray rawData = data->data(QLatin1String("text/") + subtype); +#ifndef QT_NO_TEXTCODEC QTextCodec* codec = QTextCodec::codecForMib(106); // utf-8 is default if (subtype == QLatin1String("html")) codec = QTextCodec::codecForHtml(rawData, codec); else codec = QTextCodec::codecForUtfText(rawData, codec); return codec->toUnicode(rawData); +#else //QT_NO_TEXTCODEC + return rawData; +#endif //QT_NO_TEXTCODEC } /*! diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index ab43e79..55a329c 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4400,7 +4400,7 @@ bool QGestureEvent::isAccepted(Qt::GestureType gestureType) const /*! \internal - Sets the widget for this event. + Sets the widget for this event to the \a widget specified. */ void QGestureEvent::setWidget(QWidget *widget) { @@ -4415,6 +4415,7 @@ QWidget *QGestureEvent::widget() const return d_func()->widget; } +#ifndef QT_NO_GRAPHICSVIEW /*! Returns the scene-local coordinates if the \a gesturePoint is inside a graphics view. @@ -4431,6 +4432,7 @@ QPointF QGestureEvent::mapToScene(const QPointF &gesturePoint) const } return QPointF(); } +#endif //QT_NO_GRAPHICSVIEW /*! \internal diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index fb245c0..141ccad 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -859,7 +859,9 @@ public: void setWidget(QWidget *widget); QWidget *widget() const; +#ifndef QT_NO_GRAPHICSVIEW QPointF mapToScene(const QPointF &gesturePoint) const; +#endif private: QGestureEventPrivate *d_func(); diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index f1abc89..0a88a24 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -467,6 +467,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) return filterEventThroughContexts(contexts, event); } +#ifndef QT_NO_GRAPHICSVIEW bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) { QSet<Qt::GestureType> types; @@ -498,6 +499,7 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) } return filterEventThroughContexts(contexts, event); } +#endif bool QGestureManager::filterEvent(QGesture *state, QEvent *event) { diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h index 4958cdb..1e0734b 100644 --- a/src/gui/kernel/qgesturemanager_p.h +++ b/src/gui/kernel/qgesturemanager_p.h @@ -74,7 +74,9 @@ public: bool filterEvent(QWidget *receiver, QEvent *event); bool filterEvent(QGesture *receiver, QEvent *event); +#ifndef QT_NO_GRAPHICSVIEW bool filterEvent(QGraphicsObject *receiver, QEvent *event); +#endif //QT_NO_GRAPHICSVIEW // declared in qapplication.cpp static QGestureManager* instance(); diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp index b01d40f..e6efec1 100644 --- a/src/gui/kernel/qguiplatformplugin.cpp +++ b/src/gui/kernel/qguiplatformplugin.cpp @@ -59,9 +59,9 @@ extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp #if defined(Q_WS_X11) -#include "qkde_p.h" -#include "qt_x11_p.h" -#include <private/gtksymbols_p.h> +#include <private/qkde_p.h> +#include <private/qgtkstyle_p.h> +#include <private/qt_x11_p.h> #endif @@ -206,7 +206,7 @@ QString QGuiPlatformPlugin::systemIconThemeName() if (X11->desktopEnvironment == DE_GNOME) { result = QString::fromLatin1("gnome"); #ifndef QT_NO_STYLE_GTK - result = QGtk::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"), result); + result = QGtkStylePrivate::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"), result); #endif } else if (X11->desktopEnvironment == DE_KDE) { result = X11->desktopVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg"); diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index a5a2201..21795b4 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -48,6 +48,7 @@ #include "private/qsoftkeymanager_p.h" #include "private/qobject_p.h" +#ifndef QT_NO_SOFTKEYMANAGER QT_BEGIN_NAMESPACE #ifdef Q_WS_S60 @@ -285,4 +286,4 @@ void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &) #endif QT_END_NAMESPACE - +#endif //QT_NO_SOFTKEYMANAGER diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/gui/kernel/qsoftkeymanager_p.h index 81218cf..796e080 100644 --- a/src/gui/kernel/qsoftkeymanager_p.h +++ b/src/gui/kernel/qsoftkeymanager_p.h @@ -58,6 +58,7 @@ QT_BEGIN_HEADER +#ifndef QT_NO_SOFTKEYMANAGER QT_BEGIN_NAMESPACE class QSoftKeyManagerPrivate; @@ -101,6 +102,7 @@ private Q_SLOTS: }; QT_END_NAMESPACE +#endif //QT_NO_SOFTKEYMANAGER QT_END_HEADER diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 4061c3d..9165515 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1549,7 +1549,9 @@ void QWidgetPrivate::createExtra() extra = new QWExtra; extra->glContext = 0; extra->topextra = 0; +#ifndef QT_NO_GRAPHICSVIEW extra->proxyWidget = 0; +#endif #ifndef QT_NO_CURSOR extra->curs = 0; #endif @@ -1699,12 +1701,13 @@ void QWidgetPrivate::propagatePaletteChange() { Q_Q(QWidget); // Propagate a new inherited mask to all children. - if (!q->parentWidget() && extra && extra->proxyWidget) { #ifndef QT_NO_GRAPHICSVIEW + if (!q->parentWidget() && extra && extra->proxyWidget) { QGraphicsProxyWidget *p = extra->proxyWidget; inheritedPaletteResolveMask = p->d_func()->inheritedPaletteResolveMask | p->palette().resolve(); + } else #endif //QT_NO_GRAPHICSVIEW - } else if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) { + if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) { inheritedPaletteResolveMask = 0; } int mask = data.pal.resolve() | inheritedPaletteResolveMask; @@ -3068,6 +3071,7 @@ void QWidgetPrivate::setEnabled_helper(bool enable) #if defined(Q_WS_MAC) setEnabled_helper_sys(enable); #endif +#ifndef QT_NO_IM if (q->testAttribute(Qt::WA_InputMethodEnabled) && q->hasFocus()) { QInputContext *qic = inputContext(); if (enable) { @@ -3077,6 +3081,7 @@ void QWidgetPrivate::setEnabled_helper(bool enable) qic->setFocusWidget(0); } } +#endif //QT_NO_IM QEvent e(QEvent::EnabledChange); QApplication::sendEvent(q, &e); #ifdef QT3_SUPPORT @@ -4375,7 +4380,11 @@ QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const Q_Q(const QWidget); QPalette naturalPalette = QApplication::palette(q); if (!q->testAttribute(Qt::WA_StyleSheet) - && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation) || (extra && extra->proxyWidget))) { + && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation) +#ifndef QT_NO_GRAPHICSVIEW + || (extra && extra->proxyWidget) +#endif //QT_NO_GRAPHICSVIEW + )) { if (QWidget *p = q->parentWidget()) { if (!p->testAttribute(Qt::WA_StyleSheet)) { if (!naturalPalette.isCopyOf(QApplication::palette())) { @@ -4386,13 +4395,14 @@ QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const naturalPalette = p->palette(); } } - } else if (extra && extra->proxyWidget) { + } #ifndef QT_NO_GRAPHICSVIEW + else if (extra && extra->proxyWidget) { QPalette inheritedPalette = extra->proxyWidget->palette(); inheritedPalette.resolve(inheritedMask); naturalPalette = inheritedPalette.resolve(naturalPalette); -#endif //QT_NO_GRAPHICSVIEW } +#endif //QT_NO_GRAPHICSVIEW } naturalPalette.resolve(0); return naturalPalette; @@ -4510,7 +4520,11 @@ QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const Q_Q(const QWidget); QFont naturalFont = QApplication::font(q); if (!q->testAttribute(Qt::WA_StyleSheet) - && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation) || (extra && extra->proxyWidget))) { + && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation) +#ifndef QT_NO_GRAPHICSVIEW + || (extra && extra->proxyWidget) +#endif //QT_NO_GRAPHICSVIEW + )) { if (QWidget *p = q->parentWidget()) { if (!p->testAttribute(Qt::WA_StyleSheet)) { if (!naturalFont.isCopyOf(QApplication::font())) { @@ -4521,13 +4535,14 @@ QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const naturalFont = p->font(); } } - } else if (extra && extra->proxyWidget) { + } #ifndef QT_NO_GRAPHICSVIEW + else if (extra && extra->proxyWidget) { QFont inheritedFont = extra->proxyWidget->font(); inheritedFont.resolve(inheritedMask); naturalFont = inheritedFont.resolve(naturalFont); -#endif //QT_NO_GRAPHICSVIEW } +#endif //QT_NO_GRAPHICSVIEW } naturalFont.resolve(0); return naturalFont; @@ -4574,12 +4589,13 @@ void QWidgetPrivate::updateFont(const QFont &font) data.fnt.x11SetScreen(xinfo.screen()); #endif // Combine new mask with natural mask and propagate to children. - if (!q->parentWidget() && extra && extra->proxyWidget) { #ifndef QT_NO_GRAPHICSVIEW + if (!q->parentWidget() && extra && extra->proxyWidget) { QGraphicsProxyWidget *p = extra->proxyWidget; inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve(); + } else #endif //QT_NO_GRAPHICSVIEW - } else if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) { + if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) { inheritedFontResolveMask = 0; } uint newMask = data.fnt.resolve() | inheritedFontResolveMask; @@ -5390,7 +5406,11 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis , sharedPainter, backingStore); } - if (w->updatesEnabled() && (!w->d_func()->extra || !w->d_func()->extra->proxyWidget)) { + if (w->updatesEnabled() +#ifndef QT_NO_GRAPHICSVIEW + && (!w->d_func()->extra || !w->d_func()->extra->proxyWidget) +#endif //QT_NO_GRAPHICSVIEW + ) { QRegion wRegion(rgn); wRegion &= wd->effectiveRectFor(w->data->crect); wRegion.translate(-widgetPos); @@ -8960,11 +8980,16 @@ QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const Qt::InputMethodHints QWidget::inputMethodHints() const { Q_D(const QWidget); +#ifndef QT_NO_IM return d->imHints; +#else //QT_NO_IM + return 0; +#endif //QT_NO_IM } void QWidget::setInputMethodHints(Qt::InputMethodHints hints) { +#ifndef QT_NO_IM Q_D(QWidget); d->imHints = hints; // Optimisation to update input context only it has already been created. @@ -8973,6 +8998,7 @@ void QWidget::setInputMethodHints(Qt::InputMethodHints hints) if (ic) ic->update(); } +#endif //QT_NO_IM } @@ -10304,6 +10330,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) QApplication::sendEvent(this, &e); break; } case Qt::WA_NativeWindow: { +#ifndef QT_NO_IM QInputContext *ic = 0; if (on && !internalWinId() && testAttribute(Qt::WA_InputMethodEnabled) && hasFocus()) { ic = d->inputContext(); @@ -10316,6 +10343,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) d->createWinId(); if (ic && isEnabled()) ic->setFocusWidget(this); +#endif //QT_NO_IM break; } case Qt::WA_PaintOnScreen: @@ -10345,6 +10373,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) #endif break; case Qt::WA_InputMethodEnabled: { +#ifndef QT_NO_IM QInputContext *ic = d->ic; if (!ic && (!on || hasFocus())) ic = d->inputContext(); @@ -10356,6 +10385,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) ic->setFocusWidget(0); } } +#endif //QT_NO_IM break; } case Qt::WA_WindowPropagation: diff --git a/src/gui/kernel/qwidget_qws.cpp b/src/gui/kernel/qwidget_qws.cpp index 0f46016..e299c6e 100644 --- a/src/gui/kernel/qwidget_qws.cpp +++ b/src/gui/kernel/qwidget_qws.cpp @@ -280,7 +280,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) QApplicationPrivate::leaveModal(this); else if ((windowType() == Qt::Popup)) qApp->d_func()->closePopup(this); - +#ifndef QT_NO_IM if (d->ic) { delete d->ic; d->ic =0; @@ -291,6 +291,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (qic) qic->widgetDestroyed(this); } +#endif //QT_NO_IM if ((windowType() == Qt::Desktop)) { } else { diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp index d211229..aa98536 100644 --- a/src/gui/math3d/qgenericmatrix.cpp +++ b/src/gui/math3d/qgenericmatrix.cpp @@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE The contents of the array \a values is assumed to be in row-major order. - \sa toValueArray() + \sa copyDataTo() */ /*! @@ -102,11 +102,11 @@ QT_BEGIN_NAMESPACE Returns true if this matrix is the identity; false otherwise. - \sa setIdentity() + \sa setToIdentity() */ /*! - \fn void QGenericMatrix::setIdentity() + \fn void QGenericMatrix::setToIdentity() Sets this matrix to the identity. @@ -213,9 +213,9 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QGenericMatrix::toValueArray(T *values) + \fn void QGenericMatrix::copyDataTo(T *values) const - Retrieves the N * M items in this matrix and writes them to \a values + Retrieves the N * M items in this matrix and copies them to \a values in row-major order. */ @@ -243,4 +243,100 @@ QT_BEGIN_NAMESPACE \sa data() */ +#ifndef QT_NO_DATASTREAM + +/*! + \fn QDataStream &operator<<(QDataStream &stream, const QGenericMatrix<N, M, T> &matrix) + \relates QGenericMatrix + + Writes the given \a matrix to the given \a stream and returns a + reference to the stream. + + \sa {Format of the QDataStream Operators} +*/ + +/*! + \fn QDataStream &operator>>(QDataStream &stream, QGenericMatrix<N, M, T> &matrix) + \relates QGenericMatrix + + Reads a NxM matrix from the given \a stream into the given \a matrix + and returns a reference to the stream. + + \sa {Format of the QDataStream Operators} +*/ + +#endif + +/*! + \typedef QMatrix2x2 + \relates QGenericMatrix + + The QMatrix2x2 type defines a convenient instantiation of the + QGenericMatrix template for 2 columns, 2 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix2x3 + \relates QGenericMatrix + + The QMatrix2x3 type defines a convenient instantiation of the + QGenericMatrix template for 2 columns, 3 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix2x4 + \relates QGenericMatrix + + The QMatrix2x4 type defines a convenient instantiation of the + QGenericMatrix template for 2 columns, 4 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix3x2 + \relates QGenericMatrix + + The QMatrix3x2 type defines a convenient instantiation of the + QGenericMatrix template for 3 columns, 2 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix3x3 + \relates QGenericMatrix + + The QMatrix3x3 type defines a convenient instantiation of the + QGenericMatrix template for 3 columns, 3 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix3x4 + \relates QGenericMatrix + + The QMatrix3x4 type defines a convenient instantiation of the + QGenericMatrix template for 3 columns, 4 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix4x2 + \relates QGenericMatrix + + The QMatrix4x2 type defines a convenient instantiation of the + QGenericMatrix template for 4 columns, 2 rows, and qreal as + the element type. +*/ + +/*! + \typedef QMatrix4x3 + \relates QGenericMatrix + + The QMatrix4x3 type defines a convenient instantiation of the + QGenericMatrix template for 4 columns, 3 rows, and qreal as + the element type. +*/ + QT_END_NAMESPACE diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h index f178d02..3871754 100644 --- a/src/gui/math3d/qgenericmatrix.h +++ b/src/gui/math3d/qgenericmatrix.h @@ -44,6 +44,7 @@ #include <QtCore/qmetatype.h> #include <QtCore/qdebug.h> +#include <QtCore/qdatastream.h> QT_BEGIN_HEADER @@ -63,7 +64,7 @@ public: T& operator()(int row, int column); bool isIdentity() const; - void setIdentity(); + void setToIdentity(); void fill(T value); @@ -76,7 +77,7 @@ public: bool operator==(const QGenericMatrix<N, M, T>& other) const; bool operator!=(const QGenericMatrix<N, M, T>& other) const; - void toValueArray(T *values); + void copyDataTo(T *values) const; T *data() { return m[0]; } const T *data() const { return m[0]; } @@ -113,7 +114,7 @@ private: template <int N, int M, typename T> Q_INLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix() { - setIdentity(); + setToIdentity(); } template <int N, int M, typename T> @@ -164,7 +165,7 @@ Q_OUTOFLINE_TEMPLATE bool QGenericMatrix<N, M, T>::isIdentity() const } template <int N, int M, typename T> -Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T>::setIdentity() +Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T>::setToIdentity() { for (int col = 0; col < N; ++col) { for (int row = 0; row < M; ++row) { @@ -316,7 +317,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator/(const QGenericMatrix<N, M } template <int N, int M, typename T> -Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T>::toValueArray(T *values) +Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T>::copyDataTo(T *values) const { for (int col = 0; col < N; ++col) for (int row = 0; row < M; ++row) @@ -352,6 +353,32 @@ QDebug operator<<(QDebug dbg, const QGenericMatrix<N, M, T> &m) #endif +#ifndef QT_NO_DATASTREAM + +template <int N, int M, typename T> +QDataStream &operator<<(QDataStream &stream, const QGenericMatrix<N, M, T> &matrix) +{ + for (int row = 0; row < M; ++row) + for (int col = 0; col < N; ++col) + stream << double(matrix(row, col)); + return stream; +} + +template <int N, int M, typename T> +QDataStream &operator>>(QDataStream &stream, QGenericMatrix<N, M, T> &matrix) +{ + double x; + for (int row = 0; row < M; ++row) { + for (int col = 0; col < N; ++col) { + stream >> x; + matrix(row, col) = T(x); + } + } + return stream; +} + +#endif + QT_END_NAMESPACE Q_DECLARE_METATYPE(QMatrix2x2) diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index 5d624d8..2c3d616 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -73,10 +73,10 @@ static const qreal inv_dist_to_plane = 1. / 1024.; If the matrix has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to - inferSpecialType() if they wish QMatrix4x4 to optimize further + optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc. - \sa toValueArray(), inferSpecialType() + \sa copyDataTo(), optimize() */ QMatrix4x4::QMatrix4x4(const qreal *values) { @@ -96,10 +96,10 @@ QMatrix4x4::QMatrix4x4(const qreal *values) If the matrix has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to - inferSpecialType() if they wish QMatrix4x4 to optimize further + optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc. - \sa inferSpecialType() + \sa optimize() */ #if !defined(QT_NO_MEMBER_TEMPLATES) || defined(Q_QDOC) @@ -176,10 +176,10 @@ QMatrix4x4::QMatrix4x4(const qreal *values, int cols, int rows) If \a matrix has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to - inferSpecialType() if they wish QMatrix4x4 to optimize further + optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc. - \sa toAffine(), inferSpecialType() + \sa toAffine(), optimize() */ QMatrix4x4::QMatrix4x4(const QMatrix& matrix) { @@ -208,10 +208,10 @@ QMatrix4x4::QMatrix4x4(const QMatrix& matrix) If \a transform has a special type (identity, translate, scale, etc), the programmer should follow this constructor with a call to - inferSpecialType() if they wish QMatrix4x4 to optimize further + optimize() if they wish QMatrix4x4 to optimize further calls to translate(), scale(), etc. - \sa toTransform(), inferSpecialType() + \sa toTransform(), optimize() */ QMatrix4x4::QMatrix4x4(const QTransform& transform) { @@ -249,7 +249,7 @@ QMatrix4x4::QMatrix4x4(const QTransform& transform) Returns a reference to the element at position (\a row, \a column) in this matrix so that the element can be assigned to. - \sa inferSpecialType(), setColumn(), setRow() + \sa optimize(), setColumn(), setRow() */ /*! @@ -289,11 +289,11 @@ QMatrix4x4::QMatrix4x4(const QTransform& transform) Returns true if this matrix is the identity; false otherwise. - \sa setIdentity() + \sa setToIdentity() */ /*! - \fn void QMatrix4x4::setIdentity() + \fn void QMatrix4x4::setToIdentity() Sets this matrix to the identity. @@ -694,11 +694,11 @@ QMatrix4x4 operator/(const QMatrix4x4& matrix, qreal divisor) /*! Multiplies this matrix by another that scales coordinates by - the components of \a vector. Returns this matrix. + the components of \a vector. \sa translate(), rotate() */ -QMatrix4x4& QMatrix4x4::scale(const QVector3D& vector) +void QMatrix4x4::scale(const QVector3D& vector) { qreal vx = vector.x(); qreal vy = vector.y(); @@ -732,7 +732,6 @@ QMatrix4x4& QMatrix4x4::scale(const QVector3D& vector) m[2][3] *= vz; flagBits = General; } - return *this; } #endif @@ -740,11 +739,11 @@ QMatrix4x4& QMatrix4x4::scale(const QVector3D& vector) \overload Multiplies this matrix by another that scales coordinates by the - components \a x, and \a y. Returns this matrix. + components \a x, and \a y. \sa translate(), rotate() */ -QMatrix4x4& QMatrix4x4::scale(qreal x, qreal y) +void QMatrix4x4::scale(qreal x, qreal y) { if (flagBits == Identity) { m[0][0] = x; @@ -768,18 +767,17 @@ QMatrix4x4& QMatrix4x4::scale(qreal x, qreal y) m[1][3] *= y; flagBits = General; } - return *this; } /*! \overload Multiplies this matrix by another that scales coordinates by the - components \a x, \a y, and \a z. Returns this matrix. + components \a x, \a y, and \a z. \sa translate(), rotate() */ -QMatrix4x4& QMatrix4x4::scale(qreal x, qreal y, qreal z) +void QMatrix4x4::scale(qreal x, qreal y, qreal z) { if (flagBits == Identity) { m[0][0] = x; @@ -810,18 +808,17 @@ QMatrix4x4& QMatrix4x4::scale(qreal x, qreal y, qreal z) m[2][3] *= z; flagBits = General; } - return *this; } /*! \overload Multiplies this matrix by another that scales coordinates by the - given \a factor. Returns this matrix. + given \a factor. \sa translate(), rotate() */ -QMatrix4x4& QMatrix4x4::scale(qreal factor) +void QMatrix4x4::scale(qreal factor) { if (flagBits == Identity) { m[0][0] = factor; @@ -852,17 +849,16 @@ QMatrix4x4& QMatrix4x4::scale(qreal factor) m[2][3] *= factor; flagBits = General; } - return *this; } #ifndef QT_NO_VECTOR3D /*! Multiplies this matrix by another that translates coordinates by - the components of \a vector. Returns this matrix. + the components of \a vector. \sa scale(), rotate() */ -QMatrix4x4& QMatrix4x4::translate(const QVector3D& vector) +void QMatrix4x4::translate(const QVector3D& vector) { qreal vx = vector.x(); qreal vy = vector.y(); @@ -895,7 +891,6 @@ QMatrix4x4& QMatrix4x4::translate(const QVector3D& vector) else if (flagBits != (Rotation | Translation)) flagBits = General; } - return *this; } #endif @@ -904,11 +899,11 @@ QMatrix4x4& QMatrix4x4::translate(const QVector3D& vector) \overload Multiplies this matrix by another that translates coordinates - by the components \a x, and \a y. Returns this matrix. + by the components \a x, and \a y. \sa scale(), rotate() */ -QMatrix4x4& QMatrix4x4::translate(qreal x, qreal y) +void QMatrix4x4::translate(qreal x, qreal y) { if (flagBits == Identity) { m[3][0] = x; @@ -935,18 +930,17 @@ QMatrix4x4& QMatrix4x4::translate(qreal x, qreal y) else if (flagBits != (Rotation | Translation)) flagBits = General; } - return *this; } /*! \overload Multiplies this matrix by another that translates coordinates - by the components \a x, \a y, and \a z. Returns this matrix. + by the components \a x, \a y, and \a z. \sa scale(), rotate() */ -QMatrix4x4& QMatrix4x4::translate(qreal x, qreal y, qreal z) +void QMatrix4x4::translate(qreal x, qreal y, qreal z) { if (flagBits == Identity) { m[3][0] = x; @@ -976,20 +970,19 @@ QMatrix4x4& QMatrix4x4::translate(qreal x, qreal y, qreal z) else if (flagBits != (Rotation | Translation)) flagBits = General; } - return *this; } #ifndef QT_NO_VECTOR3D /*! Multiples this matrix by another that rotates coordinates through - \a angle degrees about \a vector. Returns this matrix. + \a angle degrees about \a vector. \sa scale(), translate() */ -QMatrix4x4& QMatrix4x4::rotate(qreal angle, const QVector3D& vector) +void QMatrix4x4::rotate(qreal angle, const QVector3D& vector) { - return rotate(angle, vector.x(), vector.y(), vector.z()); + rotate(angle, vector.x(), vector.y(), vector.z()); } #endif @@ -998,14 +991,14 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, const QVector3D& vector) \overload Multiplies this matrix by another that rotates coordinates through - \a angle degrees about the vector (\a x, \a y, \a z). Returns this matrix. + \a angle degrees about the vector (\a x, \a y, \a z). \sa scale(), translate() */ -QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) +void QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) { if (angle == 0.0f) - return *this; + return; QMatrix4x4 m(1); // The "1" says to not load the identity. qreal c, s, ic; if (angle == 90.0f || angle == -270.0f) { @@ -1027,7 +1020,7 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) if (y == 0.0f) { if (z != 0.0f) { // Rotate around the Z axis. - m.setIdentity(); + m.setToIdentity(); m.m[0][0] = c; m.m[1][1] = c; if (z < 0.0f) { @@ -1042,7 +1035,7 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) } } else if (z == 0.0f) { // Rotate around the Y axis. - m.setIdentity(); + m.setToIdentity(); m.m[0][0] = c; m.m[2][2] = c; if (y < 0.0f) { @@ -1057,7 +1050,7 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) } } else if (y == 0.0f && z == 0.0f) { // Rotate around the X axis. - m.setIdentity(); + m.setToIdentity(); m.m[1][1] = c; m.m[2][2] = c; if (x < 0.0f) { @@ -1102,18 +1095,17 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) flagBits = flags | Rotation; else flagBits = Rotation; - return *this; } /*! \internal */ -QMatrix4x4& QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) +void QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) { // Used by QGraphicsRotation::applyTo() to perform a rotation // and projection back to 2D in a single step. if (angle == 0.0f) - return *this; + return; QMatrix4x4 m(1); // The "1" says to not load the identity. qreal c, s, ic; if (angle == 90.0f || angle == -270.0f) { @@ -1135,7 +1127,7 @@ QMatrix4x4& QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) if (y == 0.0f) { if (z != 0.0f) { // Rotate around the Z axis. - m.setIdentity(); + m.setToIdentity(); m.m[0][0] = c; m.m[1][1] = c; if (z < 0.0f) { @@ -1150,7 +1142,7 @@ QMatrix4x4& QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) } } else if (z == 0.0f) { // Rotate around the Y axis. - m.setIdentity(); + m.setToIdentity(); m.m[0][0] = c; m.m[2][2] = 1.0f; if (y < 0.0f) { @@ -1163,7 +1155,7 @@ QMatrix4x4& QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) } } else if (y == 0.0f && z == 0.0f) { // Rotate around the X axis. - m.setIdentity(); + m.setToIdentity(); m.m[1][1] = c; m.m[2][2] = 1.0f; if (x < 0.0f) { @@ -1206,7 +1198,6 @@ QMatrix4x4& QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) flagBits = flags | Rotation; else flagBits = Rotation; - return *this; } #ifndef QT_NO_QUATERNION @@ -1214,11 +1205,11 @@ QMatrix4x4& QMatrix4x4::projectedRotate(qreal angle, qreal x, qreal y, qreal z) /*! Multiples this matrix by another that rotates coordinates according to a specified \a quaternion. The \a quaternion is assumed to have - been normalized. Returns this matrix. + been normalized. \sa scale(), translate(), QQuaternion */ -QMatrix4x4& QMatrix4x4::rotate(const QQuaternion& quaternion) +void QMatrix4x4::rotate(const QQuaternion& quaternion) { // Algorithm from: // http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 @@ -1254,7 +1245,6 @@ QMatrix4x4& QMatrix4x4::rotate(const QQuaternion& quaternion) flagBits = flags | Rotation; else flagBits = Rotation; - return *this; } #endif @@ -1265,17 +1255,16 @@ QMatrix4x4& QMatrix4x4::rotate(const QQuaternion& quaternion) Multiplies this matrix by another that applies an orthographic projection for a window with boundaries specified by \a rect. The near and far clipping planes will be -1 and 1 respectively. - Returns this matrix. \sa frustum(), perspective() */ -QMatrix4x4& QMatrix4x4::ortho(const QRect& rect) +void QMatrix4x4::ortho(const QRect& rect) { // Note: rect.right() and rect.bottom() subtract 1 in QRect, // which gives the location of a pixel within the rectangle, // instead of the extent of the rectangle. We want the extent. // QRectF expresses the extent properly. - return ortho(rect.x(), rect.x() + rect.width(), rect.y() + rect.height(), rect.y(), -1.0f, 1.0f); + ortho(rect.x(), rect.x() + rect.width(), rect.y() + rect.height(), rect.y(), -1.0f, 1.0f); } /*! @@ -1284,28 +1273,27 @@ QMatrix4x4& QMatrix4x4::ortho(const QRect& rect) Multiplies this matrix by another that applies an orthographic projection for a window with boundaries specified by \a rect. The near and far clipping planes will be -1 and 1 respectively. - Returns this matrix. \sa frustum(), perspective() */ -QMatrix4x4& QMatrix4x4::ortho(const QRectF& rect) +void QMatrix4x4::ortho(const QRectF& rect) { - return ortho(rect.left(), rect.right(), rect.bottom(), rect.top(), -1.0f, 1.0f); + ortho(rect.left(), rect.right(), rect.bottom(), rect.top(), -1.0f, 1.0f); } /*! Multiplies this matrix by another that applies an orthographic projection for a window with lower-left corner (\a left, \a bottom), upper-right corner (\a right, \a top), and the specified \a nearPlane - and \a farPlane clipping planes. Returns this matrix. + and \a farPlane clipping planes. \sa frustum(), perspective() */ -QMatrix4x4& QMatrix4x4::ortho(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane) +void QMatrix4x4::ortho(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane) { // Bail out if the projection volume is zero-sized. if (left == right || bottom == top || nearPlane == farPlane) - return *this; + return; // Construct the projection. qreal width = right - left; @@ -1324,7 +1312,7 @@ QMatrix4x4& QMatrix4x4::ortho(qreal left, qreal right, qreal bottom, qreal top, (2.0f / width, 2.0f / invheight, -1.0f)); - return *this; + return; } #endif QMatrix4x4 m(1); @@ -1347,22 +1335,22 @@ QMatrix4x4& QMatrix4x4::ortho(qreal left, qreal right, qreal bottom, qreal top, // Apply the projection. *this *= m; - return *this; + return; } /*! Multiplies this matrix by another that applies a perspective frustum projection for a window with lower-left corner (\a left, \a bottom), upper-right corner (\a right, \a top), and the specified \a nearPlane - and \a farPlane clipping planes. Returns this matrix. + and \a farPlane clipping planes. \sa ortho(), perspective() */ -QMatrix4x4& QMatrix4x4::frustum(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane) +void QMatrix4x4::frustum(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane) { // Bail out if the projection volume is zero-sized. if (left == right || bottom == top || nearPlane == farPlane) - return *this; + return; // Construct the projection. QMatrix4x4 m(1); @@ -1388,7 +1376,6 @@ QMatrix4x4& QMatrix4x4::frustum(qreal left, qreal right, qreal bottom, qreal top // Apply the projection. *this *= m; - return *this; } /*! @@ -1396,22 +1383,21 @@ QMatrix4x4& QMatrix4x4::frustum(qreal left, qreal right, qreal bottom, qreal top projection. The field of view will be \a angle degrees within a window with a given \a aspect ratio. The projection will have the specified \a nearPlane and \a farPlane clipping planes. - Returns this matrix. \sa ortho(), frustum() */ -QMatrix4x4& QMatrix4x4::perspective(qreal angle, qreal aspect, qreal nearPlane, qreal farPlane) +void QMatrix4x4::perspective(qreal angle, qreal aspect, qreal nearPlane, qreal farPlane) { // Bail out if the projection volume is zero-sized. if (nearPlane == farPlane || aspect == 0.0f) - return *this; + return; // Construct the projection. QMatrix4x4 m(1); qreal radians = (angle / 2.0f) * M_PI / 180.0f; qreal sine = qSin(radians); if (sine == 0.0f) - return *this; + return; qreal cotan = qCos(radians) / sine; qreal clip = farPlane - nearPlane; m.m[0][0] = cotan / aspect; @@ -1433,7 +1419,6 @@ QMatrix4x4& QMatrix4x4::perspective(qreal angle, qreal aspect, qreal nearPlane, // Apply the projection. *this *= m; - return *this; } #ifndef QT_NO_VECTOR3D @@ -1443,9 +1428,8 @@ QMatrix4x4& QMatrix4x4::perspective(qreal angle, qreal aspect, qreal nearPlane, transformation. The \a center value indicates the center of the view that the \a eye is looking at. The \a up value indicates which direction should be considered up with respect to the \a eye. - Returns this matrix. */ -QMatrix4x4& QMatrix4x4::lookAt(const QVector3D& eye, const QVector3D& center, const QVector3D& up) +void QMatrix4x4::lookAt(const QVector3D& eye, const QVector3D& center, const QVector3D& up) { QVector3D forward = (center - eye).normalized(); QVector3D side = QVector3D::crossProduct(forward, up).normalized(); @@ -1471,7 +1455,7 @@ QMatrix4x4& QMatrix4x4::lookAt(const QVector3D& eye, const QVector3D& center, co m.m[3][3] = 1.0f; *this *= m; - return translate(-eye); + translate(-eye); } #endif @@ -1480,11 +1464,11 @@ QMatrix4x4& QMatrix4x4::lookAt(const QVector3D& eye, const QVector3D& center, co Flips between right-handed and left-handed coordinate systems by multiplying the y and z co-ordinates by -1. This is normally used to create a left-handed orthographic view without scaling - the viewport as ortho() does. Returns this matrix. + the viewport as ortho() does. \sa ortho() */ -QMatrix4x4& QMatrix4x4::flipCoordinates() +void QMatrix4x4::flipCoordinates() { if (flagBits == Scale || flagBits == (Scale | Translation)) { m[1][1] = -m[1][1]; @@ -1508,14 +1492,13 @@ QMatrix4x4& QMatrix4x4::flipCoordinates() m[2][3] = -m[2][3]; flagBits = General; } - return *this; } /*! - Retrieves the 16 items in this matrix and writes them to \a values + Retrieves the 16 items in this matrix and copies them to \a values in row-major order. */ -void QMatrix4x4::toValueArray(qreal *values) const +void QMatrix4x4::copyDataTo(qreal *values) const { for (int row = 0; row < 4; ++row) for (int col = 0; col < 4; ++col) @@ -1739,7 +1722,7 @@ QRectF QMatrix4x4::mapRect(const QRectF& rect) const Returns a pointer to the raw data of this matrix. - \sa constData(), inferSpecialType() + \sa constData(), optimize() */ /*! @@ -1788,94 +1771,8 @@ QMatrix4x4 QMatrix4x4::orthonormalInverse() const return result; } -#ifndef QT_NO_VECTOR3D -/*! - Decomposes the current rotation matrix into an \a axis of rotation plus - an \a angle. The result can be used to construct an equivalent rotation - matrix using glRotate(). It is assumed that the homogenous coordinate - is 1.0. The returned vector is guaranteed to be normalized. - - \code - qreal angle; - QVector3D axis; - - matrix.extractAxisAngle(angle, axis); - glRotate(angle, axis[0], axis[1], axis[2]); - \endcode - - \sa rotate() -*/ -void QMatrix4x4::extractAxisRotation(qreal &angle, QVector3D &axis) const -{ - // Orientation is dependent on the upper 3x3 matrix; subtract the - // homogeneous scaling element from the trace of the 4x4 matrix - qreal tr = m[0][0] + m[1][1] + m[2][2]; - qreal cosa = qreal(0.5f * (tr - 1.0f)); - angle = acos(cosa) * 180.0f / M_PI; - - // Any axis will work if r is zero (means no rotation) - if (qFuzzyIsNull(angle)) { - axis.setX(1.0f); - axis.setY(0.0f); - axis.setZ(0.0f); - return; - } - - if (angle < 180.0f) { - axis.setX(m[1][2] - m[2][1]); - axis.setY(m[2][0] - m[0][2]); - axis.setZ(m[0][1] - m[1][0]); - axis.normalize(); - return; - } - - // rads == PI - qreal tmp; - - // r00 is maximum - if ((m[0][0] >= m[2][2]) && (m[0][0] >= m[1][1])) { - axis.setX(0.5f * qSqrt(m[0][0] - m[1][1] - m[2][2] + 1.0f)); - tmp = 0.5f / axis.x(); - axis.setY(m[1][0] * tmp); - axis.setZ(m[2][0] * tmp); - } - - // r11 is maximum - if ((m[1][1] >= m[2][2]) && (m[1][1] >= m[0][0])) { - axis.setY(0.5f * qSqrt(m[1][1] - m[0][0] - m[2][2] + 1.0f)); - tmp = 0.5f / axis.y(); - axis.setX(tmp * m[1][0]); - axis.setZ(tmp * m[2][1]); - } - - // r22 is maximum - if ((m[2][2] >= m[1][1]) && (m[2][2] >= m[0][0])) { - axis.setZ(0.5f * qSqrt(m[2][2] - m[0][0] - m[1][1] + 1.0f)); - tmp = 0.5f / axis.z(); - axis.setX(m[2][0]*tmp); - axis.setY(m[2][1]*tmp); - } -} - -/*! - If this is an orthonormal transformation matrix (e.g. only rotations and - translations have been applied to the matrix, no scaling, or shearing) - then the world translational component can be obtained by calling this function. - - This is most useful for camera matrices, where the negation of this vector - is effectively the camera world coordinates. -*/ -QVector3D QMatrix4x4::extractTranslation() const -{ - return QVector3D - (m[0][0] * m[3][0] + m[0][1] * m[3][1] + m[0][2] * m[3][2], - m[1][0] * m[3][0] + m[1][1] * m[3][1] + m[1][2] * m[3][2], - m[2][0] * m[3][0] + m[2][1] * m[3][1] + m[2][2] * m[3][2]); -} -#endif - /*! - Infers the special type of this matrix from its current elements. + Optimize the usage of this matrix from its current elements. Some operations such as translate(), scale(), and rotate() can be performed more efficiently if the matrix being modified is already @@ -1888,13 +1785,13 @@ QVector3D QMatrix4x4::extractTranslation() const the special type and will revert to the safest but least efficient operations thereafter. - By calling inferSpecialType() after directly modifying the matrix, + By calling optimize() after directly modifying the matrix, the programmer can force QMatrix4x4 to recover the special type if the elements appear to conform to one of the known optimized types. \sa operator()(), data(), translate() */ -void QMatrix4x4::inferSpecialType() +void QMatrix4x4::optimize() { // If the last element is not 1, then it can never be special. if (m[3][3] != 1.0f) { @@ -2011,7 +1908,7 @@ QDataStream &operator>>(QDataStream &stream, QMatrix4x4 &matrix) matrix(row, col) = qreal(x); } } - matrix.inferSpecialType(); + matrix.optimize(); return stream; } diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index ba74b89..4193bdc 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -63,7 +63,7 @@ class QVariant; class Q_GUI_EXPORT QMatrix4x4 { public: - inline QMatrix4x4() { setIdentity(); } + inline QMatrix4x4() { setToIdentity(); } explicit QMatrix4x4(const qreal *values); inline QMatrix4x4(qreal m11, qreal m12, qreal m13, qreal m14, qreal m21, qreal m22, qreal m23, qreal m24, @@ -87,7 +87,7 @@ public: inline void setRow(int index, const QVector4D& value); inline bool isIdentity() const; - inline void setIdentity(); + inline void setToIdentity(); inline void fill(qreal value); @@ -127,36 +127,31 @@ public: friend inline bool qFuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2); #ifndef QT_NO_VECTOR3D - QMatrix4x4& scale(const QVector3D& vector); - QMatrix4x4& translate(const QVector3D& vector); - QMatrix4x4& rotate(qreal angle, const QVector3D& vector); + void scale(const QVector3D& vector); + void translate(const QVector3D& vector); + void rotate(qreal angle, const QVector3D& vector); #endif - QMatrix4x4& scale(qreal x, qreal y); - QMatrix4x4& scale(qreal x, qreal y, qreal z); - QMatrix4x4& scale(qreal factor); - QMatrix4x4& translate(qreal x, qreal y); - QMatrix4x4& translate(qreal x, qreal y, qreal z); - QMatrix4x4& rotate(qreal angle, qreal x, qreal y, qreal z = 0.0f); + void scale(qreal x, qreal y); + void scale(qreal x, qreal y, qreal z); + void scale(qreal factor); + void translate(qreal x, qreal y); + void translate(qreal x, qreal y, qreal z); + void rotate(qreal angle, qreal x, qreal y, qreal z = 0.0f); #ifndef QT_NO_QUATERNION - QMatrix4x4& rotate(const QQuaternion& quaternion); + void rotate(const QQuaternion& quaternion); #endif + void ortho(const QRect& rect); + void ortho(const QRectF& rect); + void ortho(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane); + void frustum(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane); + void perspective(qreal angle, qreal aspect, qreal nearPlane, qreal farPlane); #ifndef QT_NO_VECTOR3D - void extractAxisRotation(qreal &angle, QVector3D &axis) const; - QVector3D extractTranslation() const; + void lookAt(const QVector3D& eye, const QVector3D& center, const QVector3D& up); #endif + void flipCoordinates(); - QMatrix4x4& ortho(const QRect& rect); - QMatrix4x4& ortho(const QRectF& rect); - QMatrix4x4& ortho(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane); - QMatrix4x4& frustum(qreal left, qreal right, qreal bottom, qreal top, qreal nearPlane, qreal farPlane); - QMatrix4x4& perspective(qreal angle, qreal aspect, qreal nearPlane, qreal farPlane); -#ifndef QT_NO_VECTOR3D - QMatrix4x4& lookAt(const QVector3D& eye, const QVector3D& center, const QVector3D& up); -#endif - QMatrix4x4& flipCoordinates(); - - void toValueArray(qreal *values) const; + void copyDataTo(qreal *values) const; QMatrix toAffine() const; QTransform toTransform() const; @@ -183,7 +178,7 @@ public: inline const qreal *data() const { return m[0]; } inline const qreal *constData() const { return m[0]; } - void inferSpecialType(); + void optimize(); operator QVariant() const; @@ -208,7 +203,7 @@ private: QMatrix4x4 orthonormalInverse() const; - QMatrix4x4& projectedRotate(qreal angle, qreal x, qreal y, qreal z); + void projectedRotate(qreal angle, qreal x, qreal y, qreal z); friend class QGraphicsRotation; }; @@ -330,7 +325,7 @@ inline bool QMatrix4x4::isIdentity() const return (m[3][3] == 1.0f); } -inline void QMatrix4x4::setIdentity() +inline void QMatrix4x4::setToIdentity() { m[0][0] = 1.0f; m[0][1] = 0.0f; diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index d5ec054..626cb3c 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -288,7 +288,7 @@ void QQuaternion::normalize() in 3D space. The following code: \code - QVector3D result = q.rotateVector(vector); + QVector3D result = q.rotatedVector(vector); \endcode is equivalent to the following: @@ -297,7 +297,7 @@ void QQuaternion::normalize() QVector3D result = (q * QQuaternion(0, vector) * q.conjugate()).vector(); \endcode */ -QVector3D QQuaternion::rotateVector(const QVector3D& vector) const +QVector3D QQuaternion::rotatedVector(const QVector3D& vector) const { return (*this * QQuaternion(0, vector) * conjugate()).vector(); } diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h index 7480a5c..5b2454f 100644 --- a/src/gui/math3d/qquaternion.h +++ b/src/gui/math3d/qquaternion.h @@ -95,7 +95,7 @@ public: QQuaternion conjugate() const; - QVector3D rotateVector(const QVector3D& vector) const; + QVector3D rotatedVector(const QVector3D& vector) const; QQuaternion &operator+=(const QQuaternion &quaternion); QQuaternion &operator-=(const QQuaternion &quaternion); diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 00966d6..f36470a 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -879,7 +879,7 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy) const QRect parentRect(rect & clipR); bool accelerateMove = accelEnv && isOpaque -#ifndef QT_NO_GRAPHICSCVIEW +#ifndef QT_NO_GRAPHICSVIEW // No accelerate move for proxy widgets. && !tlw->d_func()->extra->proxyWidget #endif @@ -1177,7 +1177,7 @@ void QWidgetBackingStore::sync() : wd->dirty); toClean += widgetDirty; -#ifndef QT_NO_GRAPHICSCVIEW +#ifndef QT_NO_GRAPHICSVIEW if (tlw->d_func()->extra->proxyWidget) { resetWidget(w); continue; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 53edbb0..41602a1 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7424,6 +7424,14 @@ QT_RECTFILL(qrgb444) QT_RECTFILL(qargb4444) #undef QT_RECTFILL +inline static void qt_rectfill_nonpremul_quint32(QRasterBuffer *rasterBuffer, + int x, int y, int width, int height, + quint32 color) +{ + qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()), + INV_PREMUL(color), x, y, width, height, rasterBuffer->bytesPerLine()); +} + // Map table for destination image format. Contains function pointers // for blends of various types unto the destination @@ -7466,7 +7474,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = qt_bitmapblit_quint32, qt_alphamapblit_quint32, qt_alphargbblit_quint32, - qt_rectfill_quint32 + qt_rectfill_nonpremul_quint32 }, // Format_ARGB32_Premultiplied { diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index cddad7d..09a4563 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2275,8 +2275,9 @@ void QPainter::setBrushOrigin(const QPointF &p) /*! Sets the composition mode to the given \a mode. - \warning You can only set the composition mode for QPainter - objects that operates on a QImage. + \warning Only a QPainter operating on a QImage fully supports all + composition modes. The RasterOp modes are supported for X11 as + described in compositionMode(). \sa compositionMode() */ @@ -5163,7 +5164,7 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm) Q_D(QPainter); - if (!d->engine) + if (!d->engine || pm.isNull()) return; #ifndef QT_NO_DEBUG @@ -7603,7 +7604,7 @@ start_lengthVariant: l.setPosition(QPointF(0., height)); height += l.height(); width = qMax(width, l.naturalTextWidth()); - if (!brect && height >= r.height()) + if (!dontclip && !brect && height >= r.height()) break; } textLayout.endLayout(); diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index c40bcee..8133793 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -3037,11 +3037,11 @@ void QPainterPath::addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadi bool first = d_func()->elements.size() < 2; - arcMoveTo(x, y, rxx2, ryy2, 90); - arcTo(x, y, rxx2, ryy2, 90, 90); - arcTo(x, y+h-ryy2, rxx2, ryy2, 2*90, 90); - arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 3*90, 90); - arcTo(x+w-rxx2, y, rxx2, ryy2, 0, 90); + arcMoveTo(x, y, rxx2, ryy2, 180); + arcTo(x, y, rxx2, ryy2, 180, -90); + arcTo(x+w-rxx2, y, rxx2, ryy2, 90, -90); + arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 0, -90); + arcTo(x, y+h-ryy2, rxx2, ryy2, 270, -90); closeSubpath(); d_func()->require_moveTo = true; @@ -3094,11 +3094,11 @@ void QPainterPath::addRoundRect(const QRectF &r, int xRnd, int yRnd) bool first = d_func()->elements.size() < 2; - arcMoveTo(x, y, rxx2, ryy2, 90); - arcTo(x, y, rxx2, ryy2, 90, 90); - arcTo(x, y+h-ryy2, rxx2, ryy2, 2*90, 90); - arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 3*90, 90); - arcTo(x+w-rxx2, y, rxx2, ryy2, 0, 90); + arcMoveTo(x, y, rxx2, ryy2, 180); + arcTo(x, y, rxx2, ryy2, 180, -90); + arcTo(x+w-rxx2, y, rxx2, ryy2, 90, -90); + arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 0, -90); + arcTo(x, y+h-ryy2, rxx2, ryy2, 270, -90); closeSubpath(); d_func()->require_moveTo = true; diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index 112c2bd..54b9392 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -132,10 +132,9 @@ public: QPainterPathData() : cStart(0), fillRule(Qt::OddEvenFill), - pathConverter(0), dirtyBounds(false), - dirtyControlBounds(false) - + dirtyControlBounds(false), + pathConverter(0) { ref = 1; require_moveTo = false; @@ -146,10 +145,10 @@ public: QPainterPathPrivate(), cStart(other.cStart), fillRule(other.fillRule), bounds(other.bounds), controlBounds(other.controlBounds), - pathConverter(0), dirtyBounds(other.dirtyBounds), dirtyControlBounds(other.dirtyControlBounds), - convex(other.convex) + convex(other.convex), + pathConverter(0) { ref = 1; require_moveTo = false; diff --git a/src/gui/painting/qprinterinfo_unix.cpp b/src/gui/painting/qprinterinfo_unix.cpp index 7e2946a..6684ff7 100644 --- a/src/gui/painting/qprinterinfo_unix.cpp +++ b/src/gui/painting/qprinterinfo_unix.cpp @@ -421,6 +421,7 @@ int qt_pd_foreach(int /*status */, char * /*key */, int /*keyLen */, int qt_retrieveNisPrinters(QList<QPrinterDescription> *printers) { +#ifndef QT_NO_LIBRARY typedef int (*WildCast)(int, char *, int, char *, int, char *); char printersConfByname[] = "printers.conf.byname"; char *domain; @@ -444,6 +445,7 @@ int qt_retrieveNisPrinters(QList<QPrinterDescription> *printers) if (!err) return Success; } +#endif //QT_NO_LIBRARY return Unavail; } diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index c57b3c1..228a6b1 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -452,6 +452,17 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine #endif if (join == FlatJoin) { + QLineF prevLine(qt_fixed_to_real(m_back2X), qt_fixed_to_real(m_back2Y), + qt_fixed_to_real(m_back1X), qt_fixed_to_real(m_back1Y)); + QPointF isect; + QLineF::IntersectType type = prevLine.intersect(nextLine, &isect); + QLineF shortCut(prevLine.p2(), nextLine.p1()); + qreal angle = shortCut.angleTo(prevLine); + if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + emitLineTo(focal_x, focal_y); + emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); + return; + } emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); @@ -468,8 +479,8 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine // If we are on the inside, do the short cut... QLineF shortCut(prevLine.p2(), nextLine.p1()); qreal angle = shortCut.angleTo(prevLine); - if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + emitLineTo(focal_x, focal_y); emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); return; } @@ -509,8 +520,9 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine qfixed offset = m_strokeWidth / 2; QLineF shortCut(prevLine.p2(), nextLine.p1()); - qreal angle = prevLine.angle(shortCut); + qreal angle = shortCut.angleTo(prevLine); if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + emitLineTo(focal_x, focal_y); emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); return; } @@ -581,6 +593,13 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine qt_real_to_fixed(l1.x1()), qt_real_to_fixed(l1.y1())); } else if (join == SvgMiterJoin) { + QLineF shortCut(prevLine.p2(), nextLine.p1()); + qreal angle = shortCut.angleTo(prevLine); + if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + emitLineTo(focal_x, focal_y); + emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); + return; + } QLineF miterLine(QPointF(qt_fixed_to_real(focal_x), qt_fixed_to_real(focal_y)), isect); if (miterLine.length() > qt_fixed_to_real(m_strokeWidth * m_miterLimit) / 2) { diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp index 4f489c4..fa0c80e 100644 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ b/src/gui/painting/qwindowsurface_qws.cpp @@ -668,9 +668,11 @@ void QWSWindowSurface::flush(QWidget *widget, const QRegion ®ion, if (!win) return; +#ifndef QT_NO_GRAPHICSVIEW QWExtra *extra = win->d_func()->extra; if (extra && extra->proxyWidget) return; +#endif //QT_NO_GRAPHICSVIEW Q_UNUSED(offset); diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp index 46c4c42..77e019c 100644 --- a/src/gui/painting/qwindowsurface_x11.cpp +++ b/src/gui/painting/qwindowsurface_x11.cpp @@ -94,6 +94,8 @@ QPaintDevice *QX11WindowSurface::paintDevice() void QX11WindowSurface::beginPaint(const QRegion &rgn) { #ifndef QT_NO_XRENDER + Q_ASSERT(!d_ptr->device.isNull()); + if (d_ptr->translucentBackground) { if (d_ptr->device.depth() != 32) static_cast<QX11PixmapData *>(d_ptr->device.data_ptr().data())->convertToARGB32(); @@ -157,8 +159,8 @@ void QX11WindowSurface::setGeometry(const QRect &rect) QPixmap::x11SetDefaultScreen(d_ptr->widget->x11Info().screen()); QX11PixmapData *oldData = static_cast<QX11PixmapData *>(d_ptr->device.pixmapData()); - Q_ASSERT(oldData); - if (!(oldData->flags & QX11PixmapData::Uninitialized) && hasStaticContents()) { + + if (oldData && !(oldData->flags & QX11PixmapData::Uninitialized) && hasStaticContents()) { // Copy the content of the old pixmap into the new one. QX11PixmapData *newData = new QX11PixmapData(QPixmapData::PixmapType); newData->resize(size.width(), size.height()); diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 4ad78f9..4c4c994 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -163,7 +163,7 @@ void QS60MainAppUi::HandleResourceChangeL(TInt type) /*! * \brief Handles raw window server events. * - * The event type and information is passed in \a event, while the receiving control is passed in + * The event type and information is passed in \a wsEvent, while the receiving control is passed in * \a destination. * * If you override this function, you should call the base class implementation if you do not diff --git a/src/gui/statemachine/qbasickeyeventtransition.cpp b/src/gui/statemachine/qbasickeyeventtransition.cpp index 445a253..bf10e3d 100644 --- a/src/gui/statemachine/qbasickeyeventtransition.cpp +++ b/src/gui/statemachine/qbasickeyeventtransition.cpp @@ -68,14 +68,14 @@ public: QEvent::Type eventType; int key; - Qt::KeyboardModifiers modifiersMask; + Qt::KeyboardModifiers modifierMask; }; QBasicKeyEventTransitionPrivate::QBasicKeyEventTransitionPrivate() { eventType = QEvent::None; key = 0; - modifiersMask = Qt::NoModifier; + modifierMask = Qt::NoModifier; } QBasicKeyEventTransitionPrivate *QBasicKeyEventTransitionPrivate::get(QBasicKeyEventTransition *q) @@ -106,17 +106,17 @@ QBasicKeyEventTransition::QBasicKeyEventTransition(QEvent::Type type, int key, /*! Constructs a new event transition for events of the given \a type for the - given \a key, with the given \a modifiersMask and \a sourceState. + given \a key, with the given \a modifierMask and \a sourceState. */ QBasicKeyEventTransition::QBasicKeyEventTransition(QEvent::Type type, int key, - Qt::KeyboardModifiers modifiersMask, + Qt::KeyboardModifiers modifierMask, QState *sourceState) : QAbstractTransition(*new QBasicKeyEventTransitionPrivate, sourceState) { Q_D(QBasicKeyEventTransition); d->eventType = type; d->key = key; - d->modifiersMask = modifiersMask; + d->modifierMask = modifierMask; } /*! @@ -163,23 +163,23 @@ void QBasicKeyEventTransition::setKey(int key) } /*! - Returns the keyboard modifiers mask that this key event transition checks + Returns the keyboard modifier mask that this key event transition checks for. */ -Qt::KeyboardModifiers QBasicKeyEventTransition::modifiersMask() const +Qt::KeyboardModifiers QBasicKeyEventTransition::modifierMask() const { Q_D(const QBasicKeyEventTransition); - return d->modifiersMask; + return d->modifierMask; } /*! - Sets the keyboard modifiers mask that this key event transition will check + Sets the keyboard modifier mask that this key event transition will check for. */ -void QBasicKeyEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) +void QBasicKeyEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) { Q_D(QBasicKeyEventTransition); - d->modifiersMask = modifiersMask; + d->modifierMask = modifierMask; } /*! @@ -191,7 +191,7 @@ bool QBasicKeyEventTransition::eventTest(QEvent *event) if (event->type() == d->eventType) { QKeyEvent *ke = static_cast<QKeyEvent*>(event); return (ke->key() == d->key) - && ((ke->modifiers() & d->modifiersMask) == d->modifiersMask); + && ((ke->modifiers() & d->modifierMask) == d->modifierMask); } return false; } diff --git a/src/gui/statemachine/qbasickeyeventtransition_p.h b/src/gui/statemachine/qbasickeyeventtransition_p.h index 3c2ec7d..87d3dc7 100644 --- a/src/gui/statemachine/qbasickeyeventtransition_p.h +++ b/src/gui/statemachine/qbasickeyeventtransition_p.h @@ -69,7 +69,7 @@ public: QBasicKeyEventTransition(QState *sourceState = 0); QBasicKeyEventTransition(QEvent::Type type, int key, QState *sourceState = 0); QBasicKeyEventTransition(QEvent::Type type, int key, - Qt::KeyboardModifiers modifiersMask, + Qt::KeyboardModifiers modifierMask, QState *sourceState = 0); ~QBasicKeyEventTransition(); @@ -79,8 +79,8 @@ public: int key() const; void setKey(int key); - Qt::KeyboardModifiers modifiersMask() const; - void setModifiersMask(Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); protected: bool eventTest(QEvent *event); diff --git a/src/gui/statemachine/qbasicmouseeventtransition.cpp b/src/gui/statemachine/qbasicmouseeventtransition.cpp index 694c319..fe0dea9 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition.cpp +++ b/src/gui/statemachine/qbasicmouseeventtransition.cpp @@ -69,7 +69,7 @@ public: QEvent::Type eventType; Qt::MouseButton button; - Qt::KeyboardModifiers modifiersMask; + Qt::KeyboardModifiers modifierMask; QPainterPath path; }; @@ -149,38 +149,38 @@ void QBasicMouseEventTransition::setButton(Qt::MouseButton button) } /*! - Returns the keyboard modifiers mask that this mouse event transition checks + Returns the keyboard modifier mask that this mouse event transition checks for. */ -Qt::KeyboardModifiers QBasicMouseEventTransition::modifiersMask() const +Qt::KeyboardModifiers QBasicMouseEventTransition::modifierMask() const { Q_D(const QBasicMouseEventTransition); - return d->modifiersMask; + return d->modifierMask; } /*! - Sets the keyboard modifiers mask that this mouse event transition will check + Sets the keyboard modifier mask that this mouse event transition will check for. */ -void QBasicMouseEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) +void QBasicMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) { Q_D(QBasicMouseEventTransition); - d->modifiersMask = modifiersMask; + d->modifierMask = modifierMask; } /*! - Returns the path for this mouse event transition. + Returns the hit test path for this mouse event transition. */ -QPainterPath QBasicMouseEventTransition::path() const +QPainterPath QBasicMouseEventTransition::hitTestPath() const { Q_D(const QBasicMouseEventTransition); return d->path; } /*! - Sets the path for this mouse event transition. + Sets the hit test path for this mouse event transition. */ -void QBasicMouseEventTransition::setPath(const QPainterPath &path) +void QBasicMouseEventTransition::setHitTestPath(const QPainterPath &path) { Q_D(QBasicMouseEventTransition); d->path = path; @@ -195,7 +195,7 @@ bool QBasicMouseEventTransition::eventTest(QEvent *event) if (event->type() == d->eventType) { QMouseEvent *me = static_cast<QMouseEvent*>(event); return (me->button() == d->button) - && ((me->modifiers() & d->modifiersMask) == d->modifiersMask) + && ((me->modifiers() & d->modifierMask) == d->modifierMask) && (d->path.isEmpty() || d->path.contains(me->pos())); } return false; diff --git a/src/gui/statemachine/qbasicmouseeventtransition_p.h b/src/gui/statemachine/qbasicmouseeventtransition_p.h index 512e0f8..6754c55 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition_p.h +++ b/src/gui/statemachine/qbasicmouseeventtransition_p.h @@ -79,11 +79,11 @@ public: Qt::MouseButton button() const; void setButton(Qt::MouseButton button); - Qt::KeyboardModifiers modifiersMask() const; - void setModifiersMask(Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); - QPainterPath path() const; - void setPath(const QPainterPath &path); + QPainterPath hitTestPath() const; + void setHitTestPath(const QPainterPath &path); protected: bool eventTest(QEvent *event); diff --git a/src/gui/statemachine/qkeyeventtransition.cpp b/src/gui/statemachine/qkeyeventtransition.cpp index dee3168..a15e671 100644 --- a/src/gui/statemachine/qkeyeventtransition.cpp +++ b/src/gui/statemachine/qkeyeventtransition.cpp @@ -69,9 +69,9 @@ QT_BEGIN_NAMESPACE */ /*! - \property QKeyEventTransition::modifiersMask + \property QKeyEventTransition::modifierMask - \brief the keyboard modifiers mask that this key event transition checks for + \brief the keyboard modifier mask that this key event transition checks for */ class QKeyEventTransitionPrivate : public QEventTransitionPrivate @@ -133,23 +133,23 @@ void QKeyEventTransition::setKey(int key) } /*! - Returns the keyboard modifiers mask that this key event transition checks + Returns the keyboard modifier mask that this key event transition checks for. */ -Qt::KeyboardModifiers QKeyEventTransition::modifiersMask() const +Qt::KeyboardModifiers QKeyEventTransition::modifierMask() const { Q_D(const QKeyEventTransition); - return d->transition->modifiersMask(); + return d->transition->modifierMask(); } /*! - Sets the keyboard \a modifiers mask that this key event transition will - check for. + Sets the keyboard modifier mask that this key event transition will + check for to \a modifierMask. */ -void QKeyEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) +void QKeyEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) { Q_D(QKeyEventTransition); - d->transition->setModifiersMask(modifiersMask); + d->transition->setModifierMask(modifierMask); } /*! diff --git a/src/gui/statemachine/qkeyeventtransition.h b/src/gui/statemachine/qkeyeventtransition.h index 8df8138..ab1c155 100644 --- a/src/gui/statemachine/qkeyeventtransition.h +++ b/src/gui/statemachine/qkeyeventtransition.h @@ -57,7 +57,7 @@ class Q_GUI_EXPORT QKeyEventTransition : public QEventTransition { Q_OBJECT Q_PROPERTY(int key READ key WRITE setKey) - Q_PROPERTY(Qt::KeyboardModifiers modifiersMask READ modifiersMask WRITE setModifiersMask) + Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask) public: QKeyEventTransition(QState *sourceState = 0); QKeyEventTransition(QObject *object, QEvent::Type type, int key, @@ -67,8 +67,8 @@ public: int key() const; void setKey(int key); - Qt::KeyboardModifiers modifiersMask() const; - void setModifiersMask(Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); protected: void onTransition(QEvent *event); diff --git a/src/gui/statemachine/qmouseeventtransition.cpp b/src/gui/statemachine/qmouseeventtransition.cpp index 86cacf7..f5c0cb1 100644 --- a/src/gui/statemachine/qmouseeventtransition.cpp +++ b/src/gui/statemachine/qmouseeventtransition.cpp @@ -70,9 +70,9 @@ QT_BEGIN_NAMESPACE */ /*! - \property QMouseEventTransition::modifiersMask + \property QMouseEventTransition::modifierMask - \brief the keyboard modifiers mask that this mouse event transition checks for + \brief the keyboard modifier mask that this mouse event transition checks for */ class QMouseEventTransitionPrivate : public QEventTransitionPrivate @@ -139,45 +139,45 @@ void QMouseEventTransition::setButton(Qt::MouseButton button) } /*! - Returns the keyboard modifiers mask that this mouse event transition checks + Returns the keyboard modifier mask that this mouse event transition checks for. */ -Qt::KeyboardModifiers QMouseEventTransition::modifiersMask() const +Qt::KeyboardModifiers QMouseEventTransition::modifierMask() const { Q_D(const QMouseEventTransition); - return d->transition->modifiersMask(); + return d->transition->modifierMask(); } /*! - Sets the keyboard \a modifiers mask that this mouse event transition will - check for. + Sets the keyboard modifier mask that this mouse event transition will + check for to \a modifierMask. */ -void QMouseEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) +void QMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) { Q_D(QMouseEventTransition); - d->transition->setModifiersMask(modifiersMask); + d->transition->setModifierMask(modifierMask); } /*! - Returns the path for this mouse event transition. + Returns the hit test path for this mouse event transition. */ -QPainterPath QMouseEventTransition::path() const +QPainterPath QMouseEventTransition::hitTestPath() const { Q_D(const QMouseEventTransition); - return d->transition->path(); + return d->transition->hitTestPath(); } /*! - Sets the \a path for this mouse event transition. + Sets the hit test path for this mouse event transition to \a path. If a valid path has been set, the transition will only trigger if the mouse event position (QMouseEvent::pos()) is inside the path. \sa QPainterPath::contains() */ -void QMouseEventTransition::setPath(const QPainterPath &path) +void QMouseEventTransition::setHitTestPath(const QPainterPath &path) { Q_D(QMouseEventTransition); - d->transition->setPath(path); + d->transition->setHitTestPath(path); } /*! diff --git a/src/gui/statemachine/qmouseeventtransition.h b/src/gui/statemachine/qmouseeventtransition.h index 4e324ec..e7f6a45 100644 --- a/src/gui/statemachine/qmouseeventtransition.h +++ b/src/gui/statemachine/qmouseeventtransition.h @@ -58,7 +58,7 @@ class Q_GUI_EXPORT QMouseEventTransition : public QEventTransition { Q_OBJECT Q_PROPERTY(Qt::MouseButton button READ button WRITE setButton) - Q_PROPERTY(Qt::KeyboardModifiers modifiersMask READ modifiersMask WRITE setModifiersMask) + Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask) public: QMouseEventTransition(QState *sourceState = 0); QMouseEventTransition(QObject *object, QEvent::Type type, @@ -68,11 +68,11 @@ public: Qt::MouseButton button() const; void setButton(Qt::MouseButton button); - Qt::KeyboardModifiers modifiersMask() const; - void setModifiersMask(Qt::KeyboardModifiers modifiers); + Qt::KeyboardModifiers modifierMask() const; + void setModifierMask(Qt::KeyboardModifiers modifiers); - QPainterPath path() const; - void setPath(const QPainterPath &path); + QPainterPath hitTestPath() const; + void setHitTestPath(const QPainterPath &path); protected: void onTransition(QEvent *event); diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp deleted file mode 100644 index 32fde62..0000000 --- a/src/gui/styles/gtksymbols.cpp +++ /dev/null @@ -1,1008 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying -** this package. -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "gtksymbols_p.h" - -// This file is responsible for resolving all GTK functions we use -// dynamically. This is done to avoid link-time dependancy on GTK -// as well as crashes occurring due to usage of the GTK_QT engines -// -// Additionally we create a map of common GTK widgets that we can pass -// to the GTK theme engine as many engines resort to querying the -// actual widget pointers for details that are not covered by the -// state flags - -#include <QtCore/qglobal.h> -#if !defined(QT_NO_STYLE_GTK) - -#include <QtCore/QEvent> -#include <QtCore/QFile> -#include <QtCore/QStringList> -#include <QtCore/QTextStream> -#include <QtCore/QHash> -#include <QtCore/QUrl> - -#include <private/qapplication_p.h> -#include <private/qiconloader_p.h> - -#include <QtGui/QMenu> -#include <QtGui/QStyle> -#include <QtGui/QApplication> -#include <QtGui/QPixmapCache> -#include <QtGui/QStatusBar> -#include <QtGui/QMenuBar> -#include <QtGui/QToolBar> -#include <QtGui/QToolButton> -#include <QtGui/QX11Info> - -#include <X11/Xlib.h> - -QT_BEGIN_NAMESPACE - -static bool displayDepth = -1; -Q_GLOBAL_STATIC(QGtkStyleUpdateScheduler, styleScheduler) - -typedef QHash<QString, GtkWidget*> WidgetMap; -Q_GLOBAL_STATIC(WidgetMap, gtkWidgetMap) - -Ptr_gtk_container_forall QGtk::gtk_container_forall = 0; -Ptr_gtk_init QGtk::gtk_init = 0; -Ptr_gtk_style_attach QGtk::gtk_style_attach = 0; -Ptr_gtk_window_new QGtk::gtk_window_new = 0; -Ptr_gtk_widget_destroy QGtk::gtk_widget_destroy = 0; -Ptr_gtk_widget_realize QGtk::gtk_widget_realize = 0; -Ptr_gtk_widget_set_default_direction QGtk::gtk_widget_set_default_direction = 0; -Ptr_gtk_widget_modify_color QGtk::gtk_widget_modify_fg = 0; -Ptr_gtk_widget_modify_color QGtk::gtk_widget_modify_bg = 0; -Ptr_gtk_arrow_new QGtk::gtk_arrow_new = 0; -Ptr_gtk_menu_item_new QGtk::gtk_menu_item_new = 0; -Ptr_gtk_check_menu_item_new QGtk::gtk_check_menu_item_new = 0; -Ptr_gtk_menu_bar_new QGtk::gtk_menu_bar_new = 0; -Ptr_gtk_menu_new QGtk::gtk_menu_new = 0; -Ptr_gtk_button_new QGtk::gtk_button_new = 0; -Ptr_gtk_tool_button_new QGtk::gtk_tool_button_new = 0; -Ptr_gtk_hbutton_box_new QGtk::gtk_hbutton_box_new = 0; -Ptr_gtk_check_button_new QGtk::gtk_check_button_new = 0; -Ptr_gtk_radio_button_new QGtk::gtk_radio_button_new = 0; -Ptr_gtk_spin_button_new QGtk::gtk_spin_button_new = 0; -Ptr_gtk_frame_new QGtk::gtk_frame_new = 0; -Ptr_gtk_expander_new QGtk::gtk_expander_new = 0; -Ptr_gtk_statusbar_new QGtk::gtk_statusbar_new = 0; -Ptr_gtk_entry_new QGtk::gtk_entry_new = 0; -Ptr_gtk_hscale_new QGtk::gtk_hscale_new = 0; -Ptr_gtk_vscale_new QGtk::gtk_vscale_new = 0; -Ptr_gtk_hscrollbar_new QGtk::gtk_hscrollbar_new = 0; -Ptr_gtk_vscrollbar_new QGtk::gtk_vscrollbar_new = 0; -Ptr_gtk_scrolled_window_new QGtk::gtk_scrolled_window_new = 0; -Ptr_gtk_notebook_new QGtk::gtk_notebook_new = 0; -Ptr_gtk_toolbar_new QGtk::gtk_toolbar_new = 0; -Ptr_gtk_toolbar_insert QGtk::gtk_toolbar_insert = 0; -Ptr_gtk_separator_tool_item_new QGtk::gtk_separator_tool_item_new = 0; -Ptr_gtk_tree_view_new QGtk::gtk_tree_view_new = 0; -Ptr_gtk_combo_box_new QGtk::gtk_combo_box_new = 0; -Ptr_gtk_combo_box_entry_new QGtk::gtk_combo_box_entry_new = 0; -Ptr_gtk_progress_bar_new QGtk::gtk_progress_bar_new = 0; -Ptr_gtk_container_add QGtk::gtk_container_add = 0; -Ptr_gtk_menu_shell_append QGtk::gtk_menu_shell_append = 0; -Ptr_gtk_progress_set_adjustment QGtk::gtk_progress_set_adjustment = 0; -Ptr_gtk_range_set_adjustment QGtk::gtk_range_set_adjustment = 0; -Ptr_gtk_range_set_inverted QGtk::gtk_range_set_inverted = 0; -Ptr_gtk_icon_factory_lookup_default QGtk::gtk_icon_factory_lookup_default = 0; -Ptr_gtk_icon_theme_get_default QGtk::gtk_icon_theme_get_default = 0; -Ptr_gtk_widget_style_get QGtk::gtk_widget_style_get = 0; -Ptr_gtk_icon_set_render_icon QGtk::gtk_icon_set_render_icon = 0; -Ptr_gtk_fixed_new QGtk::gtk_fixed_new = 0; -Ptr_gtk_tree_view_column_new QGtk::gtk_tree_view_column_new = 0; -Ptr_gtk_tree_view_get_column QGtk::gtk_tree_view_get_column = 0; -Ptr_gtk_tree_view_append_column QGtk::gtk_tree_view_append_column = 0; -Ptr_gtk_paint_check QGtk::gtk_paint_check = 0; -Ptr_gtk_paint_box QGtk::gtk_paint_box = 0; -Ptr_gtk_paint_box_gap QGtk::gtk_paint_box_gap = 0; -Ptr_gtk_paint_flat_box QGtk::gtk_paint_flat_box = 0; -Ptr_gtk_paint_option QGtk::gtk_paint_option = 0; -Ptr_gtk_paint_extension QGtk::gtk_paint_extension = 0; -Ptr_gtk_paint_slider QGtk::gtk_paint_slider = 0; -Ptr_gtk_paint_shadow QGtk::gtk_paint_shadow = 0; -Ptr_gtk_paint_resize_grip QGtk::gtk_paint_resize_grip = 0; -Ptr_gtk_paint_focus QGtk::gtk_paint_focus = 0; -Ptr_gtk_paint_arrow QGtk::gtk_paint_arrow = 0; -Ptr_gtk_paint_handle QGtk::gtk_paint_handle = 0; -Ptr_gtk_paint_expander QGtk::gtk_paint_expander = 0; -Ptr_gtk_adjustment_new QGtk::gtk_adjustment_new = 0; -Ptr_gtk_paint_hline QGtk::gtk_paint_hline = 0; -Ptr_gtk_paint_vline QGtk::gtk_paint_vline = 0; -Ptr_gtk_menu_item_set_submenu QGtk::gtk_menu_item_set_submenu = 0; -Ptr_gtk_settings_get_default QGtk::gtk_settings_get_default = 0; -Ptr_gtk_separator_menu_item_new QGtk::gtk_separator_menu_item_new = 0; -Ptr_gtk_widget_size_allocate QGtk::gtk_widget_size_allocate = 0; -Ptr_gtk_widget_set_direction QGtk::gtk_widget_set_direction = 0; -Ptr_gtk_widget_path QGtk::gtk_widget_path = 0; -Ptr_gtk_container_get_type QGtk::gtk_container_get_type = 0; -Ptr_gtk_window_get_type QGtk::gtk_window_get_type = 0; -Ptr_gtk_widget_get_type QGtk::gtk_widget_get_type = 0; -Ptr_gtk_rc_get_style_by_paths QGtk::gtk_rc_get_style_by_paths = 0; -Ptr_gtk_check_version QGtk::gtk_check_version = 0; - -Ptr_pango_font_description_get_size QGtk::pango_font_description_get_size = 0; -Ptr_pango_font_description_get_weight QGtk::pango_font_description_get_weight = 0; -Ptr_pango_font_description_get_family QGtk::pango_font_description_get_family = 0; -Ptr_pango_font_description_get_style QGtk::pango_font_description_get_style = 0; - -Ptr_gtk_file_filter_new QGtk::gtk_file_filter_new = 0; -Ptr_gtk_file_filter_set_name QGtk::gtk_file_filter_set_name = 0; -Ptr_gtk_file_filter_add_pattern QGtk::gtk_file_filter_add_pattern = 0; -Ptr_gtk_file_chooser_add_filter QGtk::gtk_file_chooser_add_filter = 0; -Ptr_gtk_file_chooser_set_filter QGtk::gtk_file_chooser_set_filter = 0; -Ptr_gtk_file_chooser_get_filter QGtk::gtk_file_chooser_get_filter = 0; -Ptr_gtk_file_chooser_dialog_new QGtk::gtk_file_chooser_dialog_new = 0; -Ptr_gtk_file_chooser_set_current_folder QGtk::gtk_file_chooser_set_current_folder = 0; -Ptr_gtk_file_chooser_get_filename QGtk::gtk_file_chooser_get_filename = 0; -Ptr_gtk_file_chooser_get_filenames QGtk::gtk_file_chooser_get_filenames = 0; -Ptr_gtk_file_chooser_set_current_name QGtk::gtk_file_chooser_set_current_name = 0; -Ptr_gtk_dialog_run QGtk::gtk_dialog_run = 0; -Ptr_gtk_file_chooser_set_filename QGtk::gtk_file_chooser_set_filename = 0; - -Ptr_gdk_pixbuf_get_pixels QGtk::gdk_pixbuf_get_pixels = 0; -Ptr_gdk_pixbuf_get_width QGtk::gdk_pixbuf_get_width = 0; -Ptr_gdk_pixbuf_get_height QGtk::gdk_pixbuf_get_height = 0; -Ptr_gdk_pixmap_new QGtk::gdk_pixmap_new = 0; -Ptr_gdk_pixbuf_new QGtk::gdk_pixbuf_new = 0; -Ptr_gdk_pixbuf_get_from_drawable QGtk::gdk_pixbuf_get_from_drawable = 0; -Ptr_gdk_draw_rectangle QGtk::gdk_draw_rectangle = 0; -Ptr_gdk_pixbuf_unref QGtk::gdk_pixbuf_unref = 0; -Ptr_gdk_drawable_unref QGtk::gdk_drawable_unref = 0; -Ptr_gdk_drawable_get_depth QGtk::gdk_drawable_get_depth = 0; -Ptr_gdk_color_free QGtk::gdk_color_free = 0; -Ptr_gdk_x11_window_set_user_time QGtk::gdk_x11_window_set_user_time = 0; -Ptr_gdk_x11_drawable_get_xid QGtk::gdk_x11_drawable_get_xid = 0; -Ptr_gdk_x11_drawable_get_xdisplay QGtk::gdk_x11_drawable_get_xdisplay = 0; - -Ptr_gconf_client_get_default QGtk::gconf_client_get_default = 0; -Ptr_gconf_client_get_string QGtk::gconf_client_get_string = 0; -Ptr_gconf_client_get_bool QGtk::gconf_client_get_bool = 0; - -Ptr_gnome_icon_lookup_sync QGtk::gnome_icon_lookup_sync = 0; -Ptr_gnome_vfs_init QGtk::gnome_vfs_init = 0; - -static QString classPath(GtkWidget *widget) -{ - char* class_path; - QGtk::gtk_widget_path (widget, NULL, &class_path, NULL); - QString path = QLS(class_path); - g_free(class_path); - - // Remove the prefixes - path.remove(QLS("GtkWindow.")); - path.remove(QLS("GtkFixed.")); - return path; -} - -static void resolveGtk() -{ - // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0 - QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0); - QGtk::gtk_init = (Ptr_gtk_init)libgtk.resolve("gtk_init"); - QGtk::gtk_window_new = (Ptr_gtk_window_new)libgtk.resolve("gtk_window_new"); - QGtk::gtk_style_attach = (Ptr_gtk_style_attach)libgtk.resolve("gtk_style_attach"); - QGtk::gtk_widget_destroy = (Ptr_gtk_widget_destroy)libgtk.resolve("gtk_widget_destroy"); - QGtk::gtk_widget_realize = (Ptr_gtk_widget_realize)libgtk.resolve("gtk_widget_realize"); - - QGtk::gtk_file_chooser_set_current_folder = (Ptr_gtk_file_chooser_set_current_folder)libgtk.resolve("gtk_file_chooser_set_current_folder"); - QGtk::gtk_file_filter_new = (Ptr_gtk_file_filter_new)libgtk.resolve("gtk_file_filter_new"); - QGtk::gtk_file_filter_set_name = (Ptr_gtk_file_filter_set_name)libgtk.resolve("gtk_file_filter_set_name"); - QGtk::gtk_file_filter_add_pattern = (Ptr_gtk_file_filter_add_pattern)libgtk.resolve("gtk_file_filter_add_pattern"); - QGtk::gtk_file_chooser_add_filter = (Ptr_gtk_file_chooser_add_filter)libgtk.resolve("gtk_file_chooser_add_filter"); - QGtk::gtk_file_chooser_set_filter = (Ptr_gtk_file_chooser_set_filter)libgtk.resolve("gtk_file_chooser_set_filter"); - QGtk::gtk_file_chooser_get_filter = (Ptr_gtk_file_chooser_get_filter)libgtk.resolve("gtk_file_chooser_get_filter"); - QGtk::gtk_file_chooser_dialog_new = (Ptr_gtk_file_chooser_dialog_new)libgtk.resolve("gtk_file_chooser_dialog_new"); - QGtk::gtk_file_chooser_set_current_folder = (Ptr_gtk_file_chooser_set_current_folder)libgtk.resolve("gtk_file_chooser_set_current_folder"); - QGtk::gtk_file_chooser_get_filename = (Ptr_gtk_file_chooser_get_filename)libgtk.resolve("gtk_file_chooser_get_filename"); - QGtk::gtk_file_chooser_get_filenames = (Ptr_gtk_file_chooser_get_filenames)libgtk.resolve("gtk_file_chooser_get_filenames"); - QGtk::gtk_file_chooser_set_current_name = (Ptr_gtk_file_chooser_set_current_name)libgtk.resolve("gtk_file_chooser_set_current_name"); - QGtk::gtk_dialog_run = (Ptr_gtk_dialog_run)libgtk.resolve("gtk_dialog_run"); - QGtk::gtk_file_chooser_set_filename = (Ptr_gtk_file_chooser_set_filename)libgtk.resolve("gtk_file_chooser_set_filename"); - - QGtk::gdk_pixbuf_get_pixels = (Ptr_gdk_pixbuf_get_pixels)libgtk.resolve("gdk_pixbuf_get_pixels"); - QGtk::gdk_pixbuf_get_width = (Ptr_gdk_pixbuf_get_width)libgtk.resolve("gdk_pixbuf_get_width"); - QGtk::gdk_pixbuf_get_height = (Ptr_gdk_pixbuf_get_height)libgtk.resolve("gdk_pixbuf_get_height"); - QGtk::gdk_pixmap_new = (Ptr_gdk_pixmap_new)libgtk.resolve("gdk_pixmap_new"); - QGtk::gdk_pixbuf_new = (Ptr_gdk_pixbuf_new)libgtk.resolve("gdk_pixbuf_new"); - QGtk::gdk_pixbuf_get_from_drawable = (Ptr_gdk_pixbuf_get_from_drawable)libgtk.resolve("gdk_pixbuf_get_from_drawable"); - QGtk::gdk_draw_rectangle = (Ptr_gdk_draw_rectangle)libgtk.resolve("gdk_draw_rectangle"); - QGtk::gdk_pixbuf_unref = (Ptr_gdk_pixbuf_unref)libgtk.resolve("gdk_pixbuf_unref"); - QGtk::gdk_drawable_unref = (Ptr_gdk_drawable_unref)libgtk.resolve("gdk_drawable_unref"); - QGtk::gdk_drawable_get_depth = (Ptr_gdk_drawable_get_depth)libgtk.resolve("gdk_drawable_get_depth"); - QGtk::gdk_color_free = (Ptr_gdk_color_free)libgtk.resolve("gdk_color_free"); - QGtk::gdk_x11_window_set_user_time = (Ptr_gdk_x11_window_set_user_time)libgtk.resolve("gdk_x11_window_set_user_time"); - QGtk::gdk_x11_drawable_get_xid = (Ptr_gdk_x11_drawable_get_xid)libgtk.resolve("gdk_x11_drawable_get_xid"); - QGtk::gdk_x11_drawable_get_xdisplay = (Ptr_gdk_x11_drawable_get_xdisplay)libgtk.resolve("gdk_x11_drawable_get_xdisplay"); - - QGtk::gtk_widget_set_default_direction = (Ptr_gtk_widget_set_default_direction)libgtk.resolve("gtk_widget_set_default_direction"); - QGtk::gtk_widget_modify_fg = (Ptr_gtk_widget_modify_color)libgtk.resolve("gtk_widget_modify_fg"); - QGtk::gtk_widget_modify_bg = (Ptr_gtk_widget_modify_color)libgtk.resolve("gtk_widget_modify_bg"); - QGtk::gtk_arrow_new = (Ptr_gtk_arrow_new)libgtk.resolve("gtk_arrow_new"); - QGtk::gtk_menu_item_new = (Ptr_gtk_menu_item_new)libgtk.resolve("gtk_menu_item_new"); - QGtk::gtk_check_menu_item_new = (Ptr_gtk_check_menu_item_new)libgtk.resolve("gtk_check_menu_item_new"); - QGtk::gtk_menu_bar_new = (Ptr_gtk_menu_bar_new)libgtk.resolve("gtk_menu_bar_new"); - QGtk::gtk_menu_new = (Ptr_gtk_menu_new)libgtk.resolve("gtk_menu_new"); - QGtk::gtk_toolbar_new = (Ptr_gtk_toolbar_new)libgtk.resolve("gtk_toolbar_new"); - QGtk::gtk_separator_tool_item_new = (Ptr_gtk_separator_tool_item_new)libgtk.resolve("gtk_separator_tool_item_new"); - QGtk::gtk_toolbar_insert = (Ptr_gtk_toolbar_insert)libgtk.resolve("gtk_toolbar_insert"); - QGtk::gtk_button_new = (Ptr_gtk_button_new)libgtk.resolve("gtk_button_new"); - QGtk::gtk_tool_button_new = (Ptr_gtk_tool_button_new)libgtk.resolve("gtk_tool_button_new"); - QGtk::gtk_hbutton_box_new = (Ptr_gtk_hbutton_box_new)libgtk.resolve("gtk_hbutton_box_new"); - QGtk::gtk_check_button_new = (Ptr_gtk_check_button_new)libgtk.resolve("gtk_check_button_new"); - QGtk::gtk_radio_button_new = (Ptr_gtk_radio_button_new)libgtk.resolve("gtk_radio_button_new"); - QGtk::gtk_notebook_new = (Ptr_gtk_notebook_new)libgtk.resolve("gtk_notebook_new"); - QGtk::gtk_progress_bar_new = (Ptr_gtk_progress_bar_new)libgtk.resolve("gtk_progress_bar_new"); - QGtk::gtk_spin_button_new = (Ptr_gtk_spin_button_new)libgtk.resolve("gtk_spin_button_new"); - QGtk::gtk_hscale_new = (Ptr_gtk_hscale_new)libgtk.resolve("gtk_hscale_new"); - QGtk::gtk_vscale_new = (Ptr_gtk_vscale_new)libgtk.resolve("gtk_vscale_new"); - QGtk::gtk_hscrollbar_new = (Ptr_gtk_hscrollbar_new)libgtk.resolve("gtk_hscrollbar_new"); - QGtk::gtk_vscrollbar_new = (Ptr_gtk_vscrollbar_new)libgtk.resolve("gtk_vscrollbar_new"); - QGtk::gtk_scrolled_window_new = (Ptr_gtk_scrolled_window_new)libgtk.resolve("gtk_scrolled_window_new"); - QGtk::gtk_menu_shell_append = (Ptr_gtk_menu_shell_append)libgtk.resolve("gtk_menu_shell_append"); - QGtk::gtk_entry_new = (Ptr_gtk_entry_new)libgtk.resolve("gtk_entry_new"); - QGtk::gtk_tree_view_new = (Ptr_gtk_tree_view_new)libgtk.resolve("gtk_tree_view_new"); - QGtk::gtk_combo_box_new = (Ptr_gtk_combo_box_new)libgtk.resolve("gtk_combo_box_new"); - QGtk::gtk_progress_set_adjustment = (Ptr_gtk_progress_set_adjustment)libgtk.resolve("gtk_progress_set_adjustment"); - QGtk::gtk_range_set_adjustment = (Ptr_gtk_range_set_adjustment)libgtk.resolve("gtk_range_set_adjustment"); - QGtk::gtk_range_set_inverted = (Ptr_gtk_range_set_inverted)libgtk.resolve("gtk_range_set_inverted"); - QGtk::gtk_container_add = (Ptr_gtk_container_add)libgtk.resolve("gtk_container_add"); - QGtk::gtk_icon_factory_lookup_default = (Ptr_gtk_icon_factory_lookup_default)libgtk.resolve("gtk_icon_factory_lookup_default"); - QGtk::gtk_icon_theme_get_default = (Ptr_gtk_icon_theme_get_default)libgtk.resolve("gtk_icon_theme_get_default"); - QGtk::gtk_widget_style_get = (Ptr_gtk_widget_style_get)libgtk.resolve("gtk_widget_style_get"); - QGtk::gtk_icon_set_render_icon = (Ptr_gtk_icon_set_render_icon)libgtk.resolve("gtk_icon_set_render_icon"); - QGtk::gtk_fixed_new = (Ptr_gtk_fixed_new)libgtk.resolve("gtk_fixed_new"); - QGtk::gtk_tree_view_column_new = (Ptr_gtk_tree_view_column_new)libgtk.resolve("gtk_tree_view_column_new"); - QGtk::gtk_tree_view_append_column= (Ptr_gtk_tree_view_append_column )libgtk.resolve("gtk_tree_view_append_column"); - QGtk::gtk_tree_view_get_column = (Ptr_gtk_tree_view_get_column )libgtk.resolve("gtk_tree_view_get_column"); - QGtk::gtk_paint_check = (Ptr_gtk_paint_check)libgtk.resolve("gtk_paint_check"); - QGtk::gtk_paint_box = (Ptr_gtk_paint_box)libgtk.resolve("gtk_paint_box"); - QGtk::gtk_paint_flat_box = (Ptr_gtk_paint_flat_box)libgtk.resolve("gtk_paint_flat_box"); - QGtk::gtk_paint_check = (Ptr_gtk_paint_check)libgtk.resolve("gtk_paint_check"); - QGtk::gtk_paint_box = (Ptr_gtk_paint_box)libgtk.resolve("gtk_paint_box"); - QGtk::gtk_paint_resize_grip = (Ptr_gtk_paint_resize_grip)libgtk.resolve("gtk_paint_resize_grip"); - QGtk::gtk_paint_focus = (Ptr_gtk_paint_focus)libgtk.resolve("gtk_paint_focus"); - QGtk::gtk_paint_shadow = (Ptr_gtk_paint_shadow)libgtk.resolve("gtk_paint_shadow"); - QGtk::gtk_paint_slider = (Ptr_gtk_paint_slider)libgtk.resolve("gtk_paint_slider"); - QGtk::gtk_paint_expander = (Ptr_gtk_paint_expander)libgtk.resolve("gtk_paint_expander"); - QGtk::gtk_paint_handle = (Ptr_gtk_paint_handle)libgtk.resolve("gtk_paint_handle"); - QGtk::gtk_paint_option = (Ptr_gtk_paint_option)libgtk.resolve("gtk_paint_option"); - QGtk::gtk_paint_arrow = (Ptr_gtk_paint_arrow)libgtk.resolve("gtk_paint_arrow"); - QGtk::gtk_paint_box_gap = (Ptr_gtk_paint_box_gap)libgtk.resolve("gtk_paint_box_gap"); - QGtk::gtk_paint_extension = (Ptr_gtk_paint_extension)libgtk.resolve("gtk_paint_extension"); - QGtk::gtk_paint_hline = (Ptr_gtk_paint_hline)libgtk.resolve("gtk_paint_hline"); - QGtk::gtk_paint_vline = (Ptr_gtk_paint_vline)libgtk.resolve("gtk_paint_vline"); - QGtk::gtk_adjustment_new = (Ptr_gtk_adjustment_new)libgtk.resolve("gtk_adjustment_new"); - QGtk::gtk_menu_item_set_submenu = (Ptr_gtk_menu_item_set_submenu)libgtk.resolve("gtk_menu_item_set_submenu"); - QGtk::gtk_settings_get_default = (Ptr_gtk_settings_get_default)libgtk.resolve("gtk_settings_get_default"); - QGtk::gtk_separator_menu_item_new = (Ptr_gtk_separator_menu_item_new)libgtk.resolve("gtk_separator_menu_item_new"); - QGtk::gtk_frame_new = (Ptr_gtk_frame_new)libgtk.resolve("gtk_frame_new"); - QGtk::gtk_expander_new = (Ptr_gtk_expander_new)libgtk.resolve("gtk_expander_new"); - QGtk::gtk_statusbar_new = (Ptr_gtk_statusbar_new)libgtk.resolve("gtk_statusbar_new"); - QGtk::gtk_combo_box_entry_new = (Ptr_gtk_combo_box_entry_new)libgtk.resolve("gtk_combo_box_entry_new"); - QGtk::gtk_container_forall = (Ptr_gtk_container_forall)libgtk.resolve("gtk_container_forall"); - QGtk::gtk_widget_size_allocate =(Ptr_gtk_widget_size_allocate)libgtk.resolve("gtk_widget_size_allocate"); - QGtk::gtk_widget_set_direction =(Ptr_gtk_widget_set_direction)libgtk.resolve("gtk_widget_set_direction"); - QGtk::gtk_widget_path =(Ptr_gtk_widget_path)libgtk.resolve("gtk_widget_path"); - QGtk::gtk_container_get_type =(Ptr_gtk_container_get_type)libgtk.resolve("gtk_container_get_type"); - QGtk::gtk_window_get_type =(Ptr_gtk_window_get_type)libgtk.resolve("gtk_window_get_type"); - QGtk::gtk_widget_get_type =(Ptr_gtk_widget_get_type)libgtk.resolve("gtk_widget_get_type"); - QGtk::gtk_rc_get_style_by_paths =(Ptr_gtk_rc_get_style_by_paths)libgtk.resolve("gtk_rc_get_style_by_paths"); - QGtk::gtk_check_version =(Ptr_gtk_check_version)libgtk.resolve("gtk_check_version"); - QGtk::pango_font_description_get_size = (Ptr_pango_font_description_get_size)libgtk.resolve("pango_font_description_get_size"); - QGtk::pango_font_description_get_weight = (Ptr_pango_font_description_get_weight)libgtk.resolve("pango_font_description_get_weight"); - QGtk::pango_font_description_get_family = (Ptr_pango_font_description_get_family)libgtk.resolve("pango_font_description_get_family"); - QGtk::pango_font_description_get_style = (Ptr_pango_font_description_get_style)libgtk.resolve("pango_font_description_get_style"); - - QGtk::gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve( QLS("gnomeui-2"), 0, "gnome_icon_lookup_sync"); - QGtk::gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve( QLS("gnomevfs-2"), 0, "gnome_vfs_init"); -} - -void QGtk::cleanup_gtk_widgets() -{ - if (gtkWidgetMap()->contains(QLS("GtkWindow"))) // Gtk will destroy all children - QGtk::gtk_widget_destroy(gtkWidgetMap()->value(QLS("GtkWindow"))); -} - -static bool resolveGConf() -{ - if (!QGtk::gconf_client_get_default) { - QGtk::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_default"); - QGtk::gconf_client_get_string = (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_string"); - QGtk::gconf_client_get_bool = (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_bool"); - } - return (QGtk::gconf_client_get_default !=0); -} - -typedef int (*x11ErrorHandler)(Display*, XErrorEvent*); - -QString QGtk::getGConfString(const QString &value, const QString &fallback) -{ - QString retVal = fallback; - if (resolveGConf()) { - g_type_init(); - GConfClient* client = QGtk::gconf_client_get_default(); - GError *err = 0; - char *str = QGtk::gconf_client_get_string(client, qPrintable(value), &err); - if (!err) { - retVal = QString::fromUtf8(str); - g_free(str); - } - g_object_unref(client); - if (err) - g_error_free (err); - } - return retVal; -} - -bool QGtk::getGConfBool(const QString &key, bool fallback) -{ - bool retVal = fallback; - if (resolveGConf()) { - g_type_init(); - GConfClient* client = QGtk::gconf_client_get_default(); - GError *err = 0; - bool result = QGtk::gconf_client_get_bool(client, qPrintable(key), &err); - g_object_unref(client); - if (!err) - retVal = result; - else - g_error_free (err); - } - return retVal; -} - -static QString getThemeName() -{ - QString themeName; - // We try to parse the gtkrc file first - // primarily to avoid resolving Gtk functions if - // the KDE 3 "Qt" style is currently in use - QString rcPaths = QString::fromLocal8Bit(qgetenv("GTK2_RC_FILES")); - if (!rcPaths.isEmpty()) { - QStringList paths = rcPaths.split(QLS(":")); - foreach (const QString &rcPath, paths) { - if (!rcPath.isEmpty()) { - QFile rcFile(rcPath); - if (rcFile.exists() && rcFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream in(&rcFile); - while(!in.atEnd()) { - QString line = in.readLine(); - if (line.contains(QLS("gtk-theme-name"))) { - line = line.right(line.length() - line.indexOf(QLatin1Char('=')) - 1); - line.remove(QLatin1Char('\"')); - line = line.trimmed(); - themeName = line; - break; - } - } - } - } - if (!themeName.isEmpty()) - break; - } - } - - // Fall back to gconf - if (themeName.isEmpty() && resolveGConf()) - themeName = QGtk::getGConfString(QLS("/desktop/gnome/interface/gtk_theme")); - - return themeName; -} - -static void init_gtk_window() -{ - static QString themeName; - if (!gtkWidgetMap()->contains(QLS("GtkWindow")) && themeName.isEmpty()) { - themeName = getThemeName(); - - if (themeName.isEmpty()) { - qWarning("QGtkStyle was unable to detect the current GTK+ theme."); - return; - } else if (themeName == QLS("Qt") || themeName == QLS("Qt4")) { - // Due to namespace conflicts with Qt3 and obvious recursion with Qt4, - // we cannot support the GTK_Qt Gtk engine - qWarning("QGtkStyle cannot be used together with the GTK_Qt engine."); - return; - } - - resolveGtk(); - - if (QGtk::gtk_init) { - // Gtk will set the Qt error handler so we have to reset it afterwards - x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0); - QGtk::gtk_init (NULL, NULL); - XSetErrorHandler(qt_x_errhandler); - - GtkWidget* gtkWindow = QGtk::gtk_window_new(GTK_WINDOW_POPUP); - QGtk::gtk_widget_realize(gtkWindow); - if (displayDepth == -1) - displayDepth = QGtk::gdk_drawable_get_depth(gtkWindow->window); - gtkWidgetMap()->insert(QLS("GtkWindow"), gtkWindow); - } else { - qWarning("QGtkStyle could not resolve GTK. Make sure you have installed the proper libraries."); - } - } -} - -static void setup_gtk_widget(GtkWidget* widget) -{ - if (Q_GTK_IS_WIDGET(widget)) { - static GtkWidget* protoLayout = 0; - if (!protoLayout) { - protoLayout = QGtk::gtk_fixed_new(); - QGtk::gtk_container_add((GtkContainer*)(gtkWidgetMap()->value(QLS("GtkWindow"))), protoLayout); - } - Q_ASSERT(protoLayout); - - QGtk::gtk_container_add((GtkContainer*)(protoLayout), widget); - QGtk::gtk_widget_realize(widget); - } -} - -static void add_widget_to_map(GtkWidget *widget) -{ - if (Q_GTK_IS_WIDGET(widget)) { - QGtk::gtk_widget_realize(widget); - gtkWidgetMap()->insert(classPath(widget), widget); - } - } - -static void add_all_sub_widgets(GtkWidget *widget, gpointer v = 0) -{ - Q_UNUSED(v); - add_widget_to_map(widget); - if (GTK_CHECK_TYPE ((widget), Q_GTK_TYPE_CONTAINER)) - QGtk::gtk_container_forall((GtkContainer*)widget, add_all_sub_widgets, NULL); -} - -static void init_gtk_menu() -{ - // Create menubar - GtkWidget *gtkMenuBar = QGtk::gtk_menu_bar_new(); - setup_gtk_widget(gtkMenuBar); - - GtkWidget *gtkMenuBarItem = QGtk::gtk_menu_item_new(); - QGtk::gtk_menu_shell_append((GtkMenuShell*)(gtkMenuBar), gtkMenuBarItem); - QGtk::gtk_widget_realize(gtkMenuBarItem); - - // Create menu - GtkWidget *gtkMenu = QGtk::gtk_menu_new(); - QGtk::gtk_menu_item_set_submenu((GtkMenuItem*)(gtkMenuBarItem), gtkMenu); - QGtk::gtk_widget_realize(gtkMenu); - - GtkWidget *gtkMenuItem = QGtk::gtk_menu_item_new(); - QGtk::gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkMenuItem); - QGtk::gtk_widget_realize(gtkMenuItem); - - GtkWidget *gtkCheckMenuItem = QGtk::gtk_check_menu_item_new(); - QGtk::gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkCheckMenuItem); - QGtk::gtk_widget_realize(gtkCheckMenuItem); - - GtkWidget *gtkMenuSeparator = QGtk::gtk_separator_menu_item_new(); - QGtk::gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkMenuSeparator); - - add_all_sub_widgets(gtkMenuBar); - add_all_sub_widgets(gtkMenu); -} - -// Updates window/windowtext palette based on the indicated gtk widget -static QPalette gtkWidgetPalette(const QString >kWidgetName) -{ - GtkWidget *gtkWidget = QGtk::gtkWidget(gtkWidgetName); - Q_ASSERT(gtkWidget); - QPalette pal = QApplication::palette(); - GdkColor gdkBg = gtkWidget->style->bg[GTK_STATE_NORMAL]; - GdkColor gdkText = gtkWidget->style->fg[GTK_STATE_NORMAL]; - GdkColor gdkDisabledText = gtkWidget->style->fg[GTK_STATE_INSENSITIVE]; - QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); - QColor textColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); - QColor disabledTextColor(gdkDisabledText.red>>8, gdkDisabledText.green>>8, gdkDisabledText.blue>>8); - pal.setBrush(QPalette::Window, bgColor); - pal.setBrush(QPalette::Button, bgColor); - pal.setBrush(QPalette::All, QPalette::WindowText, textColor); - pal.setBrush(QPalette::Disabled, QPalette::WindowText, disabledTextColor); - pal.setBrush(QPalette::All, QPalette::ButtonText, textColor); - pal.setBrush(QPalette::Disabled, QPalette::ButtonText, disabledTextColor); - return pal; -} - -bool QGtk::isKDE4Session() -{ - static int version = -1; - if (version == -1) - version = qgetenv("KDE_SESSION_VERSION").toInt(); - return (version == 4); -} - -void QGtk::applyCustomPaletteHash() -{ - QPalette menuPal = gtkWidgetPalette(QLS("GtkMenu")); - GdkColor gdkBg = QGtk::gtkWidget(QLS("GtkMenu"))->style->bg[GTK_STATE_NORMAL]; - QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); - menuPal.setBrush(QPalette::Base, bgColor); - menuPal.setBrush(QPalette::Window, bgColor); - qApp->setPalette(menuPal, "QMenu"); - - QPalette toolbarPal = gtkWidgetPalette(QLS("GtkToolbar")); - qApp->setPalette(toolbarPal, "QToolBar"); - - QPalette menuBarPal = gtkWidgetPalette(QLS("GtkMenuBar")); - qApp->setPalette(menuBarPal, "QMenuBar"); -} - -static void gtkStyleSetCallback(GtkWidget*, GtkStyle*, void*) -{ - // We have to let this function return and complete the event - // loop to ensure that all gtk widgets have been styled before - // updating - QMetaObject::invokeMethod(styleScheduler(), "updateTheme", Qt::QueuedConnection); -} - -void QGtkStyleUpdateScheduler::updateTheme() -{ - static QString oldTheme(QLS("qt_not_set")); - QPixmapCache::clear(); - - QFont font = QGtk::getThemeFont(); - if (QApplication::font() != font) - qApp->setFont(font); - - if (oldTheme != getThemeName()) { - oldTheme = getThemeName(); - QPalette newPalette = qApp->style()->standardPalette(); - QApplicationPrivate::setSystemPalette(newPalette); - QApplication::setPalette(newPalette); - QGtk::initGtkWidgets(); - QGtk::applyCustomPaletteHash(); - QList<QWidget*> widgets = QApplication::allWidgets(); - // Notify all widgets that size metrics might have changed - foreach (QWidget *widget, widgets) { - QEvent e(QEvent::StyleChange); - QApplication::sendEvent(widget, &e); - } - } - QIconLoader::instance()->updateSystemTheme(); -} - -static void add_widget(GtkWidget *widget) -{ - if (widget) { - setup_gtk_widget(widget); - add_all_sub_widgets(widget); - } -} - -static void init_gtk_treeview() -{ - GtkWidget *gtkTreeView = QGtk::gtk_tree_view_new(); - QGtk::gtk_tree_view_append_column((GtkTreeView*)gtkTreeView, QGtk::gtk_tree_view_column_new()); - QGtk::gtk_tree_view_append_column((GtkTreeView*)gtkTreeView, QGtk::gtk_tree_view_column_new()); - QGtk::gtk_tree_view_append_column((GtkTreeView*)gtkTreeView, QGtk::gtk_tree_view_column_new()); - add_widget(gtkTreeView); -} - - -// Fetch the application font from the pango font description -// contained in the theme. -QFont QGtk::getThemeFont() -{ - QFont font; - GtkStyle *style = gtkStyle(); - if (style && qApp->desktopSettingsAware()) - { - PangoFontDescription *gtk_font = style->font_desc; - font.setPointSizeF((float)(pango_font_description_get_size(gtk_font))/PANGO_SCALE); - - QString family = QString::fromLatin1(pango_font_description_get_family(gtk_font)); - if (!family.isEmpty()) - font.setFamily(family); - - int weight = pango_font_description_get_weight(gtk_font); - if (weight >= PANGO_WEIGHT_HEAVY) - font.setWeight(QFont::Black); - else if (weight >= PANGO_WEIGHT_BOLD) - font.setWeight(QFont::Bold); - else if (weight >= PANGO_WEIGHT_SEMIBOLD) - font.setWeight(QFont::DemiBold); - else if (weight >= PANGO_WEIGHT_NORMAL) - font.setWeight(QFont::Normal); - else - font.setWeight(QFont::Light); - - PangoStyle fontstyle = pango_font_description_get_style(gtk_font); - if (fontstyle == PANGO_STYLE_ITALIC) - font.setStyle(QFont::StyleItalic); - else if (fontstyle == PANGO_STYLE_OBLIQUE) - font.setStyle(QFont::StyleOblique); - else - font.setStyle(QFont::StyleNormal); - } - return font; -} - -GtkWidget* QGtk::gtkWidget(const QString &path) -{ - GtkWidget *widget = gtkWidgetMap()->value(path); - if (!widget) { - // Theme might have rearranged widget internals - widget = gtkWidgetMap()->value(path); - } - return widget; -} - -GtkStyle* QGtk::gtkStyle(const QString &path) -{ - if (gtkWidgetMap()->contains(path)) - return gtkWidgetMap()->value(path)->style; - return 0; -} - -static void update_toolbar_style(GtkWidget *gtkToolBar, GParamSpec *, gpointer) -{ - GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS; - g_object_get(gtkToolBar, "toolbar-style", &toolbar_style, NULL); - QWidgetList widgets = QApplication::allWidgets(); - for (int i = 0; i < widgets.size(); ++i) { - QWidget *widget = widgets.at(i); - if (qobject_cast<QToolButton*>(widget)) { - QEvent event(QEvent::StyleChange); - QApplication::sendEvent(widget, &event); - } - } -} - -void QGtk::initGtkWidgets() -{ - // From gtkmain.c - uid_t ruid = getuid (); - uid_t rgid = getgid (); - uid_t euid = geteuid (); - uid_t egid = getegid (); - if (ruid != euid || rgid != egid) { - qWarning("\nThis process is currently running setuid or setgid.\nGTK+ does not allow this " - "therefore Qt cannot use the GTK+ integration.\nTry launching your app using \'gksudo\', " - "\'kdesudo\' or a similar tool.\n\n" - "See http://www.gtk.org/setuid.html for more information.\n"); - return; - } - - init_gtk_window(); - - if (QGtk::gtk_init) { - - // Make all widgets respect the text direction - if (qApp->layoutDirection() == Qt::RightToLeft) - QGtk::gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); - - if (!gtkWidgetMap()->contains(QLS("GtkButton"))) { - GtkWidget *gtkButton = QGtk::gtk_button_new(); - add_widget(gtkButton); - g_signal_connect(gtkButton, "style-set", G_CALLBACK(gtkStyleSetCallback), NULL); - add_widget(QGtk::gtk_tool_button_new(NULL, NULL)); - add_widget(QGtk::gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE)); - add_widget(QGtk::gtk_hbutton_box_new()); - add_widget(QGtk::gtk_check_button_new()); - add_widget(QGtk::gtk_radio_button_new(NULL)); - add_widget(QGtk::gtk_combo_box_new()); - add_widget(QGtk::gtk_combo_box_entry_new()); - add_widget(QGtk::gtk_entry_new()); - add_widget(QGtk::gtk_frame_new(NULL)); - add_widget(QGtk::gtk_expander_new("")); - add_widget(QGtk::gtk_statusbar_new()); - add_widget(QGtk::gtk_hscale_new((GtkAdjustment*)(QGtk::gtk_adjustment_new(1, 0, 1, 0, 0, 0)))); - add_widget(QGtk::gtk_hscrollbar_new(NULL)); - add_widget(QGtk::gtk_scrolled_window_new(NULL, NULL)); - init_gtk_menu(); - add_widget(QGtk::gtk_notebook_new()); - add_widget(QGtk::gtk_progress_bar_new()); - add_widget(QGtk::gtk_spin_button_new((GtkAdjustment*) - (QGtk::gtk_adjustment_new(1, 0, 1, 0, 0, 0)), 0.1, 3)); - GtkWidget *toolbar = QGtk::gtk_toolbar_new(); - g_signal_connect (toolbar, "notify::toolbar-style", G_CALLBACK (update_toolbar_style), toolbar); - QGtk::gtk_toolbar_insert((GtkToolbar*)toolbar, QGtk::gtk_separator_tool_item_new(), -1); - add_widget(toolbar); - init_gtk_treeview(); - add_widget(QGtk::gtk_vscale_new((GtkAdjustment*)(QGtk::gtk_adjustment_new(1, 0, 1, 0, 0, 0)))); - add_widget(QGtk::gtk_vscrollbar_new(NULL)); - } - else // Rebuild map - { - // When styles change subwidgets can get rearranged - // as with the combo box. We need to update the widget map - // to reflect this; - QHash<QString, GtkWidget*> oldMap = *gtkWidgetMap(); - gtkWidgetMap()->clear(); - QHashIterator<QString, GtkWidget*> it(oldMap); - while (it.hasNext()) { - it.next(); - if (!it.key().contains(QLatin1Char('.'))) { - add_all_sub_widgets(it.value()); - } - } - } - } -} - -// ----------- Native file dialogs ----------- - -// Extract filter list from expressions of type: foo (*.a *.b *.c)" -static QStringList extract_filter(const QString &rawFilter) -{ - QString result = rawFilter; - QRegExp r(QString::fromLatin1("^([^()]*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$")); - int index = r.indexIn(result); - if (index >= 0) - result = r.cap(2); - return result.split(QLatin1Char(' ')); -} - -extern QStringList qt_make_filter_list(const QString &filter); - -static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent, - const QString &dir, const QString &filter, QString *selectedFilter, - QFileDialog::Options options, bool isSaveDialog = false, - QMap<GtkFileFilter *, QString> *filterMap = 0) -{ - g_object_set(gtkFileChooser, "do-overwrite-confirmation", gboolean(!(options & QFileDialog::DontConfirmOverwrite)), NULL); - g_object_set(gtkFileChooser, "local_only", gboolean(true), NULL); - if (!filter.isEmpty()) { - QStringList filters = qt_make_filter_list(filter); - foreach (const QString &rawfilter, filters) { - GtkFileFilter *gtkFilter = QGtk::gtk_file_filter_new (); - QString name = rawfilter.left(rawfilter.indexOf(QLatin1Char('('))); - QStringList extensions = extract_filter(rawfilter); - QGtk::gtk_file_filter_set_name(gtkFilter, qPrintable(name.isEmpty() ? extensions.join(QLS(", ")) : name)); - - foreach (const QString &fileExtension, extensions) { - // Note Gtk file dialogs are by default case sensitive - // and only supports basic glob syntax so we - // rewrite .xyz to .[xX][yY][zZ] - QString caseInsensitive; - for (int i = 0 ; i < fileExtension.length() ; ++i) { - QChar ch = fileExtension.at(i); - if (ch.isLetter()) { - caseInsensitive.append( - QLatin1Char('[') + - ch.toLower() + - ch.toUpper() + - QLatin1Char(']')); - } else { - caseInsensitive.append(ch); - } - } - QGtk::gtk_file_filter_add_pattern (gtkFilter, qPrintable(caseInsensitive)); - - } - if (filterMap) - filterMap->insert(gtkFilter, rawfilter); - QGtk::gtk_file_chooser_add_filter((GtkFileChooser*)gtkFileChooser, gtkFilter); - if (selectedFilter && (rawfilter == *selectedFilter)) - QGtk::gtk_file_chooser_set_filter((GtkFileChooser*)gtkFileChooser, gtkFilter); - } - } - - // Using the currently active window is not entirely correct, however - // it gives more sensible behavior for applications that do not provide a - // parent - QWidget *modalFor = parent ? parent->window() : qApp->activeWindow(); - if (modalFor) { - QGtk::gtk_widget_realize(gtkFileChooser); // Creates X window - XSetTransientForHint(QGtk::gdk_x11_drawable_get_xdisplay(gtkFileChooser->window), - QGtk::gdk_x11_drawable_get_xid(gtkFileChooser->window), - modalFor->winId()); - QGtk::gdk_x11_window_set_user_time (gtkFileChooser->window, QX11Info::appUserTime()); - - } - - QFileInfo fileinfo(dir); - if (dir.isEmpty()) - fileinfo.setFile(QDir::currentPath()); - fileinfo.makeAbsolute(); - if (fileinfo.isDir()) { - QGtk::gtk_file_chooser_set_current_folder((GtkFileChooser*)gtkFileChooser, qPrintable(dir)); - } else if (isSaveDialog) { - QGtk::gtk_file_chooser_set_current_folder((GtkFileChooser*)gtkFileChooser, qPrintable(fileinfo.absolutePath())); - QGtk::gtk_file_chooser_set_current_name((GtkFileChooser*)gtkFileChooser, qPrintable(fileinfo.fileName())); - } else { - QGtk::gtk_file_chooser_set_filename((GtkFileChooser*)gtkFileChooser, qPrintable(dir)); - } -} - -QString QGtk::openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, - QString *selectedFilter, QFileDialog::Options options) -{ - QMap<GtkFileFilter *, QString> filterMap; - GtkWidget *gtkFileChooser = QGtk::gtk_file_chooser_dialog_new (qPrintable(caption), - NULL, - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, - NULL); - - setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, false, &filterMap); - - QWidget modal_widget; - modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); - modal_widget.setParent(parent, Qt::Window); - QApplicationPrivate::enterModal(&modal_widget); - - QString filename; - if (QGtk::gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) { - char *gtk_filename = QGtk::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser); - filename = QString::fromUtf8(gtk_filename); - g_free (gtk_filename); - if (selectedFilter) { - GtkFileFilter *gtkFilter = QGtk::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser); - *selectedFilter = filterMap.value(gtkFilter); - } - } - - QApplicationPrivate::leaveModal(&modal_widget); - gtk_widget_destroy (gtkFileChooser); - return filename; -} - - -QString QGtk::openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options) -{ - QMap<GtkFileFilter *, QString> filterMap; - GtkWidget *gtkFileChooser = QGtk::gtk_file_chooser_dialog_new (qPrintable(caption), - NULL, - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, - NULL); - - setupGtkFileChooser(gtkFileChooser, parent, dir, QString(), 0, options); - QWidget modal_widget; - modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); - modal_widget.setParent(parent, Qt::Window); - QApplicationPrivate::enterModal(&modal_widget); - - QString filename; - if (QGtk::gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) { - char *gtk_filename = QGtk::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser); - filename = QString::fromUtf8(gtk_filename); - g_free (gtk_filename); - } - - QApplicationPrivate::leaveModal(&modal_widget); - gtk_widget_destroy (gtkFileChooser); - return filename; -} - -QStringList QGtk::openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, - QString *selectedFilter, QFileDialog::Options options) -{ - QStringList filenames; - QMap<GtkFileFilter *, QString> filterMap; - GtkWidget *gtkFileChooser = QGtk::gtk_file_chooser_dialog_new (qPrintable(caption), - NULL, - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, - NULL); - - setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, false, &filterMap); - g_object_set(gtkFileChooser, "select-multiple", gboolean(true), NULL); - - QWidget modal_widget; - modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); - modal_widget.setParent(parent, Qt::Window); - QApplicationPrivate::enterModal(&modal_widget); - - if (gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) { - GSList *gtk_file_names = QGtk::gtk_file_chooser_get_filenames((GtkFileChooser*)gtkFileChooser); - for (GSList *iterator = gtk_file_names ; iterator; iterator = iterator->next) - filenames << QString::fromUtf8((const char*)iterator->data); - g_slist_free(gtk_file_names); - if (selectedFilter) { - GtkFileFilter *gtkFilter = QGtk::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser); - *selectedFilter = filterMap.value(gtkFilter); - } - } - - QApplicationPrivate::leaveModal(&modal_widget); - gtk_widget_destroy (gtkFileChooser); - return filenames; -} - -QString QGtk::saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, - QString *selectedFilter, QFileDialog::Options options) -{ - QMap<GtkFileFilter *, QString> filterMap; - GtkWidget *gtkFileChooser = QGtk::gtk_file_chooser_dialog_new (qPrintable(caption), - NULL, - GTK_FILE_CHOOSER_ACTION_SAVE, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, - NULL); - setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, true, &filterMap); - - QWidget modal_widget; - modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); - modal_widget.setParent(parent, Qt::Window); - QApplicationPrivate::enterModal(&modal_widget); - - QString filename; - if (QGtk::gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) { - char *gtk_filename = QGtk::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser); - filename = QString::fromUtf8(gtk_filename); - g_free (gtk_filename); - if (selectedFilter) { - GtkFileFilter *gtkFilter = QGtk::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser); - *selectedFilter = filterMap.value(gtkFilter); - } - } - - QApplicationPrivate::leaveModal(&modal_widget); - gtk_widget_destroy (gtkFileChooser); - return filename; -} - -QIcon QGtk::getFilesystemIcon(const QFileInfo &info) -{ - QIcon icon; - if (QGtk::gnome_vfs_init && QGtk::gnome_icon_lookup_sync) { - QGtk::gnome_vfs_init(); - GtkIconTheme *theme = QGtk::gtk_icon_theme_get_default(); - QByteArray fileurl = QUrl::fromLocalFile(info.absoluteFilePath()).toEncoded(); - char * icon_name = QGtk::gnome_icon_lookup_sync(theme, - NULL, - fileurl.data(), - NULL, - GNOME_ICON_LOOKUP_FLAGS_NONE, - NULL); - QString iconName = QString::fromUtf8(icon_name); - g_free(icon_name); - if (iconName.startsWith(QLatin1Char('/'))) - return QIcon(iconName); - return QIcon::fromTheme(iconName); - } - return icon; -} - -QT_END_NAMESPACE - -#endif // !defined(QT_NO_STYLE_GTK) diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index fc12cfe..973e682 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -3825,6 +3825,7 @@ QSize QCleanlooksStyle::sizeFromContents(ContentsType type, const QStyleOption * } } break; +#ifndef QT_NO_GROUPBOX case CT_GroupBox: // Since we use a bold font we have to recalculate base width if (const QGroupBox *gb = qobject_cast<const QGroupBox*>(widget)) { @@ -3840,6 +3841,7 @@ QSize QCleanlooksStyle::sizeFromContents(ContentsType type, const QStyleOption * } newSize += QSize(0, 1); break; +#endif //QT_NO_GROUPBOX case CT_RadioButton: case CT_CheckBox: newSize += QSize(0, 1); diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index fbd461f..bf2f68e 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5169,13 +5169,12 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option, const QWidget *widget) const { + const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft()); #ifdef QT_NO_IMAGEFORMAT_PNG - Q_UNUSED(option); Q_UNUSED(widget); Q_UNUSED(sp); #else QPixmap pixmap; - const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft()); if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { switch (sp) { diff --git a/src/gui/styles/qcommonstyle_p.h b/src/gui/styles/qcommonstyle_p.h index a905601..6122f81 100644 --- a/src/gui/styles/qcommonstyle_p.h +++ b/src/gui/styles/qcommonstyle_p.h @@ -62,25 +62,6 @@ QT_BEGIN_NAMESPACE class QStringList; -#ifdef Q_WS_X11 -class QIconTheme -{ -public: - QIconTheme(QHash <int, QString> dirList, QStringList parents) : - _dirList(dirList), _parents(parents), _valid(true){ } - QIconTheme() : _valid(false){ } - - QHash <int, QString> dirList() {return _dirList;} - QStringList parents() {return _parents;} - bool isValid() {return _valid;} - -private: - QHash <int, QString> _dirList; - QStringList _parents; - bool _valid; -}; -#endif - // Private class class QCommonStylePrivate : public QStylePrivate { diff --git a/src/gui/styles/qgtkpainter.cpp b/src/gui/styles/qgtkpainter.cpp index 05c5804..aaa029a 100644 --- a/src/gui/styles/qgtkpainter.cpp +++ b/src/gui/styles/qgtkpainter.cpp @@ -108,41 +108,41 @@ QPixmap QGtkPainter::renderTheme(uchar *bdata, uchar *wdata, const QRect &rect) return; \ QRect pixmapRect(0, 0, rect.width(), rect.height()); \ { \ - GdkPixmap *pixmap = QGtk::gdk_pixmap_new((GdkDrawable*)(m_window->window), \ + GdkPixmap *pixmap = QGtkStylePrivate::gdk_pixmap_new((GdkDrawable*)(m_window->window), \ rect.width(), rect.height(), -1); \ if (!pixmap) \ return; \ - style = QGtk::gtk_style_attach (style, m_window->window); \ - QGtk::gdk_draw_rectangle(pixmap, m_alpha ? style->black_gc : *style->bg_gc, true, \ + style = QGtkStylePrivate::gtk_style_attach (style, m_window->window); \ + QGtkStylePrivate::gdk_draw_rectangle(pixmap, m_alpha ? style->black_gc : *style->bg_gc, true, \ 0, 0, rect.width(), rect.height()); \ draw_func; \ - GdkPixbuf *imgb = QGtk::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.width(), rect.height());\ + GdkPixbuf *imgb = QGtkStylePrivate::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.width(), rect.height());\ if (!imgb) \ return; \ - imgb = QGtk::gdk_pixbuf_get_from_drawable(imgb, pixmap, NULL, 0, 0, 0, 0, \ + imgb = QGtkStylePrivate::gdk_pixbuf_get_from_drawable(imgb, pixmap, NULL, 0, 0, 0, 0, \ rect.width(), rect.height()); \ - uchar* bdata = (uchar*)QGtk::gdk_pixbuf_get_pixels(imgb); \ + uchar* bdata = (uchar*)QGtkStylePrivate::gdk_pixbuf_get_pixels(imgb); \ if (m_alpha) { \ - QGtk::gdk_draw_rectangle(pixmap, style->white_gc, true, 0, 0, rect.width(), rect.height()); \ + QGtkStylePrivate::gdk_draw_rectangle(pixmap, style->white_gc, true, 0, 0, rect.width(), rect.height()); \ draw_func; \ - GdkPixbuf *imgw = QGtk::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect. \ + GdkPixbuf *imgw = QGtkStylePrivate::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect. \ width(), rect.height()); \ if (!imgw) \ return; \ - imgw = QGtk::gdk_pixbuf_get_from_drawable(imgw, pixmap, NULL, 0, 0, 0, 0, \ + imgw = QGtkStylePrivate::gdk_pixbuf_get_from_drawable(imgw, pixmap, NULL, 0, 0, 0, 0, \ rect.width(), rect.height()); \ - uchar* wdata = (uchar*)QGtk::gdk_pixbuf_get_pixels(imgw); \ + uchar* wdata = (uchar*)QGtkStylePrivate::gdk_pixbuf_get_pixels(imgw); \ cache = renderTheme(bdata, wdata, rect); \ - QGtk::gdk_pixbuf_unref(imgw); \ + QGtkStylePrivate::gdk_pixbuf_unref(imgw); \ } else { \ cache = renderTheme(bdata, 0, rect); \ } \ - QGtk::gdk_drawable_unref(pixmap); \ - QGtk::gdk_pixbuf_unref(imgb); \ + QGtkStylePrivate::gdk_drawable_unref(pixmap); \ + QGtkStylePrivate::gdk_pixbuf_unref(imgb); \ } QGtkPainter::QGtkPainter(QPainter *_painter) - : m_window(QGtk::gtkWidget(QLatin1String("GtkWindow"))) + : m_window(QGtkStylePrivate::gtkWidget(QLatin1String("GtkWindow"))) , m_painter(_painter) , m_alpha(true) , m_hflipped(false) @@ -185,18 +185,18 @@ GtkStyle* QGtkPainter::getStyle(GtkWidget *gtkWidget) QPixmap QGtkPainter::getIcon(const char* iconName, GtkIconSize size) { - GtkStyle *style = QGtk::gtkStyle(); - GtkIconSet* iconSet = QGtk::gtk_icon_factory_lookup_default (iconName); - GdkPixbuf* icon = QGtk::gtk_icon_set_render_icon(iconSet, + GtkStyle *style = QGtkStylePrivate::gtkStyle(); + GtkIconSet* iconSet = QGtkStylePrivate::gtk_icon_factory_lookup_default (iconName); + GdkPixbuf* icon = QGtkStylePrivate::gtk_icon_set_render_icon(iconSet, style, GTK_TEXT_DIR_LTR, GTK_STATE_NORMAL, size, NULL, "button"); - uchar* data = (uchar*)QGtk::gdk_pixbuf_get_pixels(icon); - int width = QGtk::gdk_pixbuf_get_width(icon); - int height = QGtk::gdk_pixbuf_get_height(icon); + uchar* data = (uchar*)QGtkStylePrivate::gdk_pixbuf_get_pixels(icon); + int width = QGtkStylePrivate::gdk_pixbuf_get_width(icon); + int height = QGtkStylePrivate::gdk_pixbuf_get_height(icon); QImage converted(width, height, QImage::Format_ARGB32); uchar* tdata = (uchar*)converted.bits(); @@ -208,7 +208,7 @@ QPixmap QGtkPainter::getIcon(const char* iconName, GtkIconSize size) tdata[index + QT_ALPHA] = data[index + GTK_ALPHA]; } - QGtk::gdk_pixbuf_unref(icon); + QGtkStylePrivate::gdk_pixbuf_unref(icon); // should we free iconset? return QPixmap::fromImage(converted); @@ -240,7 +240,7 @@ void QGtkPainter::paintBoxGap(GtkWidget *gtkWidget, const gchar* part, QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + gapExtras; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_box_gap (style, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_box_gap (style, pixmap, state, shadow, @@ -305,7 +305,7 @@ void QGtkPainter::paintBox(GtkWidget *gtkWidget, const gchar* part, rect.size(), gtkWidget) + pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_box (style, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_box (style, pixmap, state, shadow, @@ -356,7 +356,7 @@ void QGtkPainter::paintHline(GtkWidget *gtkWidget, const gchar* part, QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) + hLineExtras + pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_hline (style, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_hline (style, pixmap, state, NULL, @@ -383,7 +383,7 @@ void QGtkPainter::paintVline(GtkWidget *gtkWidget, const gchar* part, QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) + vLineExtras +pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_vline (style, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_vline (style, pixmap, state, NULL, @@ -410,7 +410,7 @@ void QGtkPainter::paintExpander(GtkWidget *gtkWidget, QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) + QString::number(expander_state) + pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_expander (style, pixmap, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_expander (style, pixmap, state, NULL, gtkWidget, part, rect.width()/2, @@ -433,7 +433,7 @@ void QGtkPainter::paintFocus(GtkWidget *gtkWidget, const gchar* part, QPixmap cache; QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) + pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_focus (style, pixmap, state, NULL, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_focus (style, pixmap, state, NULL, gtkWidget, part, 0, 0, @@ -458,7 +458,7 @@ void QGtkPainter::paintResizeGrip(GtkWidget *gtkWidget, const gchar* part, QPixmap cache; QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_resize_grip (style, pixmap, state, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_resize_grip (style, pixmap, state, NULL, gtkWidget, part, edge, 0, 0, rect.width(), @@ -488,7 +488,7 @@ void QGtkPainter::paintArrow(GtkWidget *gtkWidget, const gchar* part, int xOffset = m_cliprect.isValid() ? arrowrect.x() - m_cliprect.x() : 0; int yOffset = m_cliprect.isValid() ? arrowrect.y() - m_cliprect.y() : 0; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_arrow (style, pixmap, state, shadow, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_arrow (style, pixmap, state, shadow, >kCliprect, gtkWidget, part, @@ -515,7 +515,7 @@ void QGtkPainter::paintHandle(GtkWidget *gtkWidget, const gchar* part, const QRe QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + QString::number(orientation); if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_handle (style, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_handle (style, pixmap, state, shadow, @@ -543,7 +543,7 @@ void QGtkPainter::paintSlider(GtkWidget *gtkWidget, const gchar* part, const QRe QPixmap cache; QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_slider (style, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_slider (style, pixmap, state, shadow, @@ -574,7 +574,7 @@ void QGtkPainter::paintShadow(GtkWidget *gtkWidget, const gchar* part, QPixmap cache; QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_shadow(style, pixmap, state, shadow, NULL, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_shadow(style, pixmap, state, shadow, NULL, gtkWidget, part, 0, 0, rect.width(), rect.height())); if (m_usePixmapCache) QPixmapCache::insert(pixmapName, cache); @@ -593,7 +593,7 @@ void QGtkPainter::paintFlatBox(GtkWidget *gtkWidget, const gchar* part, QPixmap cache; QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_flat_box (style, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_flat_box (style, pixmap, state, shadow, @@ -622,7 +622,7 @@ void QGtkPainter::paintExtention(GtkWidget *gtkWidget, pixmapName += QString::number(gap_pos); if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_extension (style, pixmap, state, shadow, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_extension (style, pixmap, state, shadow, NULL, gtkWidget, (gchar*)part, 0, 0, rect.width(), @@ -651,7 +651,7 @@ void QGtkPainter::paintOption(GtkWidget *gtkWidget, const QRect &radiorect, int xOffset = m_cliprect.isValid() ? radiorect.x() - m_cliprect.x() : 0; int yOffset = m_cliprect.isValid() ? radiorect.y() - m_cliprect.y() : 0; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_option(style, pixmap, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_option(style, pixmap, state, shadow, >kCliprect, gtkWidget, @@ -683,7 +683,7 @@ void QGtkPainter::paintCheckbox(GtkWidget *gtkWidget, const QRect &checkrect, int xOffset = m_cliprect.isValid() ? checkrect.x() - m_cliprect.x() : 0; int yOffset = m_cliprect.isValid() ? checkrect.y() - m_cliprect.y() : 0; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { - DRAW_TO_CACHE(QGtk::gtk_paint_check (style, + DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_check (style, pixmap, state, shadow, diff --git a/src/gui/styles/qgtkpainter_p.h b/src/gui/styles/qgtkpainter_p.h index 0e8ffe2..cbc96c0 100644 --- a/src/gui/styles/qgtkpainter_p.h +++ b/src/gui/styles/qgtkpainter_p.h @@ -56,11 +56,11 @@ #include <QtCore/qglobal.h> #if !defined(QT_NO_STYLE_GTK) -#include "gtksymbols_p.h" #include <QtGui/QCleanlooksStyle> #include <QtGui/QPainter> #include <QtGui/QPalette> #include <QtGui/QFont> +#include <private/qgtkstyle_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index ab0ab3a..1c78a47 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -69,28 +69,14 @@ #include <QtGui/QTreeView> #include <qpixmapcache.h> #undef signals // Collides with GTK stymbols -#include "qgtkpainter_p.h" -#include "qstylehelper_p.h" - +#include <private/qgtkpainter_p.h> +#include <private/qstylehelper_p.h> +#include <private/qgtkstyle_p.h> #include <private/qcleanlooksstyle_p.h> QT_BEGIN_NAMESPACE -typedef QStringList (*_qt_filedialog_open_filenames_hook)(QWidget * parent, const QString &caption, const QString &dir, - const QString &filter, QString *selectedFilter, QFileDialog::Options options); -typedef QString (*_qt_filedialog_open_filename_hook) (QWidget * parent, const QString &caption, const QString &dir, - const QString &filter, QString *selectedFilter, QFileDialog::Options options); -typedef QString (*_qt_filedialog_save_filename_hook) (QWidget * parent, const QString &caption, const QString &dir, - const QString &filter, QString *selectedFilter, QFileDialog::Options options); -typedef QString (*_qt_filedialog_existing_directory_hook)(QWidget *parent, const QString &caption, const QString &dir, - QFileDialog::Options options); - -extern Q_GUI_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook; -extern Q_GUI_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook; -extern Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook; -extern Q_GUI_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook; - static const char * const dock_widget_close_xpm[] = { "11 13 5 1", @@ -137,57 +123,18 @@ static const char * const dock_widget_restore_xpm[] = " " }; - -class QGtkStyleFilter : public QObject -{ -public: - QGtkStyleFilter() {} -private: - bool eventFilter(QObject *obj, QEvent *e); -}; - -bool QGtkStyleFilter::eventFilter(QObject *obj, QEvent *e) -{ - if (e->type() == QEvent::ApplicationPaletteChange) { - // Only do this the first time since this will also - // generate applicationPaletteChange events - if (!qt_app_palettes_hash() || qt_app_palettes_hash()->isEmpty()) { - QGtk::applyCustomPaletteHash(); - } - } - return QObject::eventFilter(obj, e); -} - -class QGtkStylePrivate : public QCleanlooksStylePrivate -{ - Q_DECLARE_PUBLIC(QGtkStyle) -public: - QGtkStylePrivate() - : QCleanlooksStylePrivate() - { - QGtk::initGtkWidgets(); - if (QGtk::isThemeAvailable()) - qApp->installEventFilter(&filter); - - } - QGtkStyleFilter filter; -}; - static const int groupBoxBottomMargin = 2; // space below the groupbox static const int groupBoxTitleMargin = 6; // space between contents and title static const int groupBoxTopMargin = 2; -// Get size of the arrow controls in a GtkSpinButton -static int spinboxArrowSize() +QString QGtkStyle::getGConfString(const QString &value, const QString &fallback) { - const int MIN_ARROW_WIDTH = 6; - GtkWidget *spinButton = QGtk::gtkWidget(QLS("GtkSpinButton")); - GtkStyle *style = spinButton->style; - gint size = QGtk::pango_font_description_get_size (style->font_desc); - gint arrow_size; - arrow_size = qMax(PANGO_PIXELS (size), MIN_ARROW_WIDTH) + style->xthickness; - arrow_size += arrow_size%2 + 1; - return arrow_size; + return QGtkStylePrivate::getGConfString(value, fallback); +} + +bool QGtkStyle::getGConfBool(const QString &key, bool fallback) +{ + return QGtkStylePrivate::getGConfBool(key, fallback); } static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50) @@ -233,8 +180,23 @@ static GdkColor fromQColor(const QColor &color) QGtkStyle::QGtkStyle() : QCleanlooksStyle(*new QGtkStylePrivate) { + Q_D(QGtkStyle); + d->init(); +} + +/*! + \internal + + Constructs a QGtkStyle object. +*/ +QGtkStyle::QGtkStyle(QGtkStylePrivate &dd) + : QCleanlooksStyle(dd) +{ + Q_D(QGtkStyle); + d->init(); } + /*! Destroys the QGtkStyle object. */ @@ -247,11 +209,13 @@ QGtkStyle::~QGtkStyle() */ QPalette QGtkStyle::standardPalette() const { + Q_D(const QGtkStyle); + QPalette palette = QCleanlooksStyle::standardPalette(); - if (QGtk::isThemeAvailable()) { - GtkStyle *style = QGtk::gtkStyle(); - GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton")); - GtkWidget *gtkEntry = QGtk::gtkWidget(QLS("GtkEntry")); + if (d->isThemeAvailable()) { + GtkStyle *style = d->gtkStyle(); + GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); + GtkWidget *gtkEntry = d->getTextColorWidget(); GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg; QColor bg, base, text, fg, highlight, highlightText; @@ -281,12 +245,12 @@ QPalette QGtkStyle::standardPalette() const palette.setColor(QPalette::Base, base); QColor alternateRowColor = palette.base().color().lighter(93); // ref gtkstyle.c draw_flat_box - GtkWidget *gtkTreeView = QGtk::gtkWidget(QLS("GtkTreeView")); + GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView")); GdkColor *gtkAltBase = NULL; - QGtk::gtk_widget_style_get(gtkTreeView, "odd-row-color", >kAltBase, NULL); + d->gtk_widget_style_get(gtkTreeView, "odd-row-color", >kAltBase, NULL); if (gtkAltBase) { alternateRowColor = QColor(gtkAltBase->red>>8, gtkAltBase->green>>8, gtkAltBase->blue>>8); - QGtk::gdk_color_free(gtkAltBase); + d->gdk_color_free(gtkAltBase); } palette.setColor(QPalette::AlternateBase, alternateRowColor); @@ -306,7 +270,8 @@ QPalette QGtkStyle::standardPalette() const highlightText.setHsv(highlightText.hue(), 0, highlightText.value(), highlightText.alpha()); palette.setColor(QPalette::Disabled, QPalette::Highlight, highlight); palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highlightText); - style = QGtk::gtk_rc_get_style_by_paths(QGtk::gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", Q_GTK_TYPE_WINDOW); + style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", + d->gtk_window_get_type()); if (style) { gdkText = style->fg[GTK_STATE_NORMAL]; text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); @@ -321,10 +286,12 @@ QPalette QGtkStyle::standardPalette() const */ void QGtkStyle::polish(QPalette &palette) { + Q_D(QGtkStyle); + // QCleanlooksStyle will alter the palette, hence we do // not want to polish the palette unless we are using it as // the fallback - if (!QGtk::isThemeAvailable()) + if (!d->isThemeAvailable()) QCleanlooksStyle::polish(palette); else palette = palette.resolve(standardPalette()); @@ -335,19 +302,21 @@ void QGtkStyle::polish(QPalette &palette) */ void QGtkStyle::polish(QApplication *app) { + Q_D(QGtkStyle); + QCleanlooksStyle::polish(app); // Custom fonts and palettes with QtConfig are intentionally // not supported as these should be entirely determined by // current Gtk settings - if (app->desktopSettingsAware() && QGtk::isThemeAvailable()) { + if (app->desktopSettingsAware() && d->isThemeAvailable()) { QApplicationPrivate::setSystemPalette(standardPalette()); - QApplicationPrivate::setSystemFont(QGtk::getThemeFont()); - QGtk::applyCustomPaletteHash(); - if (!QGtk::isKDE4Session()) { - qt_filedialog_open_filename_hook = &QGtk::openFilename; - qt_filedialog_save_filename_hook = &QGtk::saveFilename; - qt_filedialog_open_filenames_hook = &QGtk::openFilenames; - qt_filedialog_existing_directory_hook = &QGtk::openDirectory; + QApplicationPrivate::setSystemFont(d->getThemeFont()); + d->applyCustomPaletteHash(); + if (!d->isKDE4Session()) { + qt_filedialog_open_filename_hook = &QGtkStylePrivate::openFilename; + qt_filedialog_save_filename_hook = &QGtkStylePrivate::saveFilename; + qt_filedialog_open_filenames_hook = &QGtkStylePrivate::openFilenames; + qt_filedialog_existing_directory_hook = &QGtkStylePrivate::openDirectory; } } } @@ -357,11 +326,13 @@ void QGtkStyle::polish(QApplication *app) */ void QGtkStyle::unpolish(QApplication *app) { + Q_D(QGtkStyle); + QCleanlooksStyle::unpolish(app); QPixmapCache::clear(); - if (app->desktopSettingsAware() && QGtk::isThemeAvailable() - && !QGtk::isKDE4Session()) { + if (app->desktopSettingsAware() && d->isThemeAvailable() + && !d->isKDE4Session()) { qt_filedialog_open_filename_hook = 0; qt_filedialog_save_filename_hook = 0; qt_filedialog_open_filenames_hook = 0; @@ -375,8 +346,10 @@ void QGtkStyle::unpolish(QApplication *app) void QGtkStyle::polish(QWidget *widget) { + Q_D(QGtkStyle); + QCleanlooksStyle::polish(widget); - if (!QGtk::isThemeAvailable()) + if (!d->isThemeAvailable()) return; if (qobject_cast<QAbstractButton*>(widget) || qobject_cast<QToolButton*>(widget) @@ -404,21 +377,22 @@ void QGtkStyle::unpolish(QWidget *widget) \reimp */ int QGtkStyle::pixelMetric(PixelMetric metric, - const QStyleOption *option, const QWidget *widget) const { - if (!QGtk::isThemeAvailable()) + Q_D(const QGtkStyle); + + if (!d->isThemeAvailable()) return QCleanlooksStyle::pixelMetric(metric, option, widget); switch (metric) { case PM_DefaultFrameWidth: if (qobject_cast<const QFrame*>(widget)) { if (GtkStyle *style = - QGtk::gtk_rc_get_style_by_paths(QGtk::gtk_settings_get_default(), + d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "*.GtkScrolledWindow", "*.GtkScrolledWindow", - Q_GTK_TYPE_WINDOW)) + d->gtk_window_get_type())) return qMax(style->xthickness, style->ythickness); } return 2; @@ -439,16 +413,16 @@ int QGtkStyle::pixelMetric(PixelMetric metric, return 0; case PM_ButtonShiftHorizontal: { - GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); guint horizontal_shift; - QGtk::gtk_widget_style_get(gtkButton, "child-displacement-x", &horizontal_shift, NULL); + d->gtk_widget_style_get(gtkButton, "child-displacement-x", &horizontal_shift, NULL); return horizontal_shift; } case PM_ButtonShiftVertical: { - GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); guint vertical_shift; - QGtk::gtk_widget_style_get(gtkButton, "child-displacement-y", &vertical_shift, NULL); + d->gtk_widget_style_get(gtkButton, "child-displacement-y", &vertical_shift, NULL); return vertical_shift; } @@ -456,18 +430,18 @@ int QGtkStyle::pixelMetric(PixelMetric metric, return 0; case PM_MenuPanelWidth: { - GtkWidget *gtkMenu = QGtk::gtkWidget(QLS("GtkMenu")); + GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu")); guint horizontal_padding = 0; // horizontal-padding is used by Maemo to get thicker borders - if (!QGtk::gtk_check_version(2, 10, 0)) - QGtk::gtk_widget_style_get(gtkMenu, "horizontal-padding", &horizontal_padding, NULL); + if (!d->gtk_check_version(2, 10, 0)) + d->gtk_widget_style_get(gtkMenu, "horizontal-padding", &horizontal_padding, NULL); int padding = qMax<int>(gtkMenu->style->xthickness, horizontal_padding); return padding; } case PM_ButtonIconSize: { int retVal = 24; - GtkSettings *settings = QGtk::gtk_settings_get_default(); + GtkSettings *settings = d->gtk_settings_get_default(); gchararray icon_sizes; g_object_get(settings, "gtk-icon-sizes", &icon_sizes, NULL); QStringList values = QString(QLS(icon_sizes)).split(QLatin1Char(':')); @@ -513,9 +487,9 @@ int QGtkStyle::pixelMetric(PixelMetric metric, case PM_SliderThickness: case PM_SliderControlThickness: { - GtkWidget *gtkScale = QGtk::gtkWidget(QLS("GtkHScale")); + GtkWidget *gtkScale = d->gtkWidget(QLS("GtkHScale")); gint val; - QGtk::gtk_widget_style_get(gtkScale, "slider-width", &val, NULL); + d->gtk_widget_style_get(gtkScale, "slider-width", &val, NULL); if (metric == PM_SliderControlThickness) return val + 2*gtkScale->style->ythickness; return val; @@ -524,8 +498,8 @@ int QGtkStyle::pixelMetric(PixelMetric metric, case PM_ScrollBarExtent: { gint sliderLength; gint trough_border; - GtkWidget *hScrollbar = QGtk::gtkWidget(QLS("GtkHScrollbar")); - QGtk::gtk_widget_style_get(hScrollbar, + GtkWidget *hScrollbar = d->gtkWidget(QLS("GtkHScrollbar")); + d->gtk_widget_style_get(hScrollbar, "trough-border", &trough_border, "slider-width", &sliderLength, NULL); @@ -537,35 +511,35 @@ int QGtkStyle::pixelMetric(PixelMetric metric, case PM_SliderLength: gint val; - QGtk::gtk_widget_style_get(QGtk::gtkWidget(QLS("GtkHScale")), "slider-length", &val, NULL); + d->gtk_widget_style_get(d->gtkWidget(QLS("GtkHScale")), "slider-length", &val, NULL); return val; case PM_ExclusiveIndicatorWidth: case PM_ExclusiveIndicatorHeight: case PM_IndicatorWidth: case PM_IndicatorHeight: { - GtkWidget *gtkCheckButton = QGtk::gtkWidget(QLS("GtkCheckButton")); + GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton")); gint size, spacing; - QGtk::gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, "indicator-size", &size, NULL); + d->gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, "indicator-size", &size, NULL); return size + 2 * spacing; } case PM_MenuBarVMargin: { - GtkWidget *gtkMenubar = QGtk::gtkWidget(QLS("GtkMenuBar")); + GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar")); return qMax(0, gtkMenubar->style->ythickness); } case PM_ScrollView_ScrollBarSpacing: { gint spacing = 3; - GtkWidget *gtkScrollWindow = QGtk::gtkWidget(QLS("GtkScrolledWindow")); + GtkWidget *gtkScrollWindow = d->gtkWidget(QLS("GtkScrolledWindow")); Q_ASSERT(gtkScrollWindow); - QGtk::gtk_widget_style_get(gtkScrollWindow, "scrollbar-spacing", &spacing, NULL); + d->gtk_widget_style_get(gtkScrollWindow, "scrollbar-spacing", &spacing, NULL); return spacing; } case PM_SubMenuOverlap: { gint offset = 0; - GtkWidget *gtkMenu = QGtk::gtkWidget(QLS("GtkMenu")); - QGtk::gtk_widget_style_get(gtkMenu, "horizontal-offset", &offset, NULL); + GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu")); + d->gtk_widget_style_get(gtkMenu, "horizontal-offset", &offset, NULL); return offset; } default: @@ -580,7 +554,9 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg QStyleHintReturn *returnData = 0) const { - if (!QGtk::isThemeAvailable()) + Q_D(const QGtkStyle); + + if (!d->isThemeAvailable()) return QCleanlooksStyle::styleHint(hint, option, widget, returnData); switch (hint) { @@ -588,7 +564,7 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg case SH_DialogButtonLayout: { int ret = QDialogButtonBox::GnomeLayout; gboolean alternateOrder = 0; - GtkSettings *settings = QGtk::gtk_settings_get_default(); + GtkSettings *settings = d->gtk_settings_get_default(); g_object_get(settings, "gtk-alternative-button-order", &alternateOrder, NULL); if (alternateOrder) @@ -601,9 +577,9 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg case SH_ToolButtonStyle: { - if (QGtk::isKDE4Session()) + if (d->isKDE4Session()) return QCleanlooksStyle::styleHint(hint, option, widget, returnData); - GtkWidget *gtkToolbar = QGtk::gtkWidget(QLS("GtkToolbar")); + GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar")); GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS; g_object_get(gtkToolbar, "toolbar-style", &toolbar_style, NULL); switch (toolbar_style) { @@ -626,9 +602,9 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg return int(false); case SH_ComboBox_Popup: { - GtkWidget *gtkComboBox = QGtk::gtkWidget(QLS("GtkComboBox")); + GtkWidget *gtkComboBox = d->gtkWidget(QLS("GtkComboBox")); gboolean appears_as_list; - QGtk::gtk_widget_style_get((GtkWidget*)gtkComboBox, "appears-as-list", &appears_as_list, NULL); + d->gtk_widget_style_get((GtkWidget*)gtkComboBox, "appears-as-list", &appears_as_list, NULL); return appears_as_list ? 0 : 1; } @@ -640,7 +616,7 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg case SH_Menu_SubMenuPopupDelay: { gint delay = 225; - GtkSettings *settings = QGtk::gtk_settings_get_default(); + GtkSettings *settings = d->gtk_settings_get_default(); g_object_get(settings, "gtk-menu-popup-delay", &delay, NULL); return delay; } @@ -649,15 +625,15 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg gboolean scrollbars_within_bevel = false; if (widget && widget->isWindow()) scrollbars_within_bevel = true; - else if (!QGtk::gtk_check_version(2, 12, 0)) { - GtkWidget *gtkScrollWindow = QGtk::gtkWidget(QLS("GtkScrolledWindow")); - QGtk::gtk_widget_style_get(gtkScrollWindow, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL); + else if (!d->gtk_check_version(2, 12, 0)) { + GtkWidget *gtkScrollWindow = d->gtkWidget(QLS("GtkScrolledWindow")); + d->gtk_widget_style_get(gtkScrollWindow, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL); } return !scrollbars_within_bevel; } case SH_DialogButtonBox_ButtonsHaveIcons: { - static bool buttonsHaveIcons = QGtk::getGConfBool(QLS("/desktop/gnome/interface/buttons_have_icons")); + static bool buttonsHaveIcons = d->getGConfBool(QLS("/desktop/gnome/interface/buttons_have_icons")); return buttonsHaveIcons; } @@ -670,17 +646,18 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg \reimp */ void QGtkStyle::drawPrimitive(PrimitiveElement element, - const QStyleOption *option, QPainter *painter, const QWidget *widget) const { - if (!QGtk::isThemeAvailable()) { + Q_D(const QGtkStyle); + + if (!d->isThemeAvailable()) { QCleanlooksStyle::drawPrimitive(element, option, painter, widget); return; } - GtkStyle* style = QGtk::gtkStyle(); + GtkStyle* style = d->gtkStyle(); QGtkPainter gtkPainter(painter); switch (element) { @@ -715,10 +692,10 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, else if (option->state & State_Raised) shadow_type = GTK_SHADOW_OUT; - GtkStyle *style = QGtk::gtk_rc_get_style_by_paths(QGtk::gtk_settings_get_default(), - "*.GtkScrolledWindow", "*.GtkScrolledWindow", Q_GTK_TYPE_WINDOW); + GtkStyle *style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), + "*.GtkScrolledWindow", "*.GtkScrolledWindow", d->gtk_window_get_type()); if (style) - gtkFramePainter.paintShadow(QGtk::gtkWidget(QLS("GtkFrame")), "viewport", pmRect, + gtkFramePainter.paintShadow(d->gtkWidget(QLS("GtkFrame")), "viewport", pmRect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, shadow_type, style); QPixmapCache::insert(pmKey, pixmap); @@ -745,8 +722,9 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, break; case PE_PanelTipLabel: { - GtkWidget *gtkWindow = QGtk::gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed - style = QGtk::gtk_rc_get_style_by_paths(QGtk::gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", Q_GTK_TYPE_WINDOW); + GtkWidget *gtkWindow = d->gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed + style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", + d->gtk_window_get_type()); gtkPainter.paintFlatBox(gtkWindow, "tooltip", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, style); } break; @@ -759,8 +737,8 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, break; } GtkShadowType shadow_type; - GtkWidget *gtkStatusbarFrame = QGtk::gtkWidget(QLS("GtkStatusbar.GtkFrame")); - QGtk::gtk_widget_style_get(gtkStatusbarFrame->parent, "shadow-type", &shadow_type, NULL); + GtkWidget *gtkStatusbarFrame = d->gtkWidget(QLS("GtkStatusbar.GtkFrame")); + d->gtk_widget_style_get(gtkStatusbarFrame->parent, "shadow-type", &shadow_type, NULL); gtkPainter.paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL, shadow_type, gtkStatusbarFrame->style); } @@ -768,7 +746,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, case PE_IndicatorHeaderArrow: if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { - GtkWidget *gtkTreeHeader = QGtk::gtkWidget(QLS("GtkTreeView.GtkButton")); + GtkWidget *gtkTreeHeader = d->gtkWidget(QLS("GtkTreeView.GtkButton")); GtkStateType state = gtkPainter.gtkState(option); style = gtkTreeHeader->style; GtkArrowType type = GTK_ARROW_UP; @@ -806,7 +784,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, rect.translate(2, 0); GtkExpanderStyle openState = GTK_EXPANDER_EXPANDED; GtkExpanderStyle closedState = GTK_EXPANDER_COLLAPSED; - GtkWidget *gtkTreeView = QGtk::gtkWidget(QLS("GtkTreeView")); + GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView")); GtkStateType state = GTK_STATE_NORMAL; if (!(option->state & State_Enabled)) @@ -842,7 +820,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, case PE_IndicatorToolBarSeparator: { const int margin = 6; - GtkWidget *gtkSeparator = QGtk::gtkWidget(QLS("GtkToolbar.GtkSeparatorToolItem")); + GtkWidget *gtkSeparator = d->gtkWidget(QLS("GtkToolbar.GtkSeparatorToolItem")); if (option->state & State_Horizontal) { const int offset = option->rect.width()/2; QRect rect = option->rect.adjusted(offset, margin, 0, -margin); @@ -862,9 +840,9 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, break; case PE_IndicatorToolBarHandle: { - GtkWidget *gtkToolbar = QGtk::gtkWidget(QLS("GtkToolbar")); + GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar")); GtkShadowType shadow_type; - QGtk::gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); + d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); //Note when the toolbar is horizontal, the handle is vertical painter->setClipRect(option->rect); gtkPainter.paintHandle(gtkToolbar, "toolbar", option->rect.adjusted(-1, -1 ,0 ,1), @@ -910,14 +888,14 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, GtkStateType state = gtkPainter.gtkState(option); QColor arrowColor = option->palette.buttonText().color(); - GtkWidget *gtkArrow = QGtk::gtkWidget(QLS("GtkArrow")); + GtkWidget *gtkArrow = d->gtkWidget(QLS("GtkArrow")); GdkColor color = fromQColor(arrowColor); - QGtk::gtk_widget_modify_fg (gtkArrow, state, &color); + d->gtk_widget_modify_fg (gtkArrow, state, &color); gtkPainter.paintArrow(gtkArrow, "button", arrowRect, type, state, shadow, FALSE, gtkArrow->style, QString::number(arrowColor.rgba(), 16)); // Passing NULL will revert the color change - QGtk::gtk_widget_modify_fg (gtkArrow, state, NULL); + d->gtk_widget_modify_fg (gtkArrow, state, NULL); } break; @@ -926,7 +904,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, break; case PE_PanelMenu: { - GtkWidget *gtkMenu = QGtk::gtkWidget(QLS("GtkMenu")); + GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu")); gtkPainter.setAlphaSupport(false); // Note, alpha disabled for performance reasons gtkPainter.paintBox(gtkMenu, "menu", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkMenu->style, QString()); } @@ -938,7 +916,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, // This is only used by floating tool bars if (qobject_cast<const QToolBar *>(widget)) { - GtkWidget *gtkMenubar = QGtk::gtkWidget(QLS("GtkMenuBar")); + GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar")); gtkPainter.paintBox( gtkMenubar, "toolbar", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style); gtkPainter.paintBox( gtkMenubar, "menu", option->rect, @@ -947,13 +925,13 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, break; case PE_FrameLineEdit: { - GtkWidget *gtkEntry = QGtk::gtkWidget(QLS("GtkEntry")); + GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry")); gboolean interior_focus; gint focus_line_width; QRect rect = option->rect; - QGtk::gtk_widget_style_get(gtkEntry, + d->gtk_widget_style_get(gtkEntry, "interior-focus", &interior_focus, "focus-line-width", &focus_line_width, NULL); @@ -981,7 +959,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, case PE_PanelLineEdit: if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) { - GtkWidget *gtkEntry = QGtk::gtkWidget(QLS("GtkEntry")); + GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry")); if (panel->lineWidth > 0) proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget); uint resolve_mask = option->palette.resolve(); @@ -999,13 +977,13 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, case PE_FrameTabWidget: if (const QStyleOptionTabWidgetFrame *frame = qstyleoption_cast<const QStyleOptionTabWidgetFrame*>(option)) { - GtkWidget *gtkNotebook = QGtk::gtkWidget(QLS("GtkNotebook")); + GtkWidget *gtkNotebook = d->gtkWidget(QLS("GtkNotebook")); style = gtkPainter.getStyle(gtkNotebook); gtkPainter.setAlphaSupport(false); GtkShadowType shadow = GTK_SHADOW_OUT; GtkStateType state = GTK_STATE_NORMAL; // Only state supported by gtknotebook bool reverse = (option->direction == Qt::RightToLeft); - QGtk::gtk_widget_set_direction(gtkNotebook, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); + QGtkStylePrivate::gtk_widget_set_direction(gtkNotebook, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); if (const QStyleOptionTabWidgetFrameV2 *tabframe = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2*>(option)) { GtkPositionType frameType = GTK_POS_TOP; QTabBar::Shape shape = frame->shape; @@ -1047,10 +1025,10 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, GtkStateType state = gtkPainter.gtkState(option); if (option->state & State_On || option->state & State_Sunken) state = GTK_STATE_ACTIVE; - GtkWidget *gtkButton = QGtk::gtkWidget(isTool ? QLS("GtkToolButton.GtkButton") : QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget(isTool ? QLS("GtkToolButton.GtkButton") : QLS("GtkButton")); gint focusWidth, focusPad; gboolean interiorFocus = false; - QGtk::gtk_widget_style_get (gtkButton, + d->gtk_widget_style_get (gtkButton, "focus-line-width", &focusWidth, "focus-padding", &focusPad, "interior-focus", &interiorFocus, NULL); @@ -1103,14 +1081,14 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, else shadow = GTK_SHADOW_OUT; - GtkWidget *gtkRadioButton = QGtk::gtkWidget(QLS("GtkRadioButton")); + GtkWidget *gtkRadioButton = d->gtkWidget(QLS("GtkRadioButton")); gint spacing; - QGtk::gtk_widget_style_get(gtkRadioButton, "indicator-spacing", &spacing, NULL); + d->gtk_widget_style_get(gtkRadioButton, "indicator-spacing", &spacing, NULL); QRect buttonRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing); gtkPainter.setClipRect(option->rect); // ### Note: Ubuntulooks breaks when the proper widget is passed // Murrine engine requires a widget not to get RGBA check - warnings - GtkWidget *gtkCheckButton = QGtk::gtkWidget(QLS("GtkCheckButton")); + GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton")); gtkPainter.paintOption(gtkCheckButton , buttonRect, state, shadow, gtkRadioButton->style, QLS("radiobutton")); } @@ -1132,12 +1110,12 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, int spacing; - GtkWidget *gtkCheckButton = QGtk::gtkWidget(QLS("GtkCheckButton")); + GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton")); // Some styles such as aero-clone assume they can paint in the spacing area gtkPainter.setClipRect(option->rect); - QGtk::gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, NULL); + d->gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, NULL); QRect checkRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing); @@ -1204,12 +1182,14 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QPainter *painter, const QWidget *widget) const { - if (!QGtk::isThemeAvailable()) { + Q_D(const QGtkStyle); + + if (!d->isThemeAvailable()) { QCleanlooksStyle::drawComplexControl(control, option, painter, widget); return; } - GtkStyle* style = QGtk::gtkStyle(); + GtkStyle* style = d->gtkStyle(); QGtkPainter gtkPainter(painter); QColor button = option->palette.button().color(); QColor dark; @@ -1264,7 +1244,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { // Draw prelight background - GtkWidget *gtkCheckButton = QGtk::gtkWidget(QLS("GtkCheckButton")); + GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton")); if (option->state & State_MouseOver) { QRect bgRect = textRect | checkBoxRect; @@ -1340,14 +1320,14 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QString comboBoxPath = QLS(comboBox->editable ? "GtkComboBoxEntry" : "GtkComboBox"); // We use the gtk widget to position arrows and separators for us - GtkWidget *gtkCombo = QGtk::gtkWidget(comboBoxPath); + GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath); GtkAllocation geometry = {0, 0, option->rect.width(), option->rect.height()}; - QGtk::gtk_widget_set_direction(gtkCombo, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); - QGtk::gtk_widget_size_allocate(gtkCombo, &geometry); + d->gtk_widget_set_direction(gtkCombo, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); + d->gtk_widget_size_allocate(gtkCombo, &geometry); QString buttonPath = comboBoxPath + QLS(".GtkToggleButton"); - GtkWidget *gtkToggleButton = QGtk::gtkWidget(buttonPath); - QGtk::gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); + GtkWidget *gtkToggleButton = d->gtkWidget(buttonPath); + d->gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); if (gtkToggleButton && (appears_as_list || comboBox->editable)) { if (focus) GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); @@ -1355,8 +1335,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if (comboBox->editable || appears_as_list) { GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state; QString entryPath = QLS(comboBox->editable ? "GtkComboBoxEntry.GtkEntry" : "GtkComboBox.GtkFrame"); - GtkWidget *gtkEntry = QGtk::gtkWidget(entryPath); - QGtk::gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); + GtkWidget *gtkEntry = d->gtkWidget(entryPath); + d->gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); QRect frameRect = option->rect; if (reverse) @@ -1425,7 +1405,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom // Draw the separator between label and arrows QString vSeparatorPath = buttonPath + QLS(".GtkHBox.GtkVSeparator"); - if (GtkWidget *gtkVSeparator = QGtk::gtkWidget(vSeparatorPath)) { + if (GtkWidget *gtkVSeparator = d->gtkWidget(vSeparatorPath)) { QRect vLineRect(gtkVSeparator->allocation.x, gtkVSeparator->allocation.y, gtkVSeparator->allocation.width, @@ -1437,7 +1417,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom gint interiorFocus = true; - QGtk::gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL); + d->gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL); int xt = interiorFocus ? gtkToggleButton->style->xthickness : 0; int yt = interiorFocus ? gtkToggleButton->style->ythickness : 0; if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) @@ -1461,14 +1441,14 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QString arrowPath = comboBoxPath + QLS(appears_as_list ? ".GtkToggleButton.GtkArrow" : ".GtkToggleButton.GtkHBox.GtkArrow"); - GtkWidget *gtkArrow = QGtk::gtkWidget(arrowPath); + GtkWidget *gtkArrow = d->gtkWidget(arrowPath); gfloat scale = 0.7; gint minSize = 15; QRect arrowWidgetRect; - if (gtkArrow && !QGtk::gtk_check_version(2, 12, 0)) { - QGtk::gtk_widget_style_get(gtkArrow, "arrow-scaling", &scale, NULL); - QGtk::gtk_widget_style_get(gtkCombo, "arrow-size", &minSize, NULL); + if (gtkArrow && !d->gtk_check_version(2, 12, 0)) { + d->gtk_widget_style_get(gtkArrow, "arrow-scaling", &scale, NULL); + d->gtk_widget_style_get(gtkCombo, "arrow-size", &minSize, NULL); } if (gtkArrow) { arrowWidgetRect = QRect(gtkArrow->allocation.x, gtkArrow->allocation.y, @@ -1486,9 +1466,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if (sunken) { int xoff, yoff; - GtkWidget *gtkButton = QGtk::gtkWidget(comboBoxPath + QLS(".GtkToggleButton")); - QGtk::gtk_widget_style_get(gtkButton, "child-displacement-x", &xoff, NULL); - QGtk::gtk_widget_style_get(gtkButton, "child-displacement-y", &yoff, NULL); + GtkWidget *gtkButton = d->gtkWidget(comboBoxPath + QLS(".GtkToggleButton")); + d->gtk_widget_style_get(gtkButton, "child-displacement-x", &xoff, NULL); + d->gtk_widget_style_get(gtkButton, "child-displacement-y", &yoff, NULL); arrowRect = arrowRect.adjusted(xoff, yoff, xoff, yoff); } @@ -1559,7 +1539,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QStyleOptionToolButton label = *toolbutton; label.state = bflags; - GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkToolButton.GtkButton")); + GtkWidget *gtkButton = d->gtkWidget(QLS("GtkToolButton.GtkButton")); QPalette pal = toolbutton->palette; if (option->state & State_Enabled && option->state & State_MouseOver && !(widget && widget->testAttribute(Qt::WA_SetPalette))) { @@ -1594,8 +1574,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom case CC_ScrollBar: if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - GtkWidget *gtkHScrollBar = QGtk::gtkWidget(QLS("GtkHScrollbar")); - GtkWidget *gtkVScrollBar = QGtk::gtkWidget(QLS("GtkVScrollbar")); + GtkWidget *gtkHScrollBar = d->gtkWidget(QLS("GtkHScrollbar")); + GtkWidget *gtkVScrollBar = d->gtkWidget(QLS("GtkVScrollbar")); // Fill background in case the scrollbar is partially transparent painter->fillRect(option->rect, option->palette.background()); @@ -1612,8 +1592,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom gboolean trough_side_details = false; gboolean stepper_size = 14; gint trough_border = 1; - if (!QGtk::gtk_check_version(2, 10, 0)) { - QGtk::gtk_widget_style_get((GtkWidget*)(scrollbarWidget), + if (!d->gtk_check_version(2, 10, 0)) { + d->gtk_widget_style_get((GtkWidget*)(scrollbarWidget), "trough-border", &trough_border, "trough-side-details", &trough_side_details, "trough-under-steppers", &trough_under_steppers, @@ -1637,12 +1617,12 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom fakePos = maximum; else if (scrollBar->sliderPosition > scrollBar->minimum) fakePos = maximum - 1; - GtkObject *adjustment = QGtk::gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0); + GtkObject *adjustment = d->gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0); if (horizontal) - QGtk::gtk_range_set_adjustment((GtkRange*)(gtkHScrollBar), (GtkAdjustment*)(adjustment)); + d->gtk_range_set_adjustment((GtkRange*)(gtkHScrollBar), (GtkAdjustment*)(adjustment)); else - QGtk::gtk_range_set_adjustment((GtkRange*)(gtkVScrollBar), (GtkAdjustment*)(adjustment)); + d->gtk_range_set_adjustment((GtkRange*)(gtkVScrollBar), (GtkAdjustment*)(adjustment)); if (scrollBar->subControls & SC_ScrollBarGroove) { GtkStateType state = GTK_STATE_ACTIVE; @@ -1739,7 +1719,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom case CC_SpinBox: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - GtkWidget *gtkSpinButton = QGtk::gtkWidget(QLS("GtkSpinButton")); + GtkWidget *gtkSpinButton = d->gtkWidget(QLS("GtkSpinButton")); bool isEnabled = (spinBox->state & State_Enabled); bool hover = isEnabled && (spinBox->state & State_MouseOver); bool sunken = (spinBox->state & State_Sunken); @@ -1854,7 +1834,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom } } else { - int size = spinboxArrowSize(); + int size = d->getSpinboxArrowSize(); int w = size / 2 - 1; w -= w % 2 - 1; // force odd int h = (w + 1)/2; @@ -1886,8 +1866,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - GtkWidget *hScaleWidget = QGtk::gtkWidget(QLS("GtkHScale")); - GtkWidget *vScaleWidget = QGtk::gtkWidget(QLS("GtkVScale")); + GtkWidget *hScaleWidget = d->gtkWidget(QLS("GtkHScale")); + GtkWidget *vScaleWidget = d->gtkWidget(QLS("GtkVScale")); QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); @@ -1911,16 +1891,16 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom style = scaleWidget->style; if ((option->subControls & SC_SliderGroove) && groove.isValid()) { - GtkObject *adjustment = QGtk::gtk_adjustment_new(slider->sliderPosition, + GtkObject *adjustment = d->gtk_adjustment_new(slider->sliderPosition, slider->minimum, slider->maximum, slider->singleStep, slider->singleStep, slider->pageStep); int outerSize; - QGtk::gtk_range_set_adjustment ((GtkRange*)(scaleWidget), (GtkAdjustment*)(adjustment)); - QGtk::gtk_range_set_inverted((GtkRange*)(scaleWidget), !horizontal); - QGtk::gtk_widget_style_get(scaleWidget, "trough-border", &outerSize, NULL); + d->gtk_range_set_adjustment ((GtkRange*)(scaleWidget), (GtkAdjustment*)(adjustment)); + d->gtk_range_set_inverted((GtkRange*)(scaleWidget), !horizontal); + d->gtk_widget_style_get(scaleWidget, "trough-border", &outerSize, NULL); outerSize++; GtkStateType state = gtkPainter.gtkState(option); @@ -1929,8 +1909,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom -focusFrameMargin, -outerSize - focusFrameMargin); gboolean trough_side_details = false; // Indicates if the upper or lower scale background differs - if (!QGtk::gtk_check_version(2, 10, 0)) - QGtk::gtk_widget_style_get((GtkWidget*)(scaleWidget), "trough-side-details", &trough_side_details, NULL); + if (!d->gtk_check_version(2, 10, 0)) + d->gtk_widget_style_get((GtkWidget*)(scaleWidget), "trough-side-details", &trough_side_details, NULL); if (!trough_side_details) { gtkPainter.paintBox( scaleWidget, "trough", grooveRect, state, @@ -2064,18 +2044,20 @@ void QGtkStyle::drawControl(ControlElement element, QPainter *painter, const QWidget *widget) const { - if (!QGtk::isThemeAvailable()) { + Q_D(const QGtkStyle); + + if (!d->isThemeAvailable()) { QCleanlooksStyle::drawControl(element, option, painter, widget); return; } - GtkStyle* style = QGtk::gtkStyle(); + GtkStyle* style = d->gtkStyle(); QGtkPainter gtkPainter(painter); switch (element) { case CE_ProgressBarLabel: if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { - GtkWidget *gtkProgressBar = QGtk::gtkWidget(QLS("GtkProgressBar")); + GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar")); if (!gtkProgressBar) return; @@ -2178,7 +2160,7 @@ void QGtkStyle::drawControl(ControlElement element, if (button->features & QStyleOptionButton::HasMenu) ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0); - GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); QPalette pal = button->palette; int labelState = GTK_STATE_INSENSITIVE; if (option->state & State_Enabled) @@ -2199,7 +2181,7 @@ void QGtkStyle::drawControl(ControlElement element, bool isRadio = (element == CE_RadioButton); // Draw prelight background - GtkWidget *gtkRadioButton = QGtk::gtkWidget(QLS("GtkRadioButton")); + GtkWidget *gtkRadioButton = d->gtkWidget(QLS("GtkRadioButton")); if (option->state & State_MouseOver) { gtkPainter.paintFlatBox(gtkRadioButton, "checkbutton", option->rect, @@ -2267,7 +2249,7 @@ void QGtkStyle::drawControl(ControlElement element, } if (!cb->currentText.isEmpty() && !cb->editable) { - GtkWidget *gtkCombo = QGtk::gtkWidget(QLS("GtkComboBox")); + GtkWidget *gtkCombo = d->gtkWidget(QLS("GtkComboBox")); QPalette pal = cb->palette; int labelState = GTK_STATE_INSENSITIVE; @@ -2344,9 +2326,9 @@ void QGtkStyle::drawControl(ControlElement element, // Draws the header in tables. if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { Q_UNUSED(header); - GtkWidget *gtkTreeView = QGtk::gtkWidget(QLS("GtkTreeView")); + GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView")); // Get the middle column - GtkTreeViewColumn *column = QGtk::gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1); + GtkTreeViewColumn *column = d->gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1); Q_ASSERT(column); GtkWidget *gtkTreeHeader = column->button; @@ -2365,7 +2347,7 @@ void QGtkStyle::drawControl(ControlElement element, #ifndef QT_NO_SIZEGRIP case CE_SizeGrip: { - GtkWidget *gtkStatusbar = QGtk::gtkWidget(QLS("GtkStatusbar.GtkFrame")); + GtkWidget *gtkStatusbar = d->gtkWidget(QLS("GtkStatusbar.GtkFrame")); QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbar->style->xthickness, -gtkStatusbar->style->ythickness); gtkPainter.paintResizeGrip( gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, QApplication::isRightToLeft() ? @@ -2377,7 +2359,7 @@ void QGtkStyle::drawControl(ControlElement element, #endif // QT_NO_SIZEGRIP case CE_MenuBarEmptyArea: { - GtkWidget *gtkMenubar = QGtk::gtkWidget(QLS("GtkMenuBar")); + GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar")); GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8)); if (widget) { // See CE_MenuBarItem @@ -2387,7 +2369,7 @@ void QGtkStyle::drawControl(ControlElement element, QPainter pmPainter(&pixmap); QGtkPainter gtkMenuBarPainter(&pmPainter); GtkShadowType shadow_type; - QGtk::gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL); + d->gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL); gtkMenuBarPainter.paintBox( gtkMenubar, "menubar", menuBarRect, GTK_STATE_NORMAL, shadow_type, gtkMenubar->style); pmPainter.end(); @@ -2400,8 +2382,8 @@ void QGtkStyle::drawControl(ControlElement element, painter->save(); if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { - GtkWidget *gtkMenubarItem = QGtk::gtkWidget(QLS("GtkMenuBar.GtkMenuItem")); - GtkWidget *gtkMenubar = QGtk::gtkWidget(QLS("GtkMenuBar")); + GtkWidget *gtkMenubarItem = d->gtkWidget(QLS("GtkMenuBar.GtkMenuItem")); + GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar")); style = gtkMenubarItem->style; @@ -2416,7 +2398,7 @@ void QGtkStyle::drawControl(ControlElement element, QPainter pmPainter(&pixmap); QGtkPainter menubarPainter(&pmPainter); GtkShadowType shadow_type; - QGtk::gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL); + d->gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL); GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8)); menubarPainter.paintBox(gtkMenubar, "menubar", menuBarRect, @@ -2440,7 +2422,7 @@ void QGtkStyle::drawControl(ControlElement element, if (act) { GtkShadowType shadowType = GTK_SHADOW_NONE; - QGtk::gtk_widget_style_get (gtkMenubarItem, "selected-shadow-type", &shadowType, NULL); + d->gtk_widget_style_get (gtkMenubarItem, "selected-shadow-type", &shadowType, NULL); gtkPainter.paintBox(gtkMenubarItem, "menuitem", option->rect.adjusted(0, 0, 0, 3), GTK_STATE_PRELIGHT, shadowType, gtkMenubarItem->style); //draw text @@ -2457,7 +2439,7 @@ void QGtkStyle::drawControl(ControlElement element, break; case CE_Splitter: { - GtkWidget *gtkWindow = QGtk::gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed + GtkWidget *gtkWindow = d->gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed gtkPainter.paintHandle(gtkWindow, "splitter", option->rect, gtkPainter.gtkState(option), GTK_SHADOW_NONE, !(option->state & State_Horizontal) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, style); @@ -2477,9 +2459,9 @@ void QGtkStyle::drawControl(ControlElement element, if (toolbar->positionWithinLine != QStyleOptionToolBar::End) rect.adjust(0, 0, 1, 0); - GtkWidget *gtkToolbar = QGtk::gtkWidget(QLS("GtkToolbar")); + GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar")); GtkShadowType shadow_type = GTK_SHADOW_NONE; - QGtk::gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); + d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); gtkPainter.paintBox( gtkToolbar, "toolbar", rect, GTK_STATE_NORMAL, shadow_type, gtkToolbar->style); } @@ -2496,22 +2478,22 @@ void QGtkStyle::drawControl(ControlElement element, const int windowsItemHMargin = 3; // menu item hor text margin const int windowsItemVMargin = 26; // menu item ver text margin const int windowsRightBorder = 15; // right border on windows - GtkWidget *gtkMenu = QGtk::gtkWidget(QLS("GtkMenu")); - GtkWidget *gtkMenuItem = menuItem->checked ? QGtk::gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")) : - QGtk::gtkWidget(QLS("GtkMenu.GtkMenuItem")); + GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu")); + GtkWidget *gtkMenuItem = menuItem->checked ? d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")) : + d->gtkWidget(QLS("GtkMenu.GtkMenuItem")); style = gtkPainter.getStyle(gtkMenuItem); QColor borderColor = option->palette.background().color().darker(160); QColor shadow = option->palette.dark().color(); if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { - GtkWidget *gtkMenuSeparator = QGtk::gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem")); + GtkWidget *gtkMenuSeparator = d->gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem")); painter->setPen(shadow.lighter(106)); gboolean wide_separators = 0; gint separator_height = 0; guint horizontal_padding = 3; - if (!QGtk::gtk_check_version(2, 10, 0)) { - QGtk::gtk_widget_style_get(gtkMenuSeparator, + if (!d->gtk_check_version(2, 10, 0)) { + d->gtk_widget_style_get(gtkMenuSeparator, "wide-separators", &wide_separators, "separator-height", &separator_height, "horizontal-padding", &horizontal_padding, @@ -2545,7 +2527,7 @@ void QGtkStyle::drawControl(ControlElement element, bool ignoreCheckMark = false; gint checkSize; - QGtk::gtk_widget_style_get(QGtk::gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL); + d->gtk_widget_style_get(d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL); int checkcol = qMax(menuItem->maxIconWidth, qMax(20, checkSize)); @@ -2732,7 +2714,7 @@ void QGtkStyle::drawControl(ControlElement element, // "arrow-scaling" is actually hardcoded and fails on hardy (see gtk+-2.12/gtkmenuitem.c) // though the current documentation states otherwise int horizontal_padding; - QGtk::gtk_widget_style_get(gtkMenuItem, "horizontal-padding", &horizontal_padding, NULL); + d->gtk_widget_style_get(gtkMenuItem, "horizontal-padding", &horizontal_padding, NULL); const int dim = static_cast<int>(arrow_size * arrow_scaling); int xpos = menuItem->rect.left() + menuItem->rect.width() - horizontal_padding - dim; @@ -2750,12 +2732,12 @@ void QGtkStyle::drawControl(ControlElement element, case CE_PushButton: if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { - GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget); QStyleOptionButton subopt = *btn; subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); gint interiorFocus = true; - QGtk::gtk_widget_style_get(gtkButton, "interior-focus", &interiorFocus, NULL); + d->gtk_widget_style_get(gtkButton, "interior-focus", &interiorFocus, NULL); int xt = interiorFocus ? gtkButton->style->xthickness : 0; int yt = interiorFocus ? gtkButton->style->ythickness : 0; @@ -2776,7 +2758,7 @@ void QGtkStyle::drawControl(ControlElement element, case CE_TabBarTabShape: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - GtkWidget *gtkNotebook = QGtk::gtkWidget(QLS("GtkNotebook")); + GtkWidget *gtkNotebook = d->gtkWidget(QLS("GtkNotebook")); style = gtkPainter.getStyle(gtkNotebook); QRect rect = option->rect; @@ -2843,7 +2825,7 @@ void QGtkStyle::drawControl(ControlElement element, case CE_ProgressBarGroove: if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { Q_UNUSED(bar); - GtkWidget *gtkProgressBar = QGtk::gtkWidget(QLS("GtkProgressBar")); + GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar")); GtkStateType state = gtkPainter.gtkState(option); gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, gtkProgressBar->style); } @@ -2853,7 +2835,7 @@ void QGtkStyle::drawControl(ControlElement element, case CE_ProgressBarContents: if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { GtkStateType state = option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE; - GtkWidget *gtkProgressBar = QGtk::gtkWidget(QLS("GtkProgressBar")); + GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar")); style = gtkProgressBar->style; gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, style); int xt = style->xthickness; @@ -2901,8 +2883,8 @@ void QGtkStyle::drawControl(ControlElement element, else if (bar->progress > bar->minimum) fakePos = maximum - 1; - GtkObject *adjustment = QGtk::gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0); - QGtk::gtk_progress_set_adjustment((GtkProgress*)(gtkProgressBar), (GtkAdjustment*)(adjustment)); + GtkObject *adjustment = d->gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0); + d->gtk_progress_set_adjustment((GtkProgress*)(gtkProgressBar), (GtkAdjustment*)(adjustment)); QRect progressBar; @@ -2942,8 +2924,10 @@ void QGtkStyle::drawControl(ControlElement element, QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const { + Q_D(const QGtkStyle); + QRect rect = QWindowsStyle::subControlRect(control, option, subControl, widget); - if (!QGtk::isThemeAvailable()) + if (!d->isThemeAvailable()) return QCleanlooksStyle::subControlRect(control, option, subControl, widget); switch (control) { @@ -3009,7 +2993,7 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple case CC_SpinBox: if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - GtkWidget *gtkSpinButton = QGtk::gtkWidget(QLS("GtkSpinButton")); + GtkWidget *gtkSpinButton = d->gtkWidget(QLS("GtkSpinButton")); int center = spinbox->rect.height() / 2; int xt = spinbox->frame ? gtkSpinButton->style->xthickness : 0; int yt = spinbox->frame ? gtkSpinButton->style->ythickness : 0; @@ -3017,7 +3001,7 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple QSize bs; bs.setHeight(qMax(8, spinbox->rect.height()/2 - y)); - bs.setWidth(spinboxArrowSize()); + bs.setWidth(d->getSpinboxArrowSize()); int x, lx, rx; x = spinbox->rect.width() - y - bs.width() + 2; lx = xt; @@ -3063,17 +3047,17 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { // We employ the gtk widget to position arrows and separators for us QString comboBoxPath = box->editable ? QLS("GtkComboBoxEntry") : QLS("GtkComboBox"); - GtkWidget *gtkCombo = QGtk::gtkWidget(comboBoxPath); - QGtk::gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); + GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath); + d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())}; - QGtk::gtk_widget_size_allocate(gtkCombo, &geometry); + d->gtk_widget_size_allocate(gtkCombo, &geometry); int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, option, widget); QString arrowPath = comboBoxPath + QLS(".GtkToggleButton"); if (!box->editable && !appears_as_list) arrowPath += QLS(".GtkHBox.GtkArrow"); - GtkWidget *arrowWidget = QGtk::gtkWidget(arrowPath); + GtkWidget *arrowWidget = d->gtkWidget(arrowPath); if (!arrowWidget) return QCleanlooksStyle::subControlRect(control, option, subControl, widget); @@ -3118,19 +3102,19 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple \reimp */ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, - const QSize &size, const QWidget *widget) const { + Q_D(const QGtkStyle); QSize newSize = QCleanlooksStyle::sizeFromContents(type, option, size, widget); - if (!QGtk::isThemeAvailable()) + if (!d->isThemeAvailable()) return newSize; switch (type) { case CT_ToolButton: if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { - GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkToolButton.GtkButton")); + GtkWidget *gtkButton = d->gtkWidget(QLS("GtkToolButton.GtkButton")); newSize = size + QSize(2 * gtkButton->style->xthickness, 1 + 2 * gtkButton->style->ythickness); if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) { QSize minSize(0, 25); @@ -3138,7 +3122,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, minSize = toolbutton->iconSize + QSize(12, 12); newSize = newSize.expandedTo(minSize); } - + if (toolbutton->features & QStyleOptionToolButton::HasMenu) newSize += QSize(6, 0); } @@ -3149,10 +3133,10 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, int textMargin = 8; if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { - GtkWidget *gtkMenuSeparator = QGtk::gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem")); + GtkWidget *gtkMenuSeparator = d->gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem")); gboolean wide_separators; gint separator_height; - QGtk::gtk_widget_style_get(gtkMenuSeparator, + d->gtk_widget_style_get(gtkMenuSeparator, "wide-separators", &wide_separators, "separator-height", &separator_height, NULL); @@ -3161,14 +3145,14 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, break; } - GtkWidget *gtkMenuItem = QGtk::gtkWidget(QLS("GtkMenu.GtkMenuItem")); + GtkWidget *gtkMenuItem = d->gtkWidget(QLS("GtkMenu.GtkMenuItem")); GtkStyle* style = gtkMenuItem->style; newSize += QSize(textMargin + style->xthickness - 2, style->ythickness - 4); // Cleanlooks assumes a check column of 20 pixels so we need to // expand it a bit gint checkSize; - QGtk::gtk_widget_style_get(QGtk::gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL); + d->gtk_widget_style_get(d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL); newSize.setHeight(qMax(newSize.height(), checkSize + 2)); newSize.setWidth(newSize.width() + qMax(0, checkSize - 20)); } @@ -3183,22 +3167,22 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, case CT_SpinBox: // QSpinBox does some nasty things that depends on CT_LineEdit - newSize = size + QSize(0, -QGtk::gtkWidget(QLS("GtkSpinButton"))->style->ythickness * 2 + 2); + newSize = size + QSize(0, -d->gtkWidget(QLS("GtkSpinButton"))->style->ythickness * 2 + 2); break; case CT_PushButton: if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { - GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); gint focusPadding, focusWidth; - QGtk::gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL); - QGtk::gtk_widget_style_get(gtkButton, "focus-line-width", &focusWidth, NULL); + d->gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL); + d->gtk_widget_style_get(gtkButton, "focus-line-width", &focusWidth, NULL); newSize = size; newSize += QSize(2*gtkButton->style->xthickness + 4, 2*gtkButton->style->ythickness); newSize += QSize(2*(focusWidth + focusPadding + 2), 2*(focusWidth + focusPadding)); - GtkWidget *gtkButtonBox = QGtk::gtkWidget(QLS("GtkHButtonBox")); + GtkWidget *gtkButtonBox = d->gtkWidget(QLS("GtkHButtonBox")); gint minWidth = 85, minHeight = 0; - QGtk::gtk_widget_style_get(gtkButtonBox, "child-min-width", &minWidth, + d->gtk_widget_style_get(gtkButtonBox, "child-min-width", &minWidth, "child-min-height", &minHeight, NULL); if (!btn->text.isEmpty() && newSize.width() < minWidth) newSize.setWidth(minWidth); @@ -3209,7 +3193,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, break; case CT_Slider: { - GtkWidget *gtkSlider = QGtk::gtkWidget(QLS("GtkHScale")); + GtkWidget *gtkSlider = d->gtkWidget(QLS("GtkHScale")); newSize = size + QSize(2*gtkSlider->style->xthickness, 2*gtkSlider->style->ythickness); } break; @@ -3219,7 +3203,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, break; case CT_LineEdit: { - GtkWidget *gtkEntry = QGtk::gtkWidget(QLS("GtkEntry")); + GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry")); newSize = size + QSize(2*gtkEntry->style->xthickness, 2*gtkEntry->style->ythickness); } break; @@ -3230,7 +3214,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, case CT_ComboBox: if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - GtkWidget *gtkCombo = QGtk::gtkWidget(QLS("GtkComboBox")); + GtkWidget *gtkCombo = d->gtkWidget(QLS("GtkComboBox")); QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget); newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkCombo->style->xthickness, 4 + 2*gtkCombo->style->ythickness); @@ -3263,7 +3247,9 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, QPixmap QGtkStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option, const QWidget *widget) const { - if (!QGtk::isThemeAvailable()) + Q_D(const QGtkStyle); + + if (!d->isThemeAvailable()) return QCleanlooksStyle::standardPixmap(sp, option, widget); QPixmap pixmap; @@ -3330,7 +3316,9 @@ QIcon QGtkStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { - if (!QGtk::isThemeAvailable()) + Q_D(const QGtkStyle); + + if (!d->isThemeAvailable()) return QCleanlooksStyle::standardIconImplementation(standardIcon, option, widget); switch (standardIcon) { case SP_DialogDiscardButton: diff --git a/src/gui/styles/qgtkstyle.h b/src/gui/styles/qgtkstyle.h index 20c2b52..5c3bad1 100644 --- a/src/gui/styles/qgtkstyle.h +++ b/src/gui/styles/qgtkstyle.h @@ -45,6 +45,7 @@ #include <QtGui/QCleanlooksStyle> #include <QtGui/QPalette> #include <QtGui/QFont> +#include <QtGui/QFileDialog> QT_BEGIN_HEADER @@ -64,6 +65,8 @@ class Q_GUI_EXPORT QGtkStyle : public QCleanlooksStyle public: QGtkStyle(); + QGtkStyle(QGtkStylePrivate &dd); + ~QGtkStyle(); QPalette standardPalette() const; @@ -107,12 +110,15 @@ public: void unpolish(QWidget *widget); void unpolish(QApplication *app); + static bool getGConfBool(const QString &key, bool fallback = 0); + static QString getGConfString(const QString &key, const QString &fallback = QString()); + + protected Q_SLOTS: QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget = 0) const; }; - #endif //!defined(QT_NO_STYLE_QGTK) QT_END_NAMESPACE diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp new file mode 100644 index 0000000..7119a4f --- /dev/null +++ b/src/gui/styles/qgtkstyle_p.cpp @@ -0,0 +1,1069 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgtkstyle_p.h" + +// This file is responsible for resolving all GTK functions we use +// dynamically. This is done to avoid link-time dependancy on GTK +// as well as crashes occurring due to usage of the GTK_QT engines +// +// Additionally we create a map of common GTK widgets that we can pass +// to the GTK theme engine as many engines resort to querying the +// actual widget pointers for details that are not covered by the +// state flags + +#include <QtCore/qglobal.h> +#if !defined(QT_NO_STYLE_GTK) + +#include <QtCore/QEvent> +#include <QtCore/QFile> +#include <QtCore/QStringList> +#include <QtCore/QTextStream> +#include <QtCore/QHash> +#include <QtCore/QUrl> +#include <QtCore/QLibrary> + +#include <private/qapplication_p.h> +#include <private/qiconloader_p.h> + +#include <QtGui/QMenu> +#include <QtGui/QStyle> +#include <QtGui/QApplication> +#include <QtGui/QPixmapCache> +#include <QtGui/QStatusBar> +#include <QtGui/QMenuBar> +#include <QtGui/QToolBar> +#include <QtGui/QToolButton> +#include <QtGui/QX11Info> + +#include <private/qt_x11_p.h> + +QT_BEGIN_NAMESPACE + +static bool displayDepth = -1; +Q_GLOBAL_STATIC(QGtkStyleUpdateScheduler, styleScheduler) + +Ptr_gtk_container_forall QGtkStylePrivate::gtk_container_forall = 0; +Ptr_gtk_init QGtkStylePrivate::gtk_init = 0; +Ptr_gtk_style_attach QGtkStylePrivate::gtk_style_attach = 0; +Ptr_gtk_window_new QGtkStylePrivate::gtk_window_new = 0; +Ptr_gtk_widget_destroy QGtkStylePrivate::gtk_widget_destroy = 0; +Ptr_gtk_widget_realize QGtkStylePrivate::gtk_widget_realize = 0; +Ptr_gtk_widget_set_default_direction QGtkStylePrivate::gtk_widget_set_default_direction = 0; +Ptr_gtk_widget_modify_color QGtkStylePrivate::gtk_widget_modify_fg = 0; +Ptr_gtk_widget_modify_color QGtkStylePrivate::gtk_widget_modify_bg = 0; +Ptr_gtk_arrow_new QGtkStylePrivate::gtk_arrow_new = 0; +Ptr_gtk_menu_item_new QGtkStylePrivate::gtk_menu_item_new = 0; +Ptr_gtk_check_menu_item_new QGtkStylePrivate::gtk_check_menu_item_new = 0; +Ptr_gtk_menu_bar_new QGtkStylePrivate::gtk_menu_bar_new = 0; +Ptr_gtk_menu_new QGtkStylePrivate::gtk_menu_new = 0; +Ptr_gtk_button_new QGtkStylePrivate::gtk_button_new = 0; +Ptr_gtk_tool_button_new QGtkStylePrivate::gtk_tool_button_new = 0; +Ptr_gtk_hbutton_box_new QGtkStylePrivate::gtk_hbutton_box_new = 0; +Ptr_gtk_check_button_new QGtkStylePrivate::gtk_check_button_new = 0; +Ptr_gtk_radio_button_new QGtkStylePrivate::gtk_radio_button_new = 0; +Ptr_gtk_spin_button_new QGtkStylePrivate::gtk_spin_button_new = 0; +Ptr_gtk_frame_new QGtkStylePrivate::gtk_frame_new = 0; +Ptr_gtk_expander_new QGtkStylePrivate::gtk_expander_new = 0; +Ptr_gtk_statusbar_new QGtkStylePrivate::gtk_statusbar_new = 0; +Ptr_gtk_entry_new QGtkStylePrivate::gtk_entry_new = 0; +Ptr_gtk_hscale_new QGtkStylePrivate::gtk_hscale_new = 0; +Ptr_gtk_vscale_new QGtkStylePrivate::gtk_vscale_new = 0; +Ptr_gtk_hscrollbar_new QGtkStylePrivate::gtk_hscrollbar_new = 0; +Ptr_gtk_vscrollbar_new QGtkStylePrivate::gtk_vscrollbar_new = 0; +Ptr_gtk_scrolled_window_new QGtkStylePrivate::gtk_scrolled_window_new = 0; +Ptr_gtk_notebook_new QGtkStylePrivate::gtk_notebook_new = 0; +Ptr_gtk_toolbar_new QGtkStylePrivate::gtk_toolbar_new = 0; +Ptr_gtk_toolbar_insert QGtkStylePrivate::gtk_toolbar_insert = 0; +Ptr_gtk_separator_tool_item_new QGtkStylePrivate::gtk_separator_tool_item_new = 0; +Ptr_gtk_tree_view_new QGtkStylePrivate::gtk_tree_view_new = 0; +Ptr_gtk_combo_box_new QGtkStylePrivate::gtk_combo_box_new = 0; +Ptr_gtk_combo_box_entry_new QGtkStylePrivate::gtk_combo_box_entry_new = 0; +Ptr_gtk_progress_bar_new QGtkStylePrivate::gtk_progress_bar_new = 0; +Ptr_gtk_container_add QGtkStylePrivate::gtk_container_add = 0; +Ptr_gtk_menu_shell_append QGtkStylePrivate::gtk_menu_shell_append = 0; +Ptr_gtk_progress_set_adjustment QGtkStylePrivate::gtk_progress_set_adjustment = 0; +Ptr_gtk_range_set_adjustment QGtkStylePrivate::gtk_range_set_adjustment = 0; +Ptr_gtk_range_set_inverted QGtkStylePrivate::gtk_range_set_inverted = 0; +Ptr_gtk_icon_factory_lookup_default QGtkStylePrivate::gtk_icon_factory_lookup_default = 0; +Ptr_gtk_icon_theme_get_default QGtkStylePrivate::gtk_icon_theme_get_default = 0; +Ptr_gtk_widget_style_get QGtkStylePrivate::gtk_widget_style_get = 0; +Ptr_gtk_icon_set_render_icon QGtkStylePrivate::gtk_icon_set_render_icon = 0; +Ptr_gtk_fixed_new QGtkStylePrivate::gtk_fixed_new = 0; +Ptr_gtk_tree_view_column_new QGtkStylePrivate::gtk_tree_view_column_new = 0; +Ptr_gtk_tree_view_get_column QGtkStylePrivate::gtk_tree_view_get_column = 0; +Ptr_gtk_tree_view_append_column QGtkStylePrivate::gtk_tree_view_append_column = 0; +Ptr_gtk_paint_check QGtkStylePrivate::gtk_paint_check = 0; +Ptr_gtk_paint_box QGtkStylePrivate::gtk_paint_box = 0; +Ptr_gtk_paint_box_gap QGtkStylePrivate::gtk_paint_box_gap = 0; +Ptr_gtk_paint_flat_box QGtkStylePrivate::gtk_paint_flat_box = 0; +Ptr_gtk_paint_option QGtkStylePrivate::gtk_paint_option = 0; +Ptr_gtk_paint_extension QGtkStylePrivate::gtk_paint_extension = 0; +Ptr_gtk_paint_slider QGtkStylePrivate::gtk_paint_slider = 0; +Ptr_gtk_paint_shadow QGtkStylePrivate::gtk_paint_shadow = 0; +Ptr_gtk_paint_resize_grip QGtkStylePrivate::gtk_paint_resize_grip = 0; +Ptr_gtk_paint_focus QGtkStylePrivate::gtk_paint_focus = 0; +Ptr_gtk_paint_arrow QGtkStylePrivate::gtk_paint_arrow = 0; +Ptr_gtk_paint_handle QGtkStylePrivate::gtk_paint_handle = 0; +Ptr_gtk_paint_expander QGtkStylePrivate::gtk_paint_expander = 0; +Ptr_gtk_adjustment_new QGtkStylePrivate::gtk_adjustment_new = 0; +Ptr_gtk_paint_hline QGtkStylePrivate::gtk_paint_hline = 0; +Ptr_gtk_paint_vline QGtkStylePrivate::gtk_paint_vline = 0; +Ptr_gtk_menu_item_set_submenu QGtkStylePrivate::gtk_menu_item_set_submenu = 0; +Ptr_gtk_settings_get_default QGtkStylePrivate::gtk_settings_get_default = 0; +Ptr_gtk_separator_menu_item_new QGtkStylePrivate::gtk_separator_menu_item_new = 0; +Ptr_gtk_widget_size_allocate QGtkStylePrivate::gtk_widget_size_allocate = 0; +Ptr_gtk_widget_set_direction QGtkStylePrivate::gtk_widget_set_direction = 0; +Ptr_gtk_widget_path QGtkStylePrivate::gtk_widget_path = 0; +Ptr_gtk_container_get_type QGtkStylePrivate::gtk_container_get_type = 0; +Ptr_gtk_window_get_type QGtkStylePrivate::gtk_window_get_type = 0; +Ptr_gtk_widget_get_type QGtkStylePrivate::gtk_widget_get_type = 0; +Ptr_gtk_rc_get_style_by_paths QGtkStylePrivate::gtk_rc_get_style_by_paths = 0; +Ptr_gtk_check_version QGtkStylePrivate::gtk_check_version = 0; + +Ptr_pango_font_description_get_size QGtkStylePrivate::pango_font_description_get_size = 0; +Ptr_pango_font_description_get_weight QGtkStylePrivate::pango_font_description_get_weight = 0; +Ptr_pango_font_description_get_family QGtkStylePrivate::pango_font_description_get_family = 0; +Ptr_pango_font_description_get_style QGtkStylePrivate::pango_font_description_get_style = 0; + +Ptr_gtk_file_filter_new QGtkStylePrivate::gtk_file_filter_new = 0; +Ptr_gtk_file_filter_set_name QGtkStylePrivate::gtk_file_filter_set_name = 0; +Ptr_gtk_file_filter_add_pattern QGtkStylePrivate::gtk_file_filter_add_pattern = 0; +Ptr_gtk_file_chooser_add_filter QGtkStylePrivate::gtk_file_chooser_add_filter = 0; +Ptr_gtk_file_chooser_set_filter QGtkStylePrivate::gtk_file_chooser_set_filter = 0; +Ptr_gtk_file_chooser_get_filter QGtkStylePrivate::gtk_file_chooser_get_filter = 0; +Ptr_gtk_file_chooser_dialog_new QGtkStylePrivate::gtk_file_chooser_dialog_new = 0; +Ptr_gtk_file_chooser_set_current_folder QGtkStylePrivate::gtk_file_chooser_set_current_folder = 0; +Ptr_gtk_file_chooser_get_filename QGtkStylePrivate::gtk_file_chooser_get_filename = 0; +Ptr_gtk_file_chooser_get_filenames QGtkStylePrivate::gtk_file_chooser_get_filenames = 0; +Ptr_gtk_file_chooser_set_current_name QGtkStylePrivate::gtk_file_chooser_set_current_name = 0; +Ptr_gtk_dialog_run QGtkStylePrivate::gtk_dialog_run = 0; +Ptr_gtk_file_chooser_set_filename QGtkStylePrivate::gtk_file_chooser_set_filename = 0; + +Ptr_gdk_pixbuf_get_pixels QGtkStylePrivate::gdk_pixbuf_get_pixels = 0; +Ptr_gdk_pixbuf_get_width QGtkStylePrivate::gdk_pixbuf_get_width = 0; +Ptr_gdk_pixbuf_get_height QGtkStylePrivate::gdk_pixbuf_get_height = 0; +Ptr_gdk_pixmap_new QGtkStylePrivate::gdk_pixmap_new = 0; +Ptr_gdk_pixbuf_new QGtkStylePrivate::gdk_pixbuf_new = 0; +Ptr_gdk_pixbuf_get_from_drawable QGtkStylePrivate::gdk_pixbuf_get_from_drawable = 0; +Ptr_gdk_draw_rectangle QGtkStylePrivate::gdk_draw_rectangle = 0; +Ptr_gdk_pixbuf_unref QGtkStylePrivate::gdk_pixbuf_unref = 0; +Ptr_gdk_drawable_unref QGtkStylePrivate::gdk_drawable_unref = 0; +Ptr_gdk_drawable_get_depth QGtkStylePrivate::gdk_drawable_get_depth = 0; +Ptr_gdk_color_free QGtkStylePrivate::gdk_color_free = 0; +Ptr_gdk_x11_window_set_user_time QGtkStylePrivate::gdk_x11_window_set_user_time = 0; +Ptr_gdk_x11_drawable_get_xid QGtkStylePrivate::gdk_x11_drawable_get_xid = 0; +Ptr_gdk_x11_drawable_get_xdisplay QGtkStylePrivate::gdk_x11_drawable_get_xdisplay = 0; + +Ptr_gconf_client_get_default QGtkStylePrivate::gconf_client_get_default = 0; +Ptr_gconf_client_get_string QGtkStylePrivate::gconf_client_get_string = 0; +Ptr_gconf_client_get_bool QGtkStylePrivate::gconf_client_get_bool = 0; + +Ptr_gnome_icon_lookup_sync QGtkStylePrivate::gnome_icon_lookup_sync = 0; +Ptr_gnome_vfs_init QGtkStylePrivate::gnome_vfs_init = 0; + +typedef int (*x11ErrorHandler)(Display*, XErrorEvent*); + +static void gtkStyleSetCallback(GtkWidget*, QGtkStylePrivate* stylePrivate) +{ + // We have to let this function return and complete the event + // loop to ensure that all gtk widgets have been styled before + // updating + QMetaObject::invokeMethod(styleScheduler(), "updateTheme", Qt::QueuedConnection, Q_ARG(QGtkStylePrivate*, stylePrivate)); +} + +static void update_toolbar_style(GtkWidget *gtkToolBar, GParamSpec *, gpointer) +{ + GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS; + g_object_get(gtkToolBar, "toolbar-style", &toolbar_style, NULL); + QWidgetList widgets = QApplication::allWidgets(); + for (int i = 0; i < widgets.size(); ++i) { + QWidget *widget = widgets.at(i); + if (qobject_cast<QToolButton*>(widget)) { + QEvent event(QEvent::StyleChange); + QApplication::sendEvent(widget, &event); + } + } +} + +static QString classPath(GtkWidget *widget) +{ + char* class_path; + QGtkStylePrivate::gtk_widget_path (widget, NULL, &class_path, NULL); + QString path = QLS(class_path); + g_free(class_path); + + // Remove the prefixes + path.remove(QLS("GtkWindow.")); + path.remove(QLS("GtkFixed.")); + return path; +} + + + +bool QGtkStyleFilter::eventFilter(QObject *obj, QEvent *e) +{ + if (e->type() == QEvent::ApplicationPaletteChange) { + // Only do this the first time since this will also + // generate applicationPaletteChange events + if (!qt_app_palettes_hash() || qt_app_palettes_hash()->isEmpty()) { + stylePrivate->applyCustomPaletteHash(); + } + } + return QObject::eventFilter(obj, e); +} + +QGtkStylePrivate::QGtkStylePrivate() + : QCleanlooksStylePrivate() + , filter(this) +{ +} + +void QGtkStylePrivate::init() +{ + resolveGtk(); + initGtkWidgets(); + if (isThemeAvailable()) + qApp->installEventFilter(&filter); +} + +GtkWidget* QGtkStylePrivate::gtkWidget(const QString &path) +{ + GtkWidget *widget = gtkWidgetMap()->value(path); + if (!widget) { + // Theme might have rearranged widget internals + widget = gtkWidgetMap()->value(path); + } + return widget; +} + +GtkStyle* QGtkStylePrivate::gtkStyle(const QString &path) +{ + if (gtkWidgetMap()->contains(path)) + return gtkWidgetMap()->value(path)->style; + return 0; +} + +/*! \internal + * Get references to gtk functions after we dynamically load the library. + */ +void QGtkStylePrivate::resolveGtk() +{ + // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0 + QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0); + + gtk_init = (Ptr_gtk_init)libgtk.resolve("gtk_init"); + gtk_window_new = (Ptr_gtk_window_new)libgtk.resolve("gtk_window_new"); + gtk_style_attach = (Ptr_gtk_style_attach)libgtk.resolve("gtk_style_attach"); + gtk_widget_destroy = (Ptr_gtk_widget_destroy)libgtk.resolve("gtk_widget_destroy"); + gtk_widget_realize = (Ptr_gtk_widget_realize)libgtk.resolve("gtk_widget_realize"); + + gtk_file_chooser_set_current_folder = (Ptr_gtk_file_chooser_set_current_folder)libgtk.resolve("gtk_file_chooser_set_current_folder"); + gtk_file_filter_new = (Ptr_gtk_file_filter_new)libgtk.resolve("gtk_file_filter_new"); + gtk_file_filter_set_name = (Ptr_gtk_file_filter_set_name)libgtk.resolve("gtk_file_filter_set_name"); + gtk_file_filter_add_pattern = (Ptr_gtk_file_filter_add_pattern)libgtk.resolve("gtk_file_filter_add_pattern"); + gtk_file_chooser_add_filter = (Ptr_gtk_file_chooser_add_filter)libgtk.resolve("gtk_file_chooser_add_filter"); + gtk_file_chooser_set_filter = (Ptr_gtk_file_chooser_set_filter)libgtk.resolve("gtk_file_chooser_set_filter"); + gtk_file_chooser_get_filter = (Ptr_gtk_file_chooser_get_filter)libgtk.resolve("gtk_file_chooser_get_filter"); + gtk_file_chooser_dialog_new = (Ptr_gtk_file_chooser_dialog_new)libgtk.resolve("gtk_file_chooser_dialog_new"); + gtk_file_chooser_set_current_folder = (Ptr_gtk_file_chooser_set_current_folder)libgtk.resolve("gtk_file_chooser_set_current_folder"); + gtk_file_chooser_get_filename = (Ptr_gtk_file_chooser_get_filename)libgtk.resolve("gtk_file_chooser_get_filename"); + gtk_file_chooser_get_filenames = (Ptr_gtk_file_chooser_get_filenames)libgtk.resolve("gtk_file_chooser_get_filenames"); + gtk_file_chooser_set_current_name = (Ptr_gtk_file_chooser_set_current_name)libgtk.resolve("gtk_file_chooser_set_current_name"); + gtk_dialog_run = (Ptr_gtk_dialog_run)libgtk.resolve("gtk_dialog_run"); + gtk_file_chooser_set_filename = (Ptr_gtk_file_chooser_set_filename)libgtk.resolve("gtk_file_chooser_set_filename"); + + gdk_pixbuf_get_pixels = (Ptr_gdk_pixbuf_get_pixels)libgtk.resolve("gdk_pixbuf_get_pixels"); + gdk_pixbuf_get_width = (Ptr_gdk_pixbuf_get_width)libgtk.resolve("gdk_pixbuf_get_width"); + gdk_pixbuf_get_height = (Ptr_gdk_pixbuf_get_height)libgtk.resolve("gdk_pixbuf_get_height"); + gdk_pixmap_new = (Ptr_gdk_pixmap_new)libgtk.resolve("gdk_pixmap_new"); + gdk_pixbuf_new = (Ptr_gdk_pixbuf_new)libgtk.resolve("gdk_pixbuf_new"); + gdk_pixbuf_get_from_drawable = (Ptr_gdk_pixbuf_get_from_drawable)libgtk.resolve("gdk_pixbuf_get_from_drawable"); + gdk_draw_rectangle = (Ptr_gdk_draw_rectangle)libgtk.resolve("gdk_draw_rectangle"); + gdk_pixbuf_unref = (Ptr_gdk_pixbuf_unref)libgtk.resolve("gdk_pixbuf_unref"); + gdk_drawable_unref = (Ptr_gdk_drawable_unref)libgtk.resolve("gdk_drawable_unref"); + gdk_drawable_get_depth = (Ptr_gdk_drawable_get_depth)libgtk.resolve("gdk_drawable_get_depth"); + gdk_color_free = (Ptr_gdk_color_free)libgtk.resolve("gdk_color_free"); + gdk_x11_window_set_user_time = (Ptr_gdk_x11_window_set_user_time)libgtk.resolve("gdk_x11_window_set_user_time"); + gdk_x11_drawable_get_xid = (Ptr_gdk_x11_drawable_get_xid)libgtk.resolve("gdk_x11_drawable_get_xid"); + gdk_x11_drawable_get_xdisplay = (Ptr_gdk_x11_drawable_get_xdisplay)libgtk.resolve("gdk_x11_drawable_get_xdisplay"); + + gtk_widget_set_default_direction = (Ptr_gtk_widget_set_default_direction)libgtk.resolve("gtk_widget_set_default_direction"); + gtk_widget_modify_fg = (Ptr_gtk_widget_modify_color)libgtk.resolve("gtk_widget_modify_fg"); + gtk_widget_modify_bg = (Ptr_gtk_widget_modify_color)libgtk.resolve("gtk_widget_modify_bg"); + gtk_arrow_new = (Ptr_gtk_arrow_new)libgtk.resolve("gtk_arrow_new"); + gtk_menu_item_new = (Ptr_gtk_menu_item_new)libgtk.resolve("gtk_menu_item_new"); + gtk_check_menu_item_new = (Ptr_gtk_check_menu_item_new)libgtk.resolve("gtk_check_menu_item_new"); + gtk_menu_bar_new = (Ptr_gtk_menu_bar_new)libgtk.resolve("gtk_menu_bar_new"); + gtk_menu_new = (Ptr_gtk_menu_new)libgtk.resolve("gtk_menu_new"); + gtk_toolbar_new = (Ptr_gtk_toolbar_new)libgtk.resolve("gtk_toolbar_new"); + gtk_separator_tool_item_new = (Ptr_gtk_separator_tool_item_new)libgtk.resolve("gtk_separator_tool_item_new"); + gtk_toolbar_insert = (Ptr_gtk_toolbar_insert)libgtk.resolve("gtk_toolbar_insert"); + gtk_button_new = (Ptr_gtk_button_new)libgtk.resolve("gtk_button_new"); + gtk_tool_button_new = (Ptr_gtk_tool_button_new)libgtk.resolve("gtk_tool_button_new"); + gtk_hbutton_box_new = (Ptr_gtk_hbutton_box_new)libgtk.resolve("gtk_hbutton_box_new"); + gtk_check_button_new = (Ptr_gtk_check_button_new)libgtk.resolve("gtk_check_button_new"); + gtk_radio_button_new = (Ptr_gtk_radio_button_new)libgtk.resolve("gtk_radio_button_new"); + gtk_notebook_new = (Ptr_gtk_notebook_new)libgtk.resolve("gtk_notebook_new"); + gtk_progress_bar_new = (Ptr_gtk_progress_bar_new)libgtk.resolve("gtk_progress_bar_new"); + gtk_spin_button_new = (Ptr_gtk_spin_button_new)libgtk.resolve("gtk_spin_button_new"); + gtk_hscale_new = (Ptr_gtk_hscale_new)libgtk.resolve("gtk_hscale_new"); + gtk_vscale_new = (Ptr_gtk_vscale_new)libgtk.resolve("gtk_vscale_new"); + gtk_hscrollbar_new = (Ptr_gtk_hscrollbar_new)libgtk.resolve("gtk_hscrollbar_new"); + gtk_vscrollbar_new = (Ptr_gtk_vscrollbar_new)libgtk.resolve("gtk_vscrollbar_new"); + gtk_scrolled_window_new = (Ptr_gtk_scrolled_window_new)libgtk.resolve("gtk_scrolled_window_new"); + gtk_menu_shell_append = (Ptr_gtk_menu_shell_append)libgtk.resolve("gtk_menu_shell_append"); + gtk_entry_new = (Ptr_gtk_entry_new)libgtk.resolve("gtk_entry_new"); + gtk_tree_view_new = (Ptr_gtk_tree_view_new)libgtk.resolve("gtk_tree_view_new"); + gtk_combo_box_new = (Ptr_gtk_combo_box_new)libgtk.resolve("gtk_combo_box_new"); + gtk_progress_set_adjustment = (Ptr_gtk_progress_set_adjustment)libgtk.resolve("gtk_progress_set_adjustment"); + gtk_range_set_adjustment = (Ptr_gtk_range_set_adjustment)libgtk.resolve("gtk_range_set_adjustment"); + gtk_range_set_inverted = (Ptr_gtk_range_set_inverted)libgtk.resolve("gtk_range_set_inverted"); + gtk_container_add = (Ptr_gtk_container_add)libgtk.resolve("gtk_container_add"); + gtk_icon_factory_lookup_default = (Ptr_gtk_icon_factory_lookup_default)libgtk.resolve("gtk_icon_factory_lookup_default"); + gtk_icon_theme_get_default = (Ptr_gtk_icon_theme_get_default)libgtk.resolve("gtk_icon_theme_get_default"); + gtk_widget_style_get = (Ptr_gtk_widget_style_get)libgtk.resolve("gtk_widget_style_get"); + gtk_icon_set_render_icon = (Ptr_gtk_icon_set_render_icon)libgtk.resolve("gtk_icon_set_render_icon"); + gtk_fixed_new = (Ptr_gtk_fixed_new)libgtk.resolve("gtk_fixed_new"); + gtk_tree_view_column_new = (Ptr_gtk_tree_view_column_new)libgtk.resolve("gtk_tree_view_column_new"); + gtk_tree_view_append_column= (Ptr_gtk_tree_view_append_column )libgtk.resolve("gtk_tree_view_append_column"); + gtk_tree_view_get_column = (Ptr_gtk_tree_view_get_column )libgtk.resolve("gtk_tree_view_get_column"); + gtk_paint_check = (Ptr_gtk_paint_check)libgtk.resolve("gtk_paint_check"); + gtk_paint_box = (Ptr_gtk_paint_box)libgtk.resolve("gtk_paint_box"); + gtk_paint_flat_box = (Ptr_gtk_paint_flat_box)libgtk.resolve("gtk_paint_flat_box"); + gtk_paint_check = (Ptr_gtk_paint_check)libgtk.resolve("gtk_paint_check"); + gtk_paint_box = (Ptr_gtk_paint_box)libgtk.resolve("gtk_paint_box"); + gtk_paint_resize_grip = (Ptr_gtk_paint_resize_grip)libgtk.resolve("gtk_paint_resize_grip"); + gtk_paint_focus = (Ptr_gtk_paint_focus)libgtk.resolve("gtk_paint_focus"); + gtk_paint_shadow = (Ptr_gtk_paint_shadow)libgtk.resolve("gtk_paint_shadow"); + gtk_paint_slider = (Ptr_gtk_paint_slider)libgtk.resolve("gtk_paint_slider"); + gtk_paint_expander = (Ptr_gtk_paint_expander)libgtk.resolve("gtk_paint_expander"); + gtk_paint_handle = (Ptr_gtk_paint_handle)libgtk.resolve("gtk_paint_handle"); + gtk_paint_option = (Ptr_gtk_paint_option)libgtk.resolve("gtk_paint_option"); + gtk_paint_arrow = (Ptr_gtk_paint_arrow)libgtk.resolve("gtk_paint_arrow"); + gtk_paint_box_gap = (Ptr_gtk_paint_box_gap)libgtk.resolve("gtk_paint_box_gap"); + gtk_paint_extension = (Ptr_gtk_paint_extension)libgtk.resolve("gtk_paint_extension"); + gtk_paint_hline = (Ptr_gtk_paint_hline)libgtk.resolve("gtk_paint_hline"); + gtk_paint_vline = (Ptr_gtk_paint_vline)libgtk.resolve("gtk_paint_vline"); + gtk_adjustment_new = (Ptr_gtk_adjustment_new)libgtk.resolve("gtk_adjustment_new"); + gtk_menu_item_set_submenu = (Ptr_gtk_menu_item_set_submenu)libgtk.resolve("gtk_menu_item_set_submenu"); + gtk_settings_get_default = (Ptr_gtk_settings_get_default)libgtk.resolve("gtk_settings_get_default"); + gtk_separator_menu_item_new = (Ptr_gtk_separator_menu_item_new)libgtk.resolve("gtk_separator_menu_item_new"); + gtk_frame_new = (Ptr_gtk_frame_new)libgtk.resolve("gtk_frame_new"); + gtk_expander_new = (Ptr_gtk_expander_new)libgtk.resolve("gtk_expander_new"); + gtk_statusbar_new = (Ptr_gtk_statusbar_new)libgtk.resolve("gtk_statusbar_new"); + gtk_combo_box_entry_new = (Ptr_gtk_combo_box_entry_new)libgtk.resolve("gtk_combo_box_entry_new"); + gtk_container_forall = (Ptr_gtk_container_forall)libgtk.resolve("gtk_container_forall"); + gtk_widget_size_allocate =(Ptr_gtk_widget_size_allocate)libgtk.resolve("gtk_widget_size_allocate"); + gtk_widget_set_direction =(Ptr_gtk_widget_set_direction)libgtk.resolve("gtk_widget_set_direction"); + gtk_widget_path =(Ptr_gtk_widget_path)libgtk.resolve("gtk_widget_path"); + gtk_container_get_type =(Ptr_gtk_container_get_type)libgtk.resolve("gtk_container_get_type"); + gtk_window_get_type =(Ptr_gtk_window_get_type)libgtk.resolve("gtk_window_get_type"); + gtk_widget_get_type =(Ptr_gtk_widget_get_type)libgtk.resolve("gtk_widget_get_type"); + gtk_rc_get_style_by_paths =(Ptr_gtk_rc_get_style_by_paths)libgtk.resolve("gtk_rc_get_style_by_paths"); + gtk_check_version =(Ptr_gtk_check_version)libgtk.resolve("gtk_check_version"); + pango_font_description_get_size = (Ptr_pango_font_description_get_size)libgtk.resolve("pango_font_description_get_size"); + pango_font_description_get_weight = (Ptr_pango_font_description_get_weight)libgtk.resolve("pango_font_description_get_weight"); + pango_font_description_get_family = (Ptr_pango_font_description_get_family)libgtk.resolve("pango_font_description_get_family"); + pango_font_description_get_style = (Ptr_pango_font_description_get_style)libgtk.resolve("pango_font_description_get_style"); + + gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve(QLS("gnomeui-2"), 0, "gnome_icon_lookup_sync"); + gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve(QLS("gnomevfs-2"), 0, "gnome_vfs_init"); +} + +/* \internal + * Initializes a number of gtk menu widgets. + * The widgets are cached. + */ +void QGtkStylePrivate::initGtkMenu() +{ + // Create menubar + GtkWidget *gtkMenuBar = QGtkStylePrivate::gtk_menu_bar_new(); + setupGtkWidget(gtkMenuBar); + + GtkWidget *gtkMenuBarItem = QGtkStylePrivate::gtk_menu_item_new(); + gtk_menu_shell_append((GtkMenuShell*)(gtkMenuBar), gtkMenuBarItem); + gtk_widget_realize(gtkMenuBarItem); + + // Create menu + GtkWidget *gtkMenu = QGtkStylePrivate::gtk_menu_new(); + gtk_menu_item_set_submenu((GtkMenuItem*)(gtkMenuBarItem), gtkMenu); + gtk_widget_realize(gtkMenu); + + GtkWidget *gtkMenuItem = QGtkStylePrivate::gtk_menu_item_new(); + gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkMenuItem); + gtk_widget_realize(gtkMenuItem); + + GtkWidget *gtkCheckMenuItem = QGtkStylePrivate::gtk_check_menu_item_new(); + gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkCheckMenuItem); + gtk_widget_realize(gtkCheckMenuItem); + + GtkWidget *gtkMenuSeparator = QGtkStylePrivate::gtk_separator_menu_item_new(); + gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkMenuSeparator); + + addAllSubWidgets(gtkMenuBar); + addAllSubWidgets(gtkMenu); +} + + +void QGtkStylePrivate::initGtkTreeview() +{ + GtkWidget *gtkTreeView = gtk_tree_view_new(); + gtk_tree_view_append_column((GtkTreeView*)gtkTreeView, gtk_tree_view_column_new()); + gtk_tree_view_append_column((GtkTreeView*)gtkTreeView, gtk_tree_view_column_new()); + gtk_tree_view_append_column((GtkTreeView*)gtkTreeView, gtk_tree_view_column_new()); + addWidget(gtkTreeView); +} + + +/* \internal + * Initializes a number of gtk widgets that we can later on use to determine some of our styles. + * The widgets are cached. + */ +void QGtkStylePrivate::initGtkWidgets() +{ + // From gtkmain.c + uid_t ruid = getuid (); + uid_t rgid = getgid (); + uid_t euid = geteuid (); + uid_t egid = getegid (); + if (ruid != euid || rgid != egid) { + qWarning("\nThis process is currently running setuid or setgid.\nGTK+ does not allow this " + "therefore Qt cannot use the GTK+ integration.\nTry launching your app using \'gksudo\', " + "\'kdesudo\' or a similar tool.\n\n" + "See http://www.gtk.org/setuid.html for more information.\n"); + return; + } + + static QString themeName; + if (!gtkWidgetMap()->contains(QLS("GtkWindow")) && themeName.isEmpty()) { + themeName = getThemeName(); + + if (themeName.isEmpty()) { + qWarning("QGtkStyle was unable to detect the current GTK+ theme."); + return; + } else if (themeName == QLS("Qt") || themeName == QLS("Qt4")) { + // Due to namespace conflicts with Qt3 and obvious recursion with Qt4, + // we cannot support the GTK_Qt Gtk engine + qWarning("QGtkStyle cannot be used together with the GTK_Qt engine."); + return; + } + } + + if (QGtkStylePrivate::gtk_init) { + // Gtk will set the Qt error handler so we have to reset it afterwards + x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0); + QGtkStylePrivate::gtk_init (NULL, NULL); + XSetErrorHandler(qt_x_errhandler); + + // make a window + GtkWidget* gtkWindow = QGtkStylePrivate::gtk_window_new(GTK_WINDOW_POPUP); + QGtkStylePrivate::gtk_widget_realize(gtkWindow); + if (displayDepth == -1) + displayDepth = QGtkStylePrivate::gdk_drawable_get_depth(gtkWindow->window); + gtkWidgetMap()->insert(QLS("GtkWindow"), gtkWindow); + + + // Make all other widgets. respect the text direction + if (qApp->layoutDirection() == Qt::RightToLeft) + QGtkStylePrivate::gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); + + if (!gtkWidgetMap()->contains(QLS("GtkButton"))) { + GtkWidget *gtkButton = QGtkStylePrivate::gtk_button_new(); + addWidget(gtkButton); + g_signal_connect(gtkButton, "style-set", G_CALLBACK(gtkStyleSetCallback), this); + addWidget(QGtkStylePrivate::gtk_tool_button_new(NULL, NULL)); + addWidget(QGtkStylePrivate::gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE)); + addWidget(QGtkStylePrivate::gtk_hbutton_box_new()); + addWidget(QGtkStylePrivate::gtk_check_button_new()); + addWidget(QGtkStylePrivate::gtk_radio_button_new(NULL)); + addWidget(QGtkStylePrivate::gtk_combo_box_new()); + addWidget(QGtkStylePrivate::gtk_combo_box_entry_new()); + addWidget(QGtkStylePrivate::gtk_entry_new()); + addWidget(QGtkStylePrivate::gtk_frame_new(NULL)); + addWidget(QGtkStylePrivate::gtk_expander_new("")); + addWidget(QGtkStylePrivate::gtk_statusbar_new()); + addWidget(QGtkStylePrivate::gtk_hscale_new((GtkAdjustment*)(QGtkStylePrivate::gtk_adjustment_new(1, 0, 1, 0, 0, 0)))); + addWidget(QGtkStylePrivate::gtk_hscrollbar_new(NULL)); + addWidget(QGtkStylePrivate::gtk_scrolled_window_new(NULL, NULL)); + + initGtkMenu(); + addWidget(QGtkStylePrivate::gtk_notebook_new()); + addWidget(QGtkStylePrivate::gtk_progress_bar_new()); + addWidget(QGtkStylePrivate::gtk_spin_button_new((GtkAdjustment*) + (QGtkStylePrivate::gtk_adjustment_new(1, 0, 1, 0, 0, 0)), 0.1, 3)); + GtkWidget *toolbar = gtk_toolbar_new(); + g_signal_connect (toolbar, "notify::toolbar-style", G_CALLBACK (update_toolbar_style), toolbar); + gtk_toolbar_insert((GtkToolbar*)toolbar, gtk_separator_tool_item_new(), -1); + addWidget(toolbar); + initGtkTreeview(); + addWidget(gtk_vscale_new((GtkAdjustment*)(QGtkStylePrivate::gtk_adjustment_new(1, 0, 1, 0, 0, 0)))); + addWidget(gtk_vscrollbar_new(NULL)); + } + else // Rebuild map + { + // When styles change subwidgets can get rearranged + // as with the combo box. We need to update the widget map + // to reflect this; + QHash<QString, GtkWidget*> oldMap = *gtkWidgetMap(); + gtkWidgetMap()->clear(); + QHashIterator<QString, GtkWidget*> it(oldMap); + while (it.hasNext()) { + it.next(); + if (!it.key().contains(QLatin1Char('.'))) { + addAllSubWidgets(it.value()); + } + } + } + } else { + qWarning("QGtkStyle could not resolve GTK. Make sure you have installed the proper libraries."); + } +} + +/*! \internal + * destroys all previously buffered widgets. + */ +void QGtkStylePrivate::cleanupGtkWidgets() +{ + if (gtkWidgetMap()->contains(QLS("GtkWindow"))) // Gtk will destroy all children + gtk_widget_destroy(gtkWidgetMap()->value(QLS("GtkWindow"))); +} + +static bool resolveGConf() +{ + if (!QGtkStylePrivate::gconf_client_get_default) { + QGtkStylePrivate::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_default"); + QGtkStylePrivate::gconf_client_get_string = (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_string"); + QGtkStylePrivate::gconf_client_get_bool = (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_bool"); + } + return (QGtkStylePrivate::gconf_client_get_default !=0); +} + +QString QGtkStylePrivate::getGConfString(const QString &value, const QString &fallback) +{ + QString retVal = fallback; + if (resolveGConf()) { + g_type_init(); + GConfClient* client = gconf_client_get_default(); + GError *err = 0; + char *str = gconf_client_get_string(client, qPrintable(value), &err); + if (!err) { + retVal = QString::fromUtf8(str); + g_free(str); + } + g_object_unref(client); + if (err) + g_error_free (err); + } + return retVal; +} + +bool QGtkStylePrivate::getGConfBool(const QString &key, bool fallback) +{ + bool retVal = fallback; + if (resolveGConf()) { + g_type_init(); + GConfClient* client = gconf_client_get_default(); + GError *err = 0; + bool result = gconf_client_get_bool(client, qPrintable(key), &err); + g_object_unref(client); + if (!err) + retVal = result; + else + g_error_free (err); + } + return retVal; +} + +QString QGtkStylePrivate::getThemeName() const +{ + QString themeName; + // We try to parse the gtkrc file first + // primarily to avoid resolving Gtk functions if + // the KDE 3 "Qt" style is currently in use + QString rcPaths = QString::fromLocal8Bit(qgetenv("GTK2_RC_FILES")); + if (!rcPaths.isEmpty()) { + QStringList paths = rcPaths.split(QLS(":")); + foreach (const QString &rcPath, paths) { + if (!rcPath.isEmpty()) { + QFile rcFile(rcPath); + if (rcFile.exists() && rcFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&rcFile); + while(!in.atEnd()) { + QString line = in.readLine(); + if (line.contains(QLS("gtk-theme-name"))) { + line = line.right(line.length() - line.indexOf(QLatin1Char('=')) - 1); + line.remove(QLatin1Char('\"')); + line = line.trimmed(); + themeName = line; + break; + } + } + } + } + if (!themeName.isEmpty()) + break; + } + } + + // Fall back to gconf + if (themeName.isEmpty() && resolveGConf()) + themeName = getGConfString(QLS("/desktop/gnome/interface/gtk_theme")); + + return themeName; +} + +// Get size of the arrow controls in a GtkSpinButton +int QGtkStylePrivate::getSpinboxArrowSize() const +{ + const int MIN_ARROW_WIDTH = 6; + GtkWidget *spinButton = gtkWidget(QLS("GtkSpinButton")); + GtkStyle *style = spinButton->style; + gint size = pango_font_description_get_size (style->font_desc); + gint arrow_size; + arrow_size = qMax(PANGO_PIXELS (size), MIN_ARROW_WIDTH) + style->xthickness; + arrow_size += arrow_size%2 + 1; + return arrow_size; +} + + +bool QGtkStylePrivate::isKDE4Session() +{ + static int version = -1; + if (version == -1) + version = qgetenv("KDE_SESSION_VERSION").toInt(); + return (version == 4); +} + +void QGtkStylePrivate::applyCustomPaletteHash() +{ + QPalette menuPal = gtkWidgetPalette(QLS("GtkMenu")); + GdkColor gdkBg = gtkWidget(QLS("GtkMenu"))->style->bg[GTK_STATE_NORMAL]; + QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); + menuPal.setBrush(QPalette::Base, bgColor); + menuPal.setBrush(QPalette::Window, bgColor); + qApp->setPalette(menuPal, "QMenu"); + + QPalette toolbarPal = gtkWidgetPalette(QLS("GtkToolbar")); + qApp->setPalette(toolbarPal, "QToolBar"); + + QPalette menuBarPal = gtkWidgetPalette(QLS("GtkMenuBar")); + qApp->setPalette(menuBarPal, "QMenuBar"); +} + +/*! \internal + * Returns the gtk Widget that should be used to determine text foreground and background colors. +*/ +GtkWidget* QGtkStylePrivate::getTextColorWidget() const +{ + return gtkWidget(QLS("GtkEntry")); +} + +void QGtkStylePrivate::setupGtkWidget(GtkWidget* widget) +{ + if (Q_GTK_IS_WIDGET(widget)) { + static GtkWidget* protoLayout = 0; + if (!protoLayout) { + protoLayout = QGtkStylePrivate::gtk_fixed_new(); + QGtkStylePrivate::gtk_container_add((GtkContainer*)(gtkWidgetMap()->value(QLS("GtkWindow"))), protoLayout); + } + Q_ASSERT(protoLayout); + + if (!widget->parent && !GTK_WIDGET_TOPLEVEL(widget)) + QGtkStylePrivate::gtk_container_add((GtkContainer*)(protoLayout), widget); + QGtkStylePrivate::gtk_widget_realize(widget); + } +} + +void QGtkStylePrivate::addWidgetToMap(GtkWidget *widget) +{ + if (Q_GTK_IS_WIDGET(widget)) { + gtk_widget_realize(widget); + gtkWidgetMap()->insert(classPath(widget), widget); + } + } + +void QGtkStylePrivate::addAllSubWidgets(GtkWidget *widget, gpointer v) +{ + Q_UNUSED(v); + addWidgetToMap(widget); + if (GTK_CHECK_TYPE ((widget), gtk_container_get_type())) + gtk_container_forall((GtkContainer*)widget, addAllSubWidgets, NULL); +} + +// Updates window/windowtext palette based on the indicated gtk widget +QPalette QGtkStylePrivate::gtkWidgetPalette(const QString >kWidgetName) +{ + GtkWidget *gtkWidget = QGtkStylePrivate::gtkWidget(gtkWidgetName); + Q_ASSERT(gtkWidget); + QPalette pal = QApplication::palette(); + GdkColor gdkBg = gtkWidget->style->bg[GTK_STATE_NORMAL]; + GdkColor gdkText = gtkWidget->style->fg[GTK_STATE_NORMAL]; + GdkColor gdkDisabledText = gtkWidget->style->fg[GTK_STATE_INSENSITIVE]; + QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); + QColor textColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); + QColor disabledTextColor(gdkDisabledText.red>>8, gdkDisabledText.green>>8, gdkDisabledText.blue>>8); + pal.setBrush(QPalette::Window, bgColor); + pal.setBrush(QPalette::Button, bgColor); + pal.setBrush(QPalette::All, QPalette::WindowText, textColor); + pal.setBrush(QPalette::Disabled, QPalette::WindowText, disabledTextColor); + pal.setBrush(QPalette::All, QPalette::ButtonText, textColor); + pal.setBrush(QPalette::Disabled, QPalette::ButtonText, disabledTextColor); + return pal; +} + + +void QGtkStyleUpdateScheduler::updateTheme( QGtkStylePrivate* stylePrivate ) +{ + static QString oldTheme(QLS("qt_not_set")); + QPixmapCache::clear(); + + QFont font = QGtkStylePrivate::getThemeFont(); + if (QApplication::font() != font) + qApp->setFont(font); + + if (oldTheme != stylePrivate->getThemeName()) { + oldTheme = stylePrivate->getThemeName(); + QPalette newPalette = qApp->style()->standardPalette(); + QApplicationPrivate::setSystemPalette(newPalette); + QApplication::setPalette(newPalette); + stylePrivate->initGtkWidgets(); + stylePrivate->applyCustomPaletteHash(); + QList<QWidget*> widgets = QApplication::allWidgets(); + // Notify all widgets that size metrics might have changed + foreach (QWidget *widget, widgets) { + QEvent e(QEvent::StyleChange); + QApplication::sendEvent(widget, &e); + } + } + QIconLoader::instance()->updateSystemTheme(); +} + +void QGtkStylePrivate::addWidget(GtkWidget *widget) +{ + if (widget) { + setupGtkWidget(widget); + addAllSubWidgets(widget); + } +} + + +// Fetch the application font from the pango font description +// contained in the theme. +QFont QGtkStylePrivate::getThemeFont() +{ + QFont font; + GtkStyle *style = gtkStyle(); + if (style && qApp->desktopSettingsAware()) + { + PangoFontDescription *gtk_font = style->font_desc; + font.setPointSizeF((float)(pango_font_description_get_size(gtk_font))/PANGO_SCALE); + + QString family = QString::fromLatin1(pango_font_description_get_family(gtk_font)); + if (!family.isEmpty()) + font.setFamily(family); + + int weight = pango_font_description_get_weight(gtk_font); + if (weight >= PANGO_WEIGHT_HEAVY) + font.setWeight(QFont::Black); + else if (weight >= PANGO_WEIGHT_BOLD) + font.setWeight(QFont::Bold); + else if (weight >= PANGO_WEIGHT_SEMIBOLD) + font.setWeight(QFont::DemiBold); + else if (weight >= PANGO_WEIGHT_NORMAL) + font.setWeight(QFont::Normal); + else + font.setWeight(QFont::Light); + + PangoStyle fontstyle = pango_font_description_get_style(gtk_font); + if (fontstyle == PANGO_STYLE_ITALIC) + font.setStyle(QFont::StyleItalic); + else if (fontstyle == PANGO_STYLE_OBLIQUE) + font.setStyle(QFont::StyleOblique); + else + font.setStyle(QFont::StyleNormal); + } + return font; +} + + +// ----------- Native file dialogs ----------- + +// Extract filter list from expressions of type: foo (*.a *.b *.c)" +QStringList QGtkStylePrivate::extract_filter(const QString &rawFilter) +{ + QString result = rawFilter; + QRegExp r(QString::fromLatin1("^([^()]*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$")); + int index = r.indexIn(result); + if (index >= 0) + result = r.cap(2); + return result.split(QLatin1Char(' ')); +} + +extern QStringList qt_make_filter_list(const QString &filter); + +void QGtkStylePrivate::setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent, + const QString &dir, const QString &filter, QString *selectedFilter, + QFileDialog::Options options, bool isSaveDialog, + QMap<GtkFileFilter *, QString> *filterMap) +{ + g_object_set(gtkFileChooser, "do-overwrite-confirmation", gboolean(!(options & QFileDialog::DontConfirmOverwrite)), NULL); + g_object_set(gtkFileChooser, "local_only", gboolean(true), NULL); + if (!filter.isEmpty()) { + QStringList filters = qt_make_filter_list(filter); + foreach (const QString &rawfilter, filters) { + GtkFileFilter *gtkFilter = QGtkStylePrivate::gtk_file_filter_new (); + QString name = rawfilter.left(rawfilter.indexOf(QLatin1Char('('))); + QStringList extensions = extract_filter(rawfilter); + QGtkStylePrivate::gtk_file_filter_set_name(gtkFilter, qPrintable(name.isEmpty() ? extensions.join(QLS(", ")) : name)); + + foreach (const QString &fileExtension, extensions) { + // Note Gtk file dialogs are by default case sensitive + // and only supports basic glob syntax so we + // rewrite .xyz to .[xX][yY][zZ] + QString caseInsensitive; + for (int i = 0 ; i < fileExtension.length() ; ++i) { + QChar ch = fileExtension.at(i); + if (ch.isLetter()) { + caseInsensitive.append( + QLatin1Char('[') + + ch.toLower() + + ch.toUpper() + + QLatin1Char(']')); + } else { + caseInsensitive.append(ch); + } + } + QGtkStylePrivate::gtk_file_filter_add_pattern (gtkFilter, qPrintable(caseInsensitive)); + + } + if (filterMap) + filterMap->insert(gtkFilter, rawfilter); + QGtkStylePrivate::gtk_file_chooser_add_filter((GtkFileChooser*)gtkFileChooser, gtkFilter); + if (selectedFilter && (rawfilter == *selectedFilter)) + QGtkStylePrivate::gtk_file_chooser_set_filter((GtkFileChooser*)gtkFileChooser, gtkFilter); + } + } + + // Using the currently active window is not entirely correct, however + // it gives more sensible behavior for applications that do not provide a + // parent + QWidget *modalFor = parent ? parent->window() : qApp->activeWindow(); + if (modalFor) { + QGtkStylePrivate::gtk_widget_realize(gtkFileChooser); // Creates X window + XSetTransientForHint(QGtkStylePrivate::gdk_x11_drawable_get_xdisplay(gtkFileChooser->window), + QGtkStylePrivate::gdk_x11_drawable_get_xid(gtkFileChooser->window), + modalFor->winId()); + QGtkStylePrivate::gdk_x11_window_set_user_time (gtkFileChooser->window, QX11Info::appUserTime()); + + } + + QFileInfo fileinfo(dir); + if (dir.isEmpty()) + fileinfo.setFile(QDir::currentPath()); + fileinfo.makeAbsolute(); + if (fileinfo.isDir()) { + QGtkStylePrivate::gtk_file_chooser_set_current_folder((GtkFileChooser*)gtkFileChooser, qPrintable(dir)); + } else if (isSaveDialog) { + QGtkStylePrivate::gtk_file_chooser_set_current_folder((GtkFileChooser*)gtkFileChooser, qPrintable(fileinfo.absolutePath())); + QGtkStylePrivate::gtk_file_chooser_set_current_name((GtkFileChooser*)gtkFileChooser, qPrintable(fileinfo.fileName())); + } else { + QGtkStylePrivate::gtk_file_chooser_set_filename((GtkFileChooser*)gtkFileChooser, qPrintable(dir)); + } +} + +QString QGtkStylePrivate::openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, + QString *selectedFilter, QFileDialog::Options options) +{ + QMap<GtkFileFilter *, QString> filterMap; + GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption), + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + + setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, false, &filterMap); + + QWidget modal_widget; + modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); + modal_widget.setParent(parent, Qt::Window); + QApplicationPrivate::enterModal(&modal_widget); + + QString filename; + if (QGtkStylePrivate::gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) { + char *gtk_filename = QGtkStylePrivate::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser); + filename = QString::fromUtf8(gtk_filename); + g_free (gtk_filename); + if (selectedFilter) { + GtkFileFilter *gtkFilter = QGtkStylePrivate::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser); + *selectedFilter = filterMap.value(gtkFilter); + } + } + + QApplicationPrivate::leaveModal(&modal_widget); + gtk_widget_destroy (gtkFileChooser); + return filename; +} + + +QString QGtkStylePrivate::openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options) +{ + QMap<GtkFileFilter *, QString> filterMap; + GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption), + NULL, + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + + setupGtkFileChooser(gtkFileChooser, parent, dir, QString(), 0, options); + QWidget modal_widget; + modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); + modal_widget.setParent(parent, Qt::Window); + QApplicationPrivate::enterModal(&modal_widget); + + QString filename; + if (QGtkStylePrivate::gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) { + char *gtk_filename = QGtkStylePrivate::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser); + filename = QString::fromUtf8(gtk_filename); + g_free (gtk_filename); + } + + QApplicationPrivate::leaveModal(&modal_widget); + gtk_widget_destroy (gtkFileChooser); + return filename; +} + +QStringList QGtkStylePrivate::openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, + QString *selectedFilter, QFileDialog::Options options) +{ + QStringList filenames; + QMap<GtkFileFilter *, QString> filterMap; + GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption), + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + + setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, false, &filterMap); + g_object_set(gtkFileChooser, "select-multiple", gboolean(true), NULL); + + QWidget modal_widget; + modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); + modal_widget.setParent(parent, Qt::Window); + QApplicationPrivate::enterModal(&modal_widget); + + if (gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) { + GSList *gtk_file_names = QGtkStylePrivate::gtk_file_chooser_get_filenames((GtkFileChooser*)gtkFileChooser); + for (GSList *iterator = gtk_file_names ; iterator; iterator = iterator->next) + filenames << QString::fromUtf8((const char*)iterator->data); + g_slist_free(gtk_file_names); + if (selectedFilter) { + GtkFileFilter *gtkFilter = QGtkStylePrivate::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser); + *selectedFilter = filterMap.value(gtkFilter); + } + } + + QApplicationPrivate::leaveModal(&modal_widget); + gtk_widget_destroy (gtkFileChooser); + return filenames; +} + +QString QGtkStylePrivate::saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, + QString *selectedFilter, QFileDialog::Options options) +{ + QMap<GtkFileFilter *, QString> filterMap; + GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption), + NULL, + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, + NULL); + setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, true, &filterMap); + + QWidget modal_widget; + modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); + modal_widget.setParent(parent, Qt::Window); + QApplicationPrivate::enterModal(&modal_widget); + + QString filename; + if (QGtkStylePrivate::gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) { + char *gtk_filename = QGtkStylePrivate::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser); + filename = QString::fromUtf8(gtk_filename); + g_free (gtk_filename); + if (selectedFilter) { + GtkFileFilter *gtkFilter = QGtkStylePrivate::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser); + *selectedFilter = filterMap.value(gtkFilter); + } + } + + QApplicationPrivate::leaveModal(&modal_widget); + gtk_widget_destroy (gtkFileChooser); + return filename; +} + +QIcon QGtkStylePrivate::getFilesystemIcon(const QFileInfo &info) +{ + QIcon icon; + if (gnome_vfs_init && gnome_icon_lookup_sync) { + gnome_vfs_init(); + GtkIconTheme *theme = gtk_icon_theme_get_default(); + QByteArray fileurl = QUrl::fromLocalFile(info.absoluteFilePath()).toEncoded(); + char * icon_name = gnome_icon_lookup_sync(theme, + NULL, + fileurl.data(), + NULL, + GNOME_ICON_LOOKUP_FLAGS_NONE, + NULL); + QString iconName = QString::fromUtf8(icon_name); + g_free(icon_name); + if (iconName.startsWith(QLatin1Char('/'))) + return QIcon(iconName); + return QIcon::fromTheme(iconName); + } + return icon; +} + +QT_END_NAMESPACE + +#endif // !defined(QT_NO_STYLE_GTK) diff --git a/src/gui/styles/gtksymbols_p.h b/src/gui/styles/qgtkstyle_p.h index 2cf21ce..fa16769 100644 --- a/src/gui/styles/gtksymbols_p.h +++ b/src/gui/styles/qgtkstyle_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef GTKSYMBOLS_H -#define GTKSYMBOLS_H +#ifndef QGTKSTYLE_P_H +#define QGTKSTYLE_P_H // // W A R N I N G @@ -56,19 +56,19 @@ #include <QtCore/qglobal.h> #if !defined(QT_NO_STYLE_GTK) +#include <QtGui/QFileDialog> + +#include <QtGui/QGtkStyle> +#include <private/qcleanlooksstyle_p.h> + #undef signals // Collides with GTK stymbols #include <gtk/gtk.h> -#include <QtCore/QLibrary> -#include <QtGui/QFont> -#include <QtGui/QFileDialog> + typedef unsigned long XID; #undef GTK_OBJECT_FLAGS #define GTK_OBJECT_FLAGS(obj)(((GtkObject*)(obj))->flags) -#define Q_GTK_TYPE_WIDGET QGtk::gtk_widget_get_type() -#define Q_GTK_IS_WIDGET(widget) widget && GTK_CHECK_TYPE ((widget), Q_GTK_TYPE_WIDGET) -#define Q_GTK_TYPE_WINDOW QGtk::gtk_window_get_type() -#define Q_GTK_TYPE_CONTAINER QGtk::gtk_container_get_type() +#define Q_GTK_IS_WIDGET(widget) widget && GTK_CHECK_TYPE ((widget), QGtkStylePrivate::gtk_widget_get_type()) #define QLS(x) QLatin1String(x) @@ -198,6 +198,35 @@ typedef XID (*Ptr_gdk_x11_drawable_get_xid) (GdkDrawable *); typedef Display* (*Ptr_gdk_x11_drawable_get_xdisplay) ( GdkDrawable *); +QT_BEGIN_NAMESPACE + +typedef QStringList (*_qt_filedialog_open_filenames_hook)(QWidget * parent, const QString &caption, const QString &dir, + const QString &filter, QString *selectedFilter, QFileDialog::Options options); +typedef QString (*_qt_filedialog_open_filename_hook) (QWidget * parent, const QString &caption, const QString &dir, + const QString &filter, QString *selectedFilter, QFileDialog::Options options); +typedef QString (*_qt_filedialog_save_filename_hook) (QWidget * parent, const QString &caption, const QString &dir, + const QString &filter, QString *selectedFilter, QFileDialog::Options options); +typedef QString (*_qt_filedialog_existing_directory_hook)(QWidget *parent, const QString &caption, const QString &dir, + QFileDialog::Options options); + +extern Q_GUI_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook; +extern Q_GUI_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook; +extern Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook; +extern Q_GUI_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook; + +class QGtkStylePrivate; + +class QGtkStyleFilter : public QObject +{ +public: + QGtkStyleFilter(QGtkStylePrivate* sp) + : stylePrivate(sp) + {} +private: + QGtkStylePrivate* stylePrivate; + bool eventFilter(QObject *obj, QEvent *e); +}; + typedef enum { GNOME_ICON_LOOKUP_FLAGS_NONE = 0, GNOME_ICON_LOOKUP_FLAGS_EMBEDDING_TEXT = 1<<0, @@ -220,21 +249,41 @@ typedef char* (*Ptr_gnome_icon_lookup_sync) ( GnomeIconLookupFlags flags, GnomeIconLookupResultFlags *result); -QT_BEGIN_NAMESPACE -class QGtk +class QGtkStylePrivate : public QCleanlooksStylePrivate { + Q_DECLARE_PUBLIC(QGtkStyle) public: + QGtkStylePrivate(); + + QGtkStyleFilter filter; + static GtkWidget* gtkWidget(const QString &path); static GtkStyle* gtkStyle(const QString &path = QLatin1String("GtkWindow")); - static void cleanup_gtk_widgets(); - static void initGtkWidgets(); + virtual void resolveGtk(); + virtual void initGtkMenu(); + virtual void initGtkTreeview(); + virtual void initGtkWidgets(); + + static void cleanupGtkWidgets(); + static bool isKDE4Session(); - static void applyCustomPaletteHash(); + void applyCustomPaletteHash(); static QFont getThemeFont(); static bool isThemeAvailable() { return gtkStyle() != 0; } + static bool getGConfBool(const QString &key, bool fallback = 0); + static QString getGConfString(const QString &key, const QString &fallback = QString()); + + virtual QString getThemeName() const; + virtual int getSpinboxArrowSize() const; + + static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent, + const QString &dir, const QString &filter, QString *selectedFilter, + QFileDialog::Options options, bool isSaveDialog = false, + QMap<GtkFileFilter *, QString> *filterMap = 0); + static QString openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options); static QString saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, @@ -242,8 +291,6 @@ public: static QString openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options); static QStringList openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options); - static QString getGConfString(const QString &key, const QString &fallback = QString()); - static bool getGConfBool(const QString &key, bool fallback = 0); static QIcon getFilesystemIcon(const QFileInfo &); static Ptr_gtk_container_forall gtk_container_forall; @@ -364,6 +411,29 @@ public: static Ptr_gnome_icon_lookup_sync gnome_icon_lookup_sync; static Ptr_gnome_vfs_init gnome_vfs_init; + + virtual QPalette gtkWidgetPalette(const QString >kWidgetName); + +protected: + typedef QHash<QString, GtkWidget*> WidgetMap; + + static inline WidgetMap *gtkWidgetMap() + { + static WidgetMap *map = 0; + if (!map) + map = new WidgetMap(); + return map; + } + + static QStringList extract_filter(const QString &rawFilter); + + virtual GtkWidget* getTextColorWidget() const; + static void setupGtkWidget(GtkWidget* widget); + static void addWidgetToMap(GtkWidget* widget); + static void addAllSubWidgets(GtkWidget *widget, gpointer v = 0); + static void addWidget(GtkWidget *widget); + + virtual void init(); }; // Helper to ensure that we have polished all our gtk widgets @@ -372,10 +442,10 @@ class QGtkStyleUpdateScheduler : public QObject { Q_OBJECT public slots: - void updateTheme(); + void updateTheme( QGtkStylePrivate* stylePrivate ); }; QT_END_NAMESPACE #endif // !QT_NO_STYLE_GTK -#endif // GTKSYMBOLS_H +#endif // QGTKSTYLE_P_H diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 9fd9ce9..fe7f5d7 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -2926,10 +2926,10 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } // Draw arrow p->save(); - p->setPen(option->palette.dark()); + p->setPen(option->palette.dark().color()); p->drawLine(menuarea.left(), menuarea.top() + 3, menuarea.left(), menuarea.bottom() - 3); - p->setPen(option->palette.light()); + p->setPen(option->palette.light().color()); p->drawLine(menuarea.left() - 1, menuarea.top() + 3, menuarea.left() - 1, menuarea.bottom() - 3); diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 767ade0..88a2cce 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -109,10 +109,10 @@ contains( styles, plastique ) { contains( styles, gtk ) { HEADERS += styles/qgtkstyle.h HEADERS += styles/qgtkpainter_p.h - HEADERS += styles/gtksymbols_p.h + HEADERS += styles/qgtkstyle_p.h SOURCES += styles/qgtkstyle.cpp SOURCES += styles/qgtkpainter.cpp - SOURCES += styles/gtksymbols.cpp + SOURCES += styles/qgtkstyle_p.cpp !contains( styles, cleanlooks ) { styles += cleanlooks DEFINES+= QT_STYLE_CLEANLOOKS diff --git a/src/gui/symbian/qsymbianevent.cpp b/src/gui/symbian/qsymbianevent.cpp index af2c861..2799e6f 100644 --- a/src/gui/symbian/qsymbianevent.cpp +++ b/src/gui/symbian/qsymbianevent.cpp @@ -66,13 +66,13 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QSymbianEvent::type() + \fn QSymbianEvent::type() const Returns the event type contained in the QSymbianEvent instance. */ /*! - \fn QSymbianEvent::isValid() + \fn QSymbianEvent::isValid() const Returns whether this QSymbianEvent instance contains a valid event. */ diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index 6ff0fbd..94974fc 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -819,7 +819,7 @@ FT_Face QFontEngineQPF::lockFace() const FT_Face face = freetype->face; // ### not perfect - const int ysize = int(fontDef.pixelSize) << 6; + const int ysize = qRound(fontDef.pixelSize * qreal(64)); const int xsize = ysize; if (freetype->xsize != xsize || freetype->ysize != ysize) { diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index ee8b751..3f6545c 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1619,9 +1619,11 @@ void QTextControlPrivate::mouseMoveEvent(Qt::MouseButtons buttons, const QPointF if (cursor.position() != oldCursorPos) emit q->cursorPositionChanged(); _q_updateCurrentCharFormatAndSelection(); +#ifndef QT_NO_IM if (QInputContext *ic = inputContext()) { ic->update(); } +#endif //QT_NO_IM } else { //emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1))); if (cursor.position() != oldCursorPos) diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 6978b6c..1aad385 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -958,6 +958,8 @@ QString QTextDocument::defaultStyleSheet() const /*! Returns true if undo is available; otherwise returns false. + + \sa isRedoAvailable(), availableUndoSteps() */ bool QTextDocument::isUndoAvailable() const { @@ -967,6 +969,8 @@ bool QTextDocument::isUndoAvailable() const /*! Returns true if redo is available; otherwise returns false. + + \sa isUndoAvailable(), availableRedoSteps() */ bool QTextDocument::isRedoAvailable() const { @@ -974,6 +978,29 @@ bool QTextDocument::isRedoAvailable() const return d->isRedoAvailable(); } +/*! \since 4.6 + + Returns the number of available undo steps. + + \sa isUndoAvailable() +*/ +int QTextDocument::availableUndoSteps() const +{ + Q_D(const QTextDocument); + return d->availableUndoSteps(); +} + +/*! \since 4.6 + + Returns the number of available redo steps. + + \sa isRedoAvailable() +*/ +int QTextDocument::availableRedoSteps() const +{ + Q_D(const QTextDocument); + return d->availableRedoSteps(); +} /*! \since 4.4 diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index e52716a..d217a4d 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -142,6 +142,9 @@ public: bool isUndoAvailable() const; bool isRedoAvailable() const; + int availableUndoSteps() const; + int availableRedoSteps() const; + int revision() const; void setDocumentLayout(QAbstractTextDocumentLayout *layout); diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index ce25c57..c10855b 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -212,6 +212,9 @@ public: inline bool isUndoAvailable() const { return undoEnabled && undoState > 0; } inline bool isRedoAvailable() const { return undoEnabled && undoState < undoStack.size(); } + inline int availableUndoSteps() const { return undoEnabled ? undoState : 0; } + inline int availableRedoSteps() const { return undoEnabled ? qMax(undoStack.size() - undoState - 1, 0) : 0; } + inline QString buffer() const { return text; } QString plainText() const; inline int length() const { return fragments.length(); } diff --git a/src/gui/text/qtextengine_mac.cpp b/src/gui/text/qtextengine_mac.cpp index eeccc72..54be53b 100644 --- a/src/gui/text/qtextengine_mac.cpp +++ b/src/gui/text/qtextengine_mac.cpp @@ -594,53 +594,50 @@ void QTextEngine::shapeTextMac(int item) const str = reinterpret_cast<const QChar *>(uc); } - while (true) { - ensureSpace(num_glyphs); - num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; - - QGlyphLayout g = availableGlyphs(&si); - g.numGlyphs = num_glyphs; - unsigned short *log_clusters = logClusters(&si); + ensureSpace(num_glyphs); + num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; - if (fe->stringToCMap(str, - len, - &g, - &num_glyphs, - flags, - log_clusters, - attributes())) { + QGlyphLayout g = availableGlyphs(&si); + g.numGlyphs = num_glyphs; + unsigned short *log_clusters = logClusters(&si); - heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - break; - } + bool stringToCMapFailed = false; + if (!fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, attributes())) { + ensureSpace(num_glyphs); + stringToCMapFailed = fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, + attributes()); } - si.num_glyphs = num_glyphs; + if (!stringToCMapFailed) { + heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - layoutData->used += si.num_glyphs; + si.num_glyphs = num_glyphs; - QGlyphLayout g = shapedGlyphs(&si); + layoutData->used += si.num_glyphs; - if (si.analysis.script == QUnicodeTables::Arabic) { - QVarLengthArray<QArabicProperties> props(len + 2); - QArabicProperties *properties = props.data(); - int f = si.position; - int l = len; - if (f > 0) { - --f; - ++l; - ++properties; - } - if (f + l < layoutData->string.length()) { - ++l; - } - qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data()); + QGlyphLayout g = shapedGlyphs(&si); - unsigned short *log_clusters = logClusters(&si); + if (si.analysis.script == QUnicodeTables::Arabic) { + QVarLengthArray<QArabicProperties> props(len + 2); + QArabicProperties *properties = props.data(); + int f = si.position; + int l = len; + if (f > 0) { + --f; + ++l; + ++properties; + } + if (f + l < layoutData->string.length()) { + ++l; + } + qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data()); - for (int i = 0; i < len; ++i) { - int gpos = log_clusters[i]; - g.attributes[gpos].justification = properties[i].justification; + unsigned short *log_clusters = logClusters(&si); + + for (int i = 0; i < len; ++i) { + int gpos = log_clusters[i]; + g.attributes[gpos].justification = properties[i].justification; + } } } diff --git a/src/gui/widgets/qcombobox.h b/src/gui/widgets/qcombobox.h index 485e562..5d5ea21 100644 --- a/src/gui/widgets/qcombobox.h +++ b/src/gui/widgets/qcombobox.h @@ -52,7 +52,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Gui) - #ifndef QT_NO_COMBOBOX class QAbstractItemView; diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index 6895e09..dffec11 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1556,9 +1556,10 @@ void QDockAreaLayoutInfo::apply(bool animate) } } } - +#ifndef QT_NO_TABBAR if (sep == 1) updateSeparatorWidgets(); +#endif //QT_NO_TABBAR } static void paintSep(QPainter *p, QWidget *w, const QRect &r, Qt::Orientation o, bool mouse_over) @@ -2008,13 +2009,14 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*> updateTabBar(); setCurrentTabId(tabId(item_list.at(index))); } -#endif if (!testing && sep == 1) updateSeparatorWidgets(); +#endif return true; } +#ifndef QT_NO_TABBAR void QDockAreaLayoutInfo::updateSeparatorWidgets() const { if (tabbed) { @@ -2065,6 +2067,7 @@ void QDockAreaLayoutInfo::updateSeparatorWidgets() const separatorWidgets.resize(j); Q_ASSERT(separatorWidgets.size() == j); } +#endif //QT_NO_TABBAR #ifndef QT_NO_TABBAR void QDockAreaLayoutInfo::updateTabBar() const @@ -3078,9 +3081,10 @@ void QDockAreaLayout::apply(bool animate) widgetAnimator.animate(centralWidgetItem->widget(), centralWidgetRect, animate); } - +#ifndef QT_NO_TABBAR if (sep == 1) updateSeparatorWidgets(); +#endif //QT_NO_TABBAR } void QDockAreaLayout::paintSeparators(QPainter *p, QWidget *widget, @@ -3158,6 +3162,7 @@ int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &or return delta; } +#ifndef QT_NO_TABBAR // Sets the correct positions for the seperator widgets // Allocates new sepearator widgets with getSeparatorWidget void QDockAreaLayout::updateSeparatorWidgets() const @@ -3191,6 +3196,7 @@ void QDockAreaLayout::updateSeparatorWidgets() const separatorWidgets.resize(j); } +#endif //QT_NO_TABBAR QLayoutItem *QDockAreaLayout::itemAt(int *x, int index) const { @@ -3243,7 +3249,6 @@ QSet<QTabBar*> QDockAreaLayout::usedTabBars() const } return result; } -#endif // Returns the set of all used separator widgets QSet<QWidget*> QDockAreaLayout::usedSeparatorWidgets() const @@ -3258,6 +3263,7 @@ QSet<QWidget*> QDockAreaLayout::usedSeparatorWidgets() const } return result; } +#endif QRect QDockAreaLayout::gapRect(const QList<int> &path) const { diff --git a/src/gui/widgets/qdockarealayout_p.h b/src/gui/widgets/qdockarealayout_p.h index 065890d..bd2067b 100644 --- a/src/gui/widgets/qdockarealayout_p.h +++ b/src/gui/widgets/qdockarealayout_p.h @@ -196,9 +196,10 @@ public: QRect rect; QMainWindow *mainWindow; QList<QDockAreaLayoutItem> item_list; - +#ifndef QT_NO_TABBAR void updateSeparatorWidgets() const; QSet<QWidget*> usedSeparatorWidgets() const; +#endif //QT_NO_TABBAR #ifndef QT_NO_TABBAR quintptr currentTabId() const; @@ -279,7 +280,9 @@ public: const QPoint &mouse) const; QRegion separatorRegion() const; int separatorMove(const QList<int> &separator, const QPoint &origin, const QPoint &dest); +#ifndef QT_NO_TABBAR void updateSeparatorWidgets() const; +#endif //QT_NO_TABBAR QLayoutItem *itemAt(int *x, int index) const; QLayoutItem *takeAt(int *x, int index); @@ -293,9 +296,10 @@ public: QRect gapRect(const QList<int> &path) const; void keepSize(QDockWidget *w); - +#ifndef QT_NO_TABBAR QSet<QTabBar*> usedTabBars() const; QSet<QWidget*> usedSeparatorWidgets() const; +#endif //QT_NO_TABBAR }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 26b9c95..2c9cdd9 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -447,8 +447,9 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) cursorPositionChanged = true; } } - +#ifndef QT_NO_IM setPreeditArea(m_cursor, event->preeditString()); +#endif //QT_NO_IM m_preeditCursor = event->preeditString().length(); m_hideCursor = false; QList<QTextLayout::FormatRange> formats; diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index 68898b6..f8e1a5d 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -174,8 +174,10 @@ public: void setMaxLength(int maxLength); int maxLength() const; +#ifndef QT_NO_VALIDATOR const QValidator *validator() const; void setValidator(const QValidator *); +#endif #ifndef QT_NO_COMPLETER QCompleter *completer() const; @@ -282,7 +284,9 @@ private: bool finishChange(int validateFromState = -1, bool update = false, bool edited = true); +#ifndef QT_NO_VALIDATOR QPointer<QValidator> m_validator; +#endif QPointer<QCompleter> m_completer; #ifndef QT_NO_COMPLETER bool advanceToEnabledItem(int dir); @@ -623,6 +627,7 @@ inline int QLineControl::maxLength() const return m_maxLength; } +#ifndef QT_NO_VALIDATOR inline const QValidator *QLineControl::validator() const { return m_validator; @@ -632,6 +637,7 @@ inline void QLineControl::setValidator(const QValidator *v) { m_validator = const_cast<QValidator*>(v); } +#endif #ifndef QT_NO_COMPLETER inline QCompleter *QLineControl::completer() const diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index fc61889..bb93546 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -1599,7 +1599,6 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e) return; } } -#endif // QT_NO_SHORTCUT if (!(tif & Qt::TextEditable)) { switch (e->key()) { @@ -1627,6 +1626,7 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e) } return; } +#endif // QT_NO_SHORTCUT d->sendControlEvent(e); #ifdef QT_KEYPAD_NAVIGATION diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index f477fee..d995e0f 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -1246,7 +1246,6 @@ void QTextEdit::keyPressEvent(QKeyEvent *e) return; } } -#endif // QT_NO_SHORTCUT if (!(tif & Qt::TextEditable)) { switch (e->key()) { @@ -1274,6 +1273,7 @@ void QTextEdit::keyPressEvent(QKeyEvent *e) } return; } +#endif // QT_NO_SHORTCUT { QTextCursor cursor = d->control->textCursor(); diff --git a/src/gui/widgets/qwidgetanimator.cpp b/src/gui/widgets/qwidgetanimator.cpp index 4a7ae00..13ee346 100644 --- a/src/gui/widgets/qwidgetanimator.cpp +++ b/src/gui/widgets/qwidgetanimator.cpp @@ -103,7 +103,9 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo #else //we do it in one shot widget->setGeometry(final_geometry); +#ifndef QT_NO_MAINWINDOW m_mainWindowLayout->animationFinished(widget); +#endif //QT_NO_MAINWINDOW #endif //QT_NO_ANIMATION } diff --git a/src/multimedia/video/qabstractvideosurface.cpp b/src/multimedia/video/qabstractvideosurface.cpp index a4f51a2..33dc815 100644 --- a/src/multimedia/video/qabstractvideosurface.cpp +++ b/src/multimedia/video/qabstractvideosurface.cpp @@ -57,8 +57,8 @@ QT_BEGIN_NAMESPACE of each frame is compatible with a stream format supplied when starting a presentation. A list of pixel formats a surface can present is given by the supportedPixelFormats() function, - and the isFormatSupported() function will test if a complete video format is supported. In - some cases when a format is not supported; isFormatSupported() may suggest a similar format. + and the isFormatSupported() function will test if a video surface format is supported. If a + format is not supported the nearestFormat() function may be able to suggest a similar format. For example if a surface supports fixed set of resolutions it may suggest the smallest supported resolution that contains the proposed resolution. @@ -118,21 +118,37 @@ QAbstractVideoSurface::~QAbstractVideoSurface() */ /*! - Tests a video \a format to determine if a surface can accept it. If the format isn't supported - the surface may suggest a \a similar format that is supported. + Tests a video surface \a format to determine if a surface can accept it. Returns true if the format is supported by the surface, and false otherwise. */ -bool QAbstractVideoSurface::isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const +bool QAbstractVideoSurface::isFormatSupported(const QVideoSurfaceFormat &format) const { - Q_UNUSED(similar); - return supportedPixelFormats(format.handleType()).contains(format.pixelFormat()); } /*! + Returns a supported video surface format that is similar to \a format. + + A similar surface format is one that has the same \l {QVideoSurfaceFormat::pixelFormat()}{pixel + format} and \l {QVideoSurfaceFormat::handleType()}{handle type} but differs in some of the other + properties. For example if there are restrictions on the \l {QVideoSurfaceFormat::frameSize()} + {frame sizes} a video surface can accept it may suggest a format with a larger frame size and + a \l {QVideoSurfaceFormat::viewport()}{viewport} the size of the original frame size. + + If the format is already supported it will be returned unchanged, or if there is no similar + supported format an invalid format will be returned. +*/ + +QVideoSurfaceFormat QAbstractVideoSurface::nearestFormat(const QVideoSurfaceFormat &format) const +{ + return isFormatSupported(format) + ? format + : QVideoSurfaceFormat(); +} + +/*! \fn QAbstractVideoSurface::supportedFormatsChanged() Signals that the set of formats supported by a video surface has changed. @@ -162,23 +178,23 @@ QVideoSurfaceFormat QAbstractVideoSurface::surfaceFormat() const Returns true if the surface was started, and false if an error occurred. - \sa isStarted(), stop() + \sa isActive(), stop() */ bool QAbstractVideoSurface::start(const QVideoSurfaceFormat &format) { Q_D(QAbstractVideoSurface); - bool wasStarted = d->started; + bool wasActive = d->active; - d->started = true; + d->active = true; d->format = format; d->error = NoError; emit surfaceFormatChanged(d->format); - if (!wasStarted) - emit startedChanged(true); + if (!wasActive) + emit activeChanged(true); return true; } @@ -186,18 +202,18 @@ bool QAbstractVideoSurface::start(const QVideoSurfaceFormat &format) /*! Stops a video surface presenting frames and releases any resources acquired in start(). - \sa isStarted(), start() + \sa isActive(), start() */ void QAbstractVideoSurface::stop() { Q_D(QAbstractVideoSurface); - if (d->started) { + if (d->active) { d->format = QVideoSurfaceFormat(); - d->started = false; + d->active = false; - emit startedChanged(false); + emit activeChanged(false); emit surfaceFormatChanged(d->format); } } @@ -208,17 +224,17 @@ void QAbstractVideoSurface::stop() Returns true if the surface has been started, and false otherwise. */ -bool QAbstractVideoSurface::isStarted() const +bool QAbstractVideoSurface::isActive() const { - return d_func()->started; + return d_func()->active; } /*! - \fn QAbstractVideoSurface::startedChanged(bool started) + \fn QAbstractVideoSurface::activeChanged(bool active) - Signals that the \a started state of a video surface has changed. + Signals that the \a active state of a video surface has changed. - \sa isStarted(), start(), stop() + \sa isActive(), start(), stop() */ /*! diff --git a/src/multimedia/video/qabstractvideosurface.h b/src/multimedia/video/qabstractvideosurface.h index 3823eeb..58d06f1 100644 --- a/src/multimedia/video/qabstractvideosurface.h +++ b/src/multimedia/video/qabstractvideosurface.h @@ -75,22 +75,22 @@ public: virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats( QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const = 0; - virtual bool isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar = 0) const; + virtual bool isFormatSupported(const QVideoSurfaceFormat &format) const; + virtual QVideoSurfaceFormat nearestFormat(const QVideoSurfaceFormat &format) const; QVideoSurfaceFormat surfaceFormat() const; virtual bool start(const QVideoSurfaceFormat &format); virtual void stop(); - bool isStarted() const; + bool isActive() const; virtual bool present(const QVideoFrame &frame) = 0; Error error() const; Q_SIGNALS: - void startedChanged(bool started); + void activeChanged(bool active); void surfaceFormatChanged(const QVideoSurfaceFormat &format); void supportedFormatsChanged(); diff --git a/src/multimedia/video/qabstractvideosurface_p.h b/src/multimedia/video/qabstractvideosurface_p.h index 3142b78..8675fac 100644 --- a/src/multimedia/video/qabstractvideosurface_p.h +++ b/src/multimedia/video/qabstractvideosurface_p.h @@ -64,14 +64,13 @@ class QAbstractVideoSurfacePrivate : public QObjectPrivate public: QAbstractVideoSurfacePrivate() : error(QAbstractVideoSurface::NoError) - , started(false) + , active(false) { } mutable QAbstractVideoSurface::Error error; QVideoSurfaceFormat format; - bool started; - + bool active; }; QT_END_NAMESPACE diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp index c884da0..ae38e82 100644 --- a/src/multimedia/video/qvideoframe.cpp +++ b/src/multimedia/video/qvideoframe.cpp @@ -59,7 +59,7 @@ public: : startTime(-1) , endTime(-1) , data(0) - , numBytes(0) + , mappedBytes(0) , bytesPerLine(0) , pixelFormat(QVideoFrame::Format_Invalid) , fieldType(QVideoFrame::ProgressiveFrame) @@ -72,7 +72,7 @@ public: , startTime(-1) , endTime(-1) , data(0) - , numBytes(0) + , mappedBytes(0) , bytesPerLine(0) , pixelFormat(format) , fieldType(QVideoFrame::ProgressiveFrame) @@ -89,7 +89,7 @@ public: qint64 startTime; qint64 endTime; uchar *data; - int numBytes; + int mappedBytes; int bytesPerLine; QVideoFrame::PixelFormat pixelFormat; QVideoFrame::FieldType fieldType; @@ -109,7 +109,7 @@ private: The contents of a video frame can be mapped to memory using the map() function. While mapped the video data can accessed using the bits() function which returns a pointer to a - buffer, the total size of which is given by the numBytes(), and the size of each line is given + buffer, the total size of which is given by the mappedBytes(), and the size of each line is given by bytesPerLine(). The return value of the handle() function may be used to access frame data using the internal buffer's native APIs. @@ -304,12 +304,12 @@ QVideoFrame::QVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFo \note This will construct an invalid video frame if there is no frame type equivalent to the image format. - \sa equivalentPixelFormat() + \sa pixelFormatFromImageFormat() */ QVideoFrame::QVideoFrame(const QImage &image) : d(new QVideoFramePrivate( - image.size(), equivalentPixelFormat(image.format()))) + image.size(), pixelFormatFromImageFormat(image.format()))) { if (d->pixelFormat != Format_Invalid) d->buffer = new QImageVideoBuffer(image); @@ -510,9 +510,9 @@ bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode) { if (d->buffer != 0 && d->data == 0) { Q_ASSERT(d->bytesPerLine == 0); - Q_ASSERT(d->numBytes == 0); + Q_ASSERT(d->mappedBytes == 0); - d->data = d->buffer->map(mode, &d->numBytes, &d->bytesPerLine); + d->data = d->buffer->map(mode, &d->mappedBytes, &d->bytesPerLine); return d->data != 0; } @@ -532,7 +532,7 @@ bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode) void QVideoFrame::unmap() { if (d->data != 0) { - d->numBytes = 0; + d->mappedBytes = 0; d->bytesPerLine = 0; d->data = 0; @@ -548,7 +548,7 @@ void QVideoFrame::unmap() This value is only valid while the frame data is \l {map()}{mapped}. - \sa bits(), map(), numBytes() + \sa bits(), map(), mappedBytes() */ int QVideoFrame::bytesPerLine() const @@ -561,7 +561,7 @@ int QVideoFrame::bytesPerLine() const This value is only valid while the frame data is \l {map()}{mapped}. - \sa map(), numBytes(), bytesPerLine() + \sa map(), mappedBytes(), bytesPerLine() */ uchar *QVideoFrame::bits() @@ -574,7 +574,7 @@ uchar *QVideoFrame::bits() This value is only valid while the frame data is \l {map()}{mapped}. - \sa map(), numBytes(), bytesPerLine() + \sa map(), mappedBytes(), bytesPerLine() */ const uchar *QVideoFrame::bits() const @@ -583,16 +583,16 @@ const uchar *QVideoFrame::bits() const } /*! - Returns the number of bytes occupied by the frame data. + Returns the number of bytes occupied by the mapped frame data. This value is only valid while the frame data is \l {map()}{mapped}. \sa map() */ -int QVideoFrame::numBytes() const +int QVideoFrame::mappedBytes() const { - return d->numBytes; + return d->mappedBytes; } /*! @@ -649,7 +649,7 @@ void QVideoFrame::setEndTime(qint64 time) format QVideoFrame::InvalidType is returned instead. */ -QVideoFrame::PixelFormat QVideoFrame::equivalentPixelFormat(QImage::Format format) +QVideoFrame::PixelFormat QVideoFrame::pixelFormatFromImageFormat(QImage::Format format) { switch (format) { case QImage::Format_Invalid: @@ -689,7 +689,7 @@ QVideoFrame::PixelFormat QVideoFrame::equivalentPixelFormat(QImage::Format forma format QImage::Format_Invalid is returned instead. */ -QImage::Format QVideoFrame::equivalentImageFormat(PixelFormat format) +QImage::Format QVideoFrame::imageFormatFromPixelFormat(PixelFormat format) { switch (format) { case Format_Invalid: diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h index e1b46a8..d08008b 100644 --- a/src/multimedia/video/qvideoframe.h +++ b/src/multimedia/video/qvideoframe.h @@ -141,7 +141,7 @@ public: uchar *bits(); const uchar *bits() const; - int numBytes() const; + int mappedBytes() const; QVariant handle() const; @@ -151,8 +151,8 @@ public: qint64 endTime() const; void setEndTime(qint64 time); - static PixelFormat equivalentPixelFormat(QImage::Format format); - static QImage::Format equivalentImageFormat(PixelFormat format); + static PixelFormat pixelFormatFromImageFormat(QImage::Format format); + static QImage::Format imageFormatFromPixelFormat(PixelFormat format); private: QExplicitlySharedDataPointer<QVideoFramePrivate> d; diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp index e6ef8f3..c898e3a 100644 --- a/src/multimedia/video/qvideosurfaceformat.cpp +++ b/src/multimedia/video/qvideosurfaceformat.cpp @@ -57,7 +57,7 @@ public: , handleType(QAbstractVideoBuffer::NoHandle) , scanLineDirection(QVideoSurfaceFormat::TopToBottom) , pixelAspectRatio(1, 1) - , yuvColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) + , ycbcrColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) , frameRate(0.0) { } @@ -71,7 +71,7 @@ public: , scanLineDirection(QVideoSurfaceFormat::TopToBottom) , frameSize(size) , pixelAspectRatio(1, 1) - , yuvColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) + , ycbcrColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) , viewport(QPoint(0, 0), size) , frameRate(0.0) { @@ -84,7 +84,7 @@ public: , scanLineDirection(other.scanLineDirection) , frameSize(other.frameSize) , pixelAspectRatio(other.pixelAspectRatio) - , yuvColorSpace(other.yuvColorSpace) + , ycbcrColorSpace(other.ycbcrColorSpace) , viewport(other.viewport) , frameRate(other.frameRate) , propertyNames(other.propertyNames) @@ -101,7 +101,7 @@ public: && pixelAspectRatio == other.pixelAspectRatio && viewport == other.viewport && frameRatesEqual(frameRate, other.frameRate) - && yuvColorSpace == other.yuvColorSpace + && ycbcrColorSpace == other.ycbcrColorSpace && propertyNames.count() == other.propertyNames.count()) { for (int i = 0; i < propertyNames.count(); ++i) { int j = other.propertyNames.indexOf(propertyNames.at(i)); @@ -125,7 +125,7 @@ public: QVideoSurfaceFormat::Direction scanLineDirection; QSize frameSize; QSize pixelAspectRatio; - QVideoSurfaceFormat::YuvColorSpace yuvColorSpace; + QVideoSurfaceFormat::YCbCrColorSpace ycbcrColorSpace; QRect viewport; qreal frameRate; QList<QByteArray> propertyNames; @@ -168,19 +168,10 @@ public: \value BottomToTop Scan lines are arranged from the bottom of the frame to the top. */ -/*! - \enum QVideoSurfaceFormat::ViewportMode - - Enumerates the methods for updating the stream viewport when the frame size is changed. - - \value ResetViewport The viewport is reset to cover an entire frame. - \value KeepViewport The viewport is kept within the bounds the frame. -*/ - /*! - \enum QVideoSurfaceFormat::YuvColorSpace + \enum QVideoSurfaceFormat::YCbCrColorSpace - Enumerates the YUV color space of video frames. + Enumerates the Y'CbCr color space of video frames. \value YCbCr_Undefined No color space is specified. @@ -340,21 +331,13 @@ int QVideoSurfaceFormat::frameHeight() const /*! Sets the size of frames in a video stream to \a size. - The viewport \a mode indicates how the view port should be updated. + This will reset the viewport() to fill the entire frame. */ -void QVideoSurfaceFormat::setFrameSize(const QSize &size, ViewportMode mode) +void QVideoSurfaceFormat::setFrameSize(const QSize &size) { d->frameSize = size; - - switch (mode) { - case ResetViewport: - d->viewport = QRect(QPoint(0, 0), size); - break; - case KeepViewport: - d->viewport = QRect(QPoint(0, 0), size).intersected(d->viewport); - break; - } + d->viewport = QRect(QPoint(0, 0), size); } /*! @@ -362,12 +345,13 @@ void QVideoSurfaceFormat::setFrameSize(const QSize &size, ViewportMode mode) Sets the \a width and \a height of frames in a video stream. - The viewport \a mode indicates how the view port should be updated. + This will reset the viewport() to fill the entire frame. */ -void QVideoSurfaceFormat::setFrameSize(int width, int height, ViewportMode mode) +void QVideoSurfaceFormat::setFrameSize(int width, int height) { - setFrameSize(QSize(width, height), mode); + d->frameSize = QSize(width, height); + d->viewport = QRect(0, 0, width, height); } /*! @@ -458,22 +442,22 @@ void QVideoSurfaceFormat::setPixelAspectRatio(int horizontal, int vertical) } /*! - Returns a YUV color space of a video stream. + Returns the Y'CbCr color space of a video stream. */ -QVideoSurfaceFormat::YuvColorSpace QVideoSurfaceFormat::yuvColorSpace() const +QVideoSurfaceFormat::YCbCrColorSpace QVideoSurfaceFormat::yCbCrColorSpace() const { - return d->yuvColorSpace; + return d->ycbcrColorSpace; } /*! - Sets a YUV color \a space of a video stream. + Sets the Y'CbCr color \a space of a video stream. It is only used with raw YUV frame types. */ -void QVideoSurfaceFormat::setYuvColorSpace(QVideoSurfaceFormat::YuvColorSpace space) +void QVideoSurfaceFormat::setYCbCrColorSpace(QVideoSurfaceFormat::YCbCrColorSpace space) { - d->yuvColorSpace = space; + d->ycbcrColorSpace = space; } /*! @@ -508,7 +492,7 @@ QList<QByteArray> QVideoSurfaceFormat::propertyNames() const << "frameRate" << "pixelAspectRatio" << "sizeHint" - << "yuvColorSpace") + << "yCbCrColorSpace") + d->propertyNames; } @@ -540,8 +524,8 @@ QVariant QVideoSurfaceFormat::property(const char *name) const return qVariantFromValue(d->pixelAspectRatio); } else if (qstrcmp(name, "sizeHint") == 0) { return sizeHint(); - } else if (qstrcmp(name, "yuvColorSpace") == 0) { - return qVariantFromValue(d->yuvColorSpace); + } else if (qstrcmp(name, "yCbCrColorSpace") == 0) { + return qVariantFromValue(d->ycbcrColorSpace); } else { int id = 0; for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {} @@ -585,9 +569,9 @@ void QVideoSurfaceFormat::setProperty(const char *name, const QVariant &value) d->pixelAspectRatio = qvariant_cast<QSize>(value); } else if (qstrcmp(name, "sizeHint") == 0) { // read only. - } else if (qstrcmp(name, "yuvColorSpace") == 0) { - if (qVariantCanConvert<YuvColorSpace>(value)) - d->yuvColorSpace = qvariant_cast<YuvColorSpace>(value); + } else if (qstrcmp(name, "yCbCrColorSpace") == 0) { + if (qVariantCanConvert<YCbCrColorSpace>(value)) + d->ycbcrColorSpace = qvariant_cast<YCbCrColorSpace>(value); } else { int id = 0; for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {} diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h index 1f4a5cb..ee60244 100644 --- a/src/multimedia/video/qvideosurfaceformat.h +++ b/src/multimedia/video/qvideosurfaceformat.h @@ -68,13 +68,7 @@ public: BottomToTop }; - enum ViewportMode - { - ResetViewport, - KeepViewport - }; - - enum YuvColorSpace + enum YCbCrColorSpace { YCbCr_Undefined, YCbCr_BT601, @@ -106,8 +100,8 @@ public: QAbstractVideoBuffer::HandleType handleType() const; QSize frameSize() const; - void setFrameSize(const QSize &size, ViewportMode mode = ResetViewport); - void setFrameSize(int width, int height, ViewportMode mode = ResetViewport); + void setFrameSize(const QSize &size); + void setFrameSize(int width, int height); int frameWidth() const; int frameHeight() const; @@ -125,8 +119,8 @@ public: void setPixelAspectRatio(const QSize &ratio); void setPixelAspectRatio(int width, int height); - YuvColorSpace yuvColorSpace() const; - void setYuvColorSpace(YuvColorSpace colorSpace); + YCbCrColorSpace yCbCrColorSpace() const; + void setYCbCrColorSpace(YCbCrColorSpace colorSpace); QSize sizeHint() const; @@ -145,7 +139,7 @@ Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoSurfaceFormat &); QT_END_NAMESPACE Q_DECLARE_METATYPE(QVideoSurfaceFormat::Direction) -Q_DECLARE_METATYPE(QVideoSurfaceFormat::YuvColorSpace) +Q_DECLARE_METATYPE(QVideoSurfaceFormat::YCbCrColorSpace) QT_END_HEADER diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp index b4af5b6..4f7f15c 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend.cpp +++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp @@ -229,7 +229,7 @@ void QNetworkAccessDebugPipeBackend::possiblyFinish() void QNetworkAccessDebugPipeBackend::closeDownstreamChannel() { - qWarning() << "QNetworkAccessDebugPipeBackend::closeDownstreamChannel()" << operation(); + qWarning("QNetworkAccessDebugPipeBackend::closeDownstreamChannel()",operation());; //if (operation() == QNetworkAccessManager::GetOperation) // socket.disconnectFromHost(); } @@ -237,7 +237,7 @@ void QNetworkAccessDebugPipeBackend::closeDownstreamChannel() void QNetworkAccessDebugPipeBackend::socketError() { - qWarning() << "QNetworkAccessDebugPipeBackend::socketError()" << socket.error(); + qWarning("QNetworkAccessDebugPipeBackend::socketError()", socket.error()); QNetworkReply::NetworkError code; switch (socket.error()) { case QAbstractSocket::RemoteHostClosedError: diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 9fb0b47..89a6e91 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -462,6 +462,7 @@ QAbstractSocketPrivate::QAbstractSocketPrivate() isBuffered(false), blockingTimeout(30000), connectTimer(0), + disconnectTimer(0), connectTimeElapsed(0), hostLookupId(-1), socketType(QAbstractSocket::UnknownSocketType), @@ -497,9 +498,10 @@ void QAbstractSocketPrivate::resetSocketLayer() socketEngine = 0; cachedSocketDescriptor = -1; } - if (connectTimer) { + if (connectTimer) connectTimer->stop(); - } + if (disconnectTimer) + disconnectTimer->stop(); } /*! \internal @@ -669,11 +671,11 @@ bool QAbstractSocketPrivate::canWriteNotification() if (socketEngine) { #if defined (Q_OS_WIN) - if (!writeBuffer.isEmpty()) - socketEngine->setWriteNotificationEnabled(true); + if (!writeBuffer.isEmpty()) + socketEngine->setWriteNotificationEnabled(true); #else - if (writeBuffer.isEmpty()) - socketEngine->setWriteNotificationEnabled(false); + if (writeBuffer.isEmpty() && socketEngine->bytesToWrite() == 0) + socketEngine->setWriteNotificationEnabled(false); #endif } @@ -710,11 +712,17 @@ void QAbstractSocketPrivate::connectionNotification() bool QAbstractSocketPrivate::flush() { Q_Q(QAbstractSocket); - if (!socketEngine || !socketEngine->isValid() || writeBuffer.isEmpty()) { + if (!socketEngine || !socketEngine->isValid() || (writeBuffer.isEmpty() + && socketEngine->bytesToWrite() == 0)) { #if defined (QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::flush() nothing to do: valid ? %s, writeBuffer.isEmpty() ? %s", socketEngine->isValid() ? "yes" : "no", writeBuffer.isEmpty() ? "yes" : "no"); #endif + + // this covers the case when the buffer was empty, but we had to wait for the socket engine to finish + if (state == QAbstractSocket::ClosingState) + q->disconnectFromHost(); + return false; } @@ -751,7 +759,8 @@ bool QAbstractSocketPrivate::flush() } } - if (writeBuffer.isEmpty() && socketEngine && socketEngine->isWriteNotificationEnabled()) + if (writeBuffer.isEmpty() && socketEngine && socketEngine->isWriteNotificationEnabled() + && !socketEngine->bytesToWrite()) socketEngine->setWriteNotificationEnabled(false); if (state == QAbstractSocket::ClosingState) q->disconnectFromHost(); @@ -1087,6 +1096,15 @@ void QAbstractSocketPrivate::_q_abortConnectionAttempt() } } +void QAbstractSocketPrivate::_q_forceDisconnect() +{ + Q_Q(QAbstractSocket); + if (socketEngine && socketEngine->isValid() && state == QAbstractSocket::ClosingState) { + socketEngine->close(); + q->disconnectFromHost(); + } +} + /*! \internal Reads data from the socket layer into the read buffer. Returns @@ -2347,7 +2365,22 @@ void QAbstractSocket::disconnectFromHostImplementation() } // Wait for pending data to be written. - if (d->socketEngine && d->socketEngine->isValid() && d->writeBuffer.size() > 0) { + if (d->socketEngine && d->socketEngine->isValid() && (d->writeBuffer.size() > 0 + || d->socketEngine->bytesToWrite() > 0)) { + // hack: when we are waiting for the socket engine to write bytes (only + // possible when using Socks5 or HTTP socket engine), then close + // anyway after 2 seconds. This is to prevent a timeout on Mac, where we + // sometimes just did not get the write notifier from the underlying + // CFSocket and no progress was made. + if (d->writeBuffer.size() == 0 && d->socketEngine->bytesToWrite() > 0) { + if (!d->disconnectTimer) { + d->disconnectTimer = new QTimer(this); + connect(d->disconnectTimer, SIGNAL(timeout()), this, + SLOT(_q_forceDisconnect()), Qt::DirectConnection); + } + if (!d->disconnectTimer->isActive()) + d->disconnectTimer->start(2000); + } d->socketEngine->setWriteNotificationEnabled(true); #if defined(QABSTRACTSOCKET_DEBUG) diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h index 5d94a01..5cfae17 100644 --- a/src/network/socket/qabstractsocket.h +++ b/src/network/socket/qabstractsocket.h @@ -216,6 +216,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_startConnecting(const QHostInfo &)) Q_PRIVATE_SLOT(d_func(), void _q_abortConnectionAttempt()) Q_PRIVATE_SLOT(d_func(), void _q_testConnection()) + Q_PRIVATE_SLOT(d_func(), void _q_forceDisconnect()) #ifdef QT3_SUPPORT public: diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h index 8ccddd3..acf82bf 100644 --- a/src/network/socket/qabstractsocket_p.h +++ b/src/network/socket/qabstractsocket_p.h @@ -93,6 +93,7 @@ public: void _q_startConnecting(const QHostInfo &hostInfo); void _q_testConnection(); void _q_abortConnectionAttempt(); + void _q_forceDisconnect(); bool readSocketNotifierCalled; bool readSocketNotifierState; @@ -148,6 +149,7 @@ public: int blockingTimeout; QTimer *connectTimer; + QTimer *disconnectTimer; int connectTimeElapsed; int hostLookupId; diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h index c639092..14b3c81 100644 --- a/src/network/socket/qabstractsocketengine_p.h +++ b/src/network/socket/qabstractsocketengine_p.h @@ -126,6 +126,8 @@ public: virtual qint64 pendingDatagramSize() const = 0; #endif + virtual qint64 bytesToWrite() const = 0; + virtual int option(SocketOption option) const = 0; virtual bool setOption(SocketOption option, int value) = 0; diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index fb61dbf..5c28318 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -276,6 +276,16 @@ qint64 QHttpSocketEngine::pendingDatagramSize() const } #endif // QT_NO_UDPSOCKET +qint64 QHttpSocketEngine::bytesToWrite() const +{ + Q_D(const QHttpSocketEngine); + if (d->socket) { + return d->socket->bytesToWrite(); + } else { + return 0; + } +} + int QHttpSocketEngine::option(SocketOption option) const { Q_D(const QHttpSocketEngine); diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h index a423116..76430db 100644 --- a/src/network/socket/qhttpsocketengine_p.h +++ b/src/network/socket/qhttpsocketengine_p.h @@ -110,6 +110,8 @@ public: qint64 pendingDatagramSize() const; #endif // QT_NO_UDPSOCKET + qint64 bytesToWrite() const; + int option(SocketOption option) const; bool setOption(SocketOption option, int value); diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index 5ffe0c0..e09e547 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -216,24 +216,14 @@ void QLocalServerPrivate::waitForNewConnection(int msec, bool *timedOut) timeout.tv_sec = msec / 1000; timeout.tv_usec = (msec % 1000) * 1000; - // timeout can not be 0 or else select will return an error. - if (0 == msec) - timeout.tv_usec = 1000; - int result = -1; - // on Linux timeout will be updated by select, but _not_ on other systems. - QTime timer; - timer.start(); - while (pendingConnections.isEmpty() && (-1 == msec || timer.elapsed() < msec)) { - result = ::select(listenSocket + 1, &readfds, 0, 0, &timeout); - if (-1 == result && errno != EINTR) { - setError(QLatin1String("QLocalServer::waitForNewConnection")); - closeServer(); - break; - } - if (result > 0) - _q_onNewConnection(); + result = qt_safe_select(listenSocket + 1, &readfds, 0, 0, (msec == -1) ? 0 : &timeout); + if (-1 == result) { + setError(QLatin1String("QLocalServer::waitForNewConnection")); + closeServer(); } + if (result > 0) + _q_onNewConnection(); if (timedOut) *timedOut = (result == 0); } diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index 8de821b..ecf5ad9 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -754,6 +754,12 @@ qint64 QNativeSocketEngine::write(const char *data, qint64 size) return d->nativeWrite(data, size); } + +qint64 QNativeSocketEngine::bytesToWrite() const +{ + return 0; +} + /*! Reads up to \a maxSize bytes into \a data from the socket. Returns the number of bytes read, or -1 if an error occurred. diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 1f6a243..a03d8f1 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -135,6 +135,8 @@ public: bool hasPendingDatagrams() const; qint64 pendingDatagramSize() const; + qint64 bytesToWrite() const; + qint64 receiveBufferSize() const; void setReceiveBufferSize(qint64 bufferSize); diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 30074cf..bd60ad1 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -1235,6 +1235,9 @@ void QSocks5SocketEnginePrivate::_q_controlSocketError(QAbstractSocket::SocketEr if (!readNotificationPending) connectData->readBuffer.clear(); emitReadNotification(); + data->controlSocket->close(); + // cause a disconnect in the outer socket + emitWriteNotification(); } else if (socks5State == Uninitialized || socks5State == AuthenticationMethodsSent || socks5State == Authenticating @@ -1245,6 +1248,7 @@ void QSocks5SocketEnginePrivate::_q_controlSocketError(QAbstractSocket::SocketEr } else { q_func()->setError(data->controlSocket->error(), data->controlSocket->errorString()); emitReadNotification(); + emitWriteNotification(); } } @@ -1623,6 +1627,16 @@ qint64 QSocks5SocketEngine::pendingDatagramSize() const } #endif // QT_NO_UDPSOCKET +qint64 QSocks5SocketEngine::bytesToWrite() const +{ + Q_D(const QSocks5SocketEngine); + if (d->data && d->data->controlSocket) { + return d->data->controlSocket->bytesToWrite(); + } else { + return 0; + } +} + int QSocks5SocketEngine::option(SocketOption option) const { Q_D(const QSocks5SocketEngine); diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h index 7cb0920..2402517 100644 --- a/src/network/socket/qsocks5socketengine_p.h +++ b/src/network/socket/qsocks5socketengine_p.h @@ -100,6 +100,8 @@ public: qint64 pendingDatagramSize() const; #endif // QT_NO_UDPSOCKET + qint64 bytesToWrite() const; + int option(SocketOption option) const; bool setOption(SocketOption option, int value); diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp index 4bb58b1..e912626 100644 --- a/src/network/ssl/qsslerror.cpp +++ b/src/network/ssl/qsslerror.cpp @@ -252,10 +252,10 @@ QString QSslError::errorString() const errStr = QSslSocket::tr("One of the CA certificates is invalid"); break; case PathLengthExceeded: - errStr = QSslSocket::tr("The basicConstraints pathlength parameter has been exceeded"); + errStr = QSslSocket::tr("The basicConstraints path length parameter has been exceeded"); break; case InvalidPurpose: - errStr = QSslSocket::tr("The supplied certificate is unsuited for this purpose"); + errStr = QSslSocket::tr("The supplied certificate is unsuitable for this purpose"); break; case CertificateUntrusted: errStr = QSslSocket::tr("The root CA certificate is not trusted for this purpose"); diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 1f93534..cfa99c8 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -713,6 +713,8 @@ void QSslSocket::close() qDebug() << "QSslSocket::close()"; #endif Q_D(QSslSocket); + if (d->plainSocket) + d->plainSocket->close(); QTcpSocket::close(); // must be cleared, reading/writing not possible on closed socket: diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 6f7e55a..743722f 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -324,7 +324,7 @@ init_context: // Check if the certificate matches the private key. if (!q_SSL_CTX_check_private_key(ctx)) { - q->setErrorString(QSslSocket::tr("Private key does not certificate public key, %1").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Private key does not certify public key, %1").arg(SSL_ERRORSTR())); emit q->error(QAbstractSocket::UnknownSocketError); return false; } diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp index ab2026c..b71a7b7 100644 --- a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp +++ b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp @@ -67,8 +67,10 @@ QGLCustomShaderStage::QGLCustomShaderStage() QGLCustomShaderStage::~QGLCustomShaderStage() { Q_D(QGLCustomShaderStage); - if (d->m_manager) - d->m_manager->removeCustomStage(this); + if (d->m_manager) { + d->m_manager->removeCustomStage(); + d->m_manager->sharedShaders->cleanupCustomStage(this); + } } void QGLCustomShaderStage::setUniformsDirty() @@ -85,6 +87,8 @@ bool QGLCustomShaderStage::setOnPainter(QPainter* p) qWarning("QGLCustomShaderStage::setOnPainter() - paint engine not OpenGL2"); return false; } + if (d->m_manager) + qWarning("Custom shader is already set on a painter"); QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx*>(p->paintEngine()); d->m_manager = QGL2PaintEngineExPrivate::shaderManagerForEngine(engine); @@ -108,12 +112,21 @@ void QGLCustomShaderStage::removeFromPainter(QPainter* p) // This should leave the program in a compiled/linked state // if the next custom shader stage is this one again. d->m_manager->setCustomStage(0); + d->m_manager = 0; } -const char* QGLCustomShaderStage::source() const +QByteArray QGLCustomShaderStage::source() const { Q_D(const QGLCustomShaderStage); - return d->m_source.constData(); + return d->m_source; +} + +// Called by the shader manager if another custom shader is attached or +// the manager is deleted +void QGLCustomShaderStage::setInactive() +{ + Q_D(QGLCustomShaderStage); + d->m_manager = 0; } void QGLCustomShaderStage::setSource(const QByteArray& s) diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h index f8c13c5..e319389 100644 --- a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h +++ b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h @@ -74,8 +74,9 @@ public: bool setOnPainter(QPainter*); void removeFromPainter(QPainter*); - const char* source() const; + QByteArray source() const; + void setInactive(); protected: void setSource(const QByteArray&); diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index af9306f..40a6241 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -66,7 +66,7 @@ QGLEngineSharedShaders *QGLEngineSharedShaders::shadersForContext(const QGLConte return p; } -const char* QGLEngineSharedShaders::qglEngineShaderSourceCode[] = { +const char* QGLEngineSharedShaders::qShaderSnippets[] = { 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, @@ -78,7 +78,6 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) , blitShaderProg(0) , simpleShaderProg(0) { - memset(compiledShaders, 0, sizeof(compiledShaders)); /* Rather than having the shader source array statically initialised, it is initialised @@ -86,10 +85,10 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) around without having to change the order of the glsl strings. It is hoped this will make future hard-to-find runtime bugs more obvious and generally give more solid code. */ - static bool qglEngineShaderSourceCodePopulated = false; - if (!qglEngineShaderSourceCodePopulated) { + static bool snippetsPopulated = false; + if (!snippetsPopulated) { - const char** code = qglEngineShaderSourceCode; // shortcut + const char** code = qShaderSnippets; // shortcut code[MainVertexShader] = qglslMainVertexShader; code[MainWithTexCoordsVertexShader] = qglslMainWithTexCoordsVertexShader; @@ -121,7 +120,7 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) code[ImageSrcFragmentShader] = qglslImageSrcFragmentShader; code[ImageSrcWithPatternFragmentShader] = qglslImageSrcWithPatternFragmentShader; code[NonPremultipliedImageSrcFragmentShader] = qglslNonPremultipliedImageSrcFragmentShader; - code[CustomImageSrcFragmentShader] = ""; // Supplied by app. + code[CustomImageSrcFragmentShader] = qglslCustomSrcFragmentShader; // Calls "customShader", which must be appended code[SolidBrushSrcFragmentShader] = qglslSolidBrushSrcFragmentShader; code[TextureBrushSrcFragmentShader] = qglslTextureBrushSrcFragmentShader; code[TextureBrushSrcWithPatternFragmentShader] = qglslTextureBrushSrcWithPatternFragmentShader; @@ -131,11 +130,13 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) code[ConicalGradientBrushSrcFragmentShader] = qglslConicalGradientBrushSrcFragmentShader; code[ShockingPinkSrcFragmentShader] = qglslShockingPinkSrcFragmentShader; + code[NoMaskFragmentShader] = ""; code[MaskFragmentShader] = qglslMaskFragmentShader; code[RgbMaskFragmentShaderPass1] = qglslRgbMaskFragmentShaderPass1; code[RgbMaskFragmentShaderPass2] = qglslRgbMaskFragmentShaderPass2; code[RgbMaskWithGammaFragmentShader] = ""; //### + code[NoCompositionModeFragmentShader] = ""; code[MultiplyCompositionModeFragmentShader] = ""; //### code[ScreenCompositionModeFragmentShader] = ""; //### code[OverlayCompositionModeFragmentShader] = ""; //### @@ -150,29 +151,36 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) #if defined(QT_DEBUG) // Check that all the elements have been filled: - for (int i = 0; i < TotalShaderCount; ++i) { - if (qglEngineShaderSourceCode[i] == 0) { - int enumIndex = staticMetaObject.indexOfEnumerator("ShaderName"); - QMetaEnum m = staticMetaObject.enumerator(enumIndex); - - qCritical() << "qglEngineShaderSourceCode: Source for" << m.valueToKey(i) - << "(shader" << i << ") missing!"; + for (int i = 0; i < TotalSnippetCount; ++i) { + if (qShaderSnippets[i] == 0) { + qFatal("Shader snippet for %s (#%d) is missing!", + snippetNameStr(SnippetName(i)).constData(), i); } } #endif - qglEngineShaderSourceCodePopulated = true; + snippetsPopulated = true; } + QGLShader* fragShader; + QGLShader* vertexShader; + QByteArray source; + // Compile up the simple shader: + source.clear(); + source.append(qShaderSnippets[MainVertexShader]); + source.append(qShaderSnippets[PositionOnlyVertexShader]); + vertexShader = new QGLShader(QGLShader::VertexShader, context, this); + vertexShader->compile(source); + + source.clear(); + source.append(qShaderSnippets[MainFragmentShader]); + source.append(qShaderSnippets[ShockingPinkSrcFragmentShader]); + fragShader = new QGLShader(QGLShader::FragmentShader, context, this); + fragShader->compile(source); + simpleShaderProg = new QGLShaderProgram(context, this); - compileNamedShader(MainVertexShader, QGLShader::PartialVertexShader); - compileNamedShader(PositionOnlyVertexShader, QGLShader::PartialVertexShader); - compileNamedShader(MainFragmentShader, QGLShader::PartialFragmentShader); - compileNamedShader(ShockingPinkSrcFragmentShader, QGLShader::PartialFragmentShader); - simpleShaderProg->addShader(compiledShaders[MainVertexShader]); - simpleShaderProg->addShader(compiledShaders[PositionOnlyVertexShader]); - simpleShaderProg->addShader(compiledShaders[MainFragmentShader]); - simpleShaderProg->addShader(compiledShaders[ShockingPinkSrcFragmentShader]); + simpleShaderProg->addShader(vertexShader); + simpleShaderProg->addShader(fragShader); simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); simpleShaderProg->link(); if (!simpleShaderProg->isLinked()) { @@ -181,152 +189,159 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) } // Compile the blit shader: + source.clear(); + source.append(qShaderSnippets[MainWithTexCoordsVertexShader]); + source.append(qShaderSnippets[UntransformedPositionVertexShader]); + vertexShader = new QGLShader(QGLShader::VertexShader, context, this); + vertexShader->compile(source); + + source.clear(); + source.append(qShaderSnippets[MainFragmentShader]); + source.append(qShaderSnippets[ImageSrcFragmentShader]); + fragShader = new QGLShader(QGLShader::FragmentShader, context, this); + fragShader->compile(source); + blitShaderProg = new QGLShaderProgram(context, this); - compileNamedShader(MainWithTexCoordsVertexShader, QGLShader::PartialVertexShader); - compileNamedShader(UntransformedPositionVertexShader, QGLShader::PartialVertexShader); - compileNamedShader(MainFragmentShader, QGLShader::PartialFragmentShader); - compileNamedShader(ImageSrcFragmentShader, QGLShader::PartialFragmentShader); - blitShaderProg->addShader(compiledShaders[MainWithTexCoordsVertexShader]); - blitShaderProg->addShader(compiledShaders[UntransformedPositionVertexShader]); - blitShaderProg->addShader(compiledShaders[MainFragmentShader]); - blitShaderProg->addShader(compiledShaders[ImageSrcFragmentShader]); + blitShaderProg->addShader(vertexShader); + blitShaderProg->addShader(fragShader); blitShaderProg->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); blitShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); blitShaderProg->link(); if (!blitShaderProg->isLinked()) { qCritical() << "Errors linking blit shader:" - << blitShaderProg->log(); - } -} - -void QGLEngineSharedShaders::shaderDestroyed(QObject *shader) -{ - // Remove any shader programs which has this as the srcPixel shader: - for (int i = 0; i < cachedPrograms.size(); ++i) { - if (cachedPrograms.at(i).srcPixelFragShader == shader) { - delete cachedPrograms.at(i).program; - cachedPrograms.removeAt(i--); - } + << simpleShaderProg->log(); } - emit shaderProgNeedsChanging(); } -QGLShader *QGLEngineSharedShaders::compileNamedShader(ShaderName name, QGLShader::ShaderType type) +#if defined (QT_DEBUG) +QByteArray QGLEngineSharedShaders::snippetNameStr(SnippetName name) { - Q_ASSERT(name != CustomImageSrcFragmentShader); - Q_ASSERT(name < InvalidShaderName); - - if (compiledShaders[name]) - return compiledShaders[name]; - - QByteArray source = qglEngineShaderSourceCode[name]; - QGLShader *newShader = new QGLShader(type, ctxGuard.context(), this); - newShader->compile(source); - -#if defined(QT_DEBUG) - // Name the shader for easier debugging - QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName")); - newShader->setObjectName(QLatin1String(m.valueToKey(name))); -#endif - - compiledShaders[name] = newShader; - return newShader; + QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("SnippetName")); + return QByteArray(m.valueToKey(name)); } - -QGLShader *QGLEngineSharedShaders::compileCustomShader(QGLCustomShaderStage *stage, QGLShader::ShaderType type) -{ - QByteArray source = stage->source(); - source += qglslCustomSrcFragmentShader; - - QGLShader *newShader = customShaderCache.object(source); - if (newShader) - return newShader; - - newShader = new QGLShader(type, ctxGuard.context(), this); - newShader->compile(source); - customShaderCache.insert(source, newShader); - - connect(newShader, SIGNAL(destroyed(QObject *)), - this, SLOT(shaderDestroyed(QObject *))); - -#if defined(QT_DEBUG) - // Name the shader for easier debugging - QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("ShaderName")); - newShader->setObjectName(QLatin1String(m.valueToKey(CustomImageSrcFragmentShader))); #endif - return newShader; -} - // The address returned here will only be valid until next time this function is called. QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineShaderProg &prog) { for (int i = 0; i < cachedPrograms.size(); ++i) { - if (cachedPrograms[i] == prog) - return &cachedPrograms[i]; + QGLEngineShaderProg *cachedProg = cachedPrograms[i]; + if (*cachedProg == prog) { + // Move the program to the top of the list as a poor-man's cache algo + cachedPrograms.move(i, 0); + return cachedProg; + } } - cachedPrograms.append(prog); - QGLEngineShaderProg &cached = cachedPrograms.last(); + QByteArray source; + source.append(qShaderSnippets[prog.mainFragShader]); + source.append(qShaderSnippets[prog.srcPixelFragShader]); + if (prog.srcPixelFragShader == CustomImageSrcFragmentShader) + source.append(prog.customStageSource); + if (prog.compositionFragShader) + source.append(qShaderSnippets[prog.compositionFragShader]); + if (prog.maskFragShader) + source.append(qShaderSnippets[prog.maskFragShader]); + QGLShader* fragShader = new QGLShader(QGLShader::FragmentShader, ctxGuard.context(), this); + fragShader->compile(source); + + source.clear(); + source.append(qShaderSnippets[prog.mainVertexShader]); + source.append(qShaderSnippets[prog.positionVertexShader]); + QGLShader* vertexShader = new QGLShader(QGLShader::VertexShader, ctxGuard.context(), this); + vertexShader->compile(source); + +#if defined(QT_DEBUG) + // Name the shaders for easier debugging + QByteArray description; + description.append("Fragment shader: main="); + description.append(snippetNameStr(prog.mainFragShader)); + description.append(", srcPixel="); + description.append(snippetNameStr(prog.srcPixelFragShader)); + if (prog.compositionFragShader) { + description.append(", composition="); + description.append(snippetNameStr(prog.compositionFragShader)); + } + if (prog.maskFragShader) { + description.append(", mask="); + description.append(snippetNameStr(prog.maskFragShader)); + } + fragShader->setObjectName(QString::fromLatin1(description)); + + description.clear(); + description.append("Vertex shader: main="); + description.append(snippetNameStr(prog.mainVertexShader)); + description.append(", position="); + description.append(snippetNameStr(prog.positionVertexShader)); + vertexShader->setObjectName(QString::fromLatin1(description)); +#endif + + QGLEngineShaderProg* newProg = new QGLEngineShaderProg(prog); // If the shader program's not found in the cache, create it now. - cached.program = new QGLShaderProgram(ctxGuard.context(), this); - cached.program->addShader(cached.mainVertexShader); - cached.program->addShader(cached.positionVertexShader); - cached.program->addShader(cached.mainFragShader); - cached.program->addShader(cached.srcPixelFragShader); - cached.program->addShader(cached.maskFragShader); - cached.program->addShader(cached.compositionFragShader); + newProg->program = new QGLShaderProgram(ctxGuard.context(), this); + newProg->program->addShader(vertexShader); + newProg->program->addShader(fragShader); // We have to bind the vertex attribute names before the program is linked: - cached.program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); - if (cached.useTextureCoords) - cached.program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); - if (cached.useOpacityAttribute) - cached.program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); - - cached.program->link(); - if (!cached.program->isLinked()) { + newProg->program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); + if (newProg->useTextureCoords) + newProg->program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); + if (newProg->useOpacityAttribute) + newProg->program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); + + newProg->program->link(); + if (!newProg->program->isLinked()) { QLatin1String none("none"); QLatin1String br("\n"); QString error; error = QLatin1String("Shader program failed to link,") #if defined(QT_DEBUG) + br - + QLatin1String(" Shaders Used:\n") - + QLatin1String(" mainVertexShader = ") - + (cached.mainVertexShader ? - cached.mainVertexShader->objectName() : none) + br - + QLatin1String(" positionVertexShader = ") - + (cached.positionVertexShader ? - cached.positionVertexShader->objectName() : none) + br - + QLatin1String(" mainFragShader = ") - + (cached.mainFragShader ? - cached.mainFragShader->objectName() : none) + br - + QLatin1String(" srcPixelFragShader = ") - + (cached.srcPixelFragShader ? - cached.srcPixelFragShader->objectName() : none) + br - + QLatin1String(" maskFragShader = ") - + (cached.maskFragShader ? - cached.maskFragShader->objectName() : none) + br - + QLatin1String(" compositionFragShader = ") - + (cached.compositionFragShader ? - cached.compositionFragShader->objectName() : none) + br + + QLatin1String(" Shaders Used:") + br + + QLatin1String(" ") + vertexShader->objectName() + QLatin1String(": ") + br + + QLatin1String(vertexShader->sourceCode()) + br + + QLatin1String(" ") + fragShader->objectName() + QLatin1String(": ") + br + + QLatin1String(fragShader->sourceCode()) + br #endif + QLatin1String(" Error Log:\n") - + QLatin1String(" ") + cached.program->log(); + + QLatin1String(" ") + newProg->program->log(); qWarning() << error; - delete cached.program; - cachedPrograms.removeLast(); - return 0; - } else { - // taking the address here is safe since - // cachePrograms isn't resized anywhere else - return &cached; + delete newProg; // Deletes the QGLShaderProgram in it's destructor + newProg = 0; } + else { + if (cachedPrograms.count() > 30) { + // The cache is full, so delete the last 5 programs in the list. + // These programs will be least used, as a program us bumped to + // the top of the list when it's used. + for (int i = 0; i < 5; ++i) { + delete cachedPrograms.last(); + cachedPrograms.removeLast(); + } + } + + cachedPrograms.insert(0, newProg); + } + + return newProg; } +void QGLEngineSharedShaders::cleanupCustomStage(QGLCustomShaderStage* stage) +{ + // Remove any shader programs which has this as the custom shader src: + for (int i = 0; i < cachedPrograms.size(); ++i) { + QGLEngineShaderProg *cachedProg = cachedPrograms[i]; + if (cachedProg->customStageSource == stage->source()) { + delete cachedProg; + cachedPrograms.removeAt(i); + i--; + } + } +} + + QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) : ctx(context), shaderProgNeedsChanging(true), @@ -335,8 +350,7 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) maskType(NoMask), compositionMode(QPainter::CompositionMode_SourceOver), customSrcStage(0), - currentShaderProg(0), - customShader(0) + currentShaderProg(0) { sharedShaders = QGLEngineSharedShaders::shadersForContext(context); connect(sharedShaders, SIGNAL(shaderProgNeedsChanging()), this, SLOT(shaderProgNeedsChangingSlot())); @@ -345,6 +359,7 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) QGLEngineShaderManager::~QGLEngineShaderManager() { //### + removeCustomStage(); } uint QGLEngineShaderManager::getUniformLocation(Uniform id) @@ -436,21 +451,20 @@ void QGLEngineShaderManager::setCompositionMode(QPainter::CompositionMode mode) void QGLEngineShaderManager::setCustomStage(QGLCustomShaderStage* stage) { + if (customSrcStage) + removeCustomStage(); customSrcStage = stage; - customShader = 0; // Will be compiled from 'customSrcStage' later. shaderProgNeedsChanging = true; } -void QGLEngineShaderManager::removeCustomStage(QGLCustomShaderStage* stage) +void QGLEngineShaderManager::removeCustomStage() { - Q_UNUSED(stage); // Currently we only support one at a time... - + if (customSrcStage) + customSrcStage->setInactive(); customSrcStage = 0; - customShader = 0; shaderProgNeedsChanging = true; } - QGLShaderProgram* QGLEngineShaderManager::currentProgram() { return currentShaderProg->program; @@ -482,22 +496,21 @@ bool QGLEngineShaderManager::useCorrectShaderProg() } QGLEngineShaderProg requiredProgram; - requiredProgram.program = 0; bool texCoords = false; // Choose vertex shader shader position function (which typically also sets // varyings) and the source pixel (srcPixel) fragment shader function: - QGLEngineSharedShaders::ShaderName positionVertexShaderName = QGLEngineSharedShaders::InvalidShaderName; - QGLEngineSharedShaders::ShaderName srcPixelFragShaderName = QGLEngineSharedShaders::InvalidShaderName; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::InvalidSnippetName; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::InvalidSnippetName; bool isAffine = brushTransform.isAffine(); if ( (srcPixelType >= Qt::Dense1Pattern) && (srcPixelType <= Qt::DiagCrossPattern) ) { if (isAffine) - positionVertexShaderName = QGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader; else - positionVertexShaderName = QGLEngineSharedShaders::PositionWithPatternBrushVertexShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionWithPatternBrushVertexShader; - srcPixelFragShaderName = QGLEngineSharedShaders::PatternBrushSrcFragmentShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::PatternBrushSrcFragmentShader; } else switch (srcPixelType) { default: @@ -505,172 +518,157 @@ bool QGLEngineShaderManager::useCorrectShaderProg() qFatal("QGLEngineShaderManager::useCorrectShaderProg() - Qt::NoBrush style is set"); break; case QGLEngineShaderManager::ImageSrc: - srcPixelFragShaderName = QGLEngineSharedShaders::ImageSrcFragmentShader; - positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ImageSrcFragmentShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader; texCoords = true; break; case QGLEngineShaderManager::NonPremultipliedImageSrc: - srcPixelFragShaderName = QGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader; - positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader; texCoords = true; break; case QGLEngineShaderManager::PatternSrc: - srcPixelFragShaderName = QGLEngineSharedShaders::ImageSrcWithPatternFragmentShader; - positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ImageSrcWithPatternFragmentShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader; texCoords = true; break; case QGLEngineShaderManager::TextureSrcWithPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader : QGLEngineSharedShaders::PositionWithTextureBrushVertexShader; break; case Qt::SolidPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::SolidBrushSrcFragmentShader; - positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::SolidBrushSrcFragmentShader; + requiredProgram.positionVertexShader = QGLEngineSharedShaders::PositionOnlyVertexShader; break; case Qt::LinearGradientPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::LinearGradientBrushSrcFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithLinearGradientBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::LinearGradientBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithLinearGradientBrushVertexShader : QGLEngineSharedShaders::PositionWithLinearGradientBrushVertexShader; break; case Qt::ConicalGradientPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::ConicalGradientBrushSrcFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithConicalGradientBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::ConicalGradientBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithConicalGradientBrushVertexShader : QGLEngineSharedShaders::PositionWithConicalGradientBrushVertexShader; break; case Qt::RadialGradientPattern: - srcPixelFragShaderName = QGLEngineSharedShaders::RadialGradientBrushSrcFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithRadialGradientBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::RadialGradientBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithRadialGradientBrushVertexShader : QGLEngineSharedShaders::PositionWithRadialGradientBrushVertexShader; break; case Qt::TexturePattern: - srcPixelFragShaderName = QGLEngineSharedShaders::TextureBrushSrcFragmentShader; - positionVertexShaderName = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::TextureBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader : QGLEngineSharedShaders::PositionWithTextureBrushVertexShader; break; }; - requiredProgram.positionVertexShader = sharedShaders->compileNamedShader(positionVertexShaderName, QGLShader::PartialVertexShader); + if (useCustomSrc) { - if (!customShader) - customShader = sharedShaders->compileCustomShader(customSrcStage, QGLShader::PartialFragmentShader); - requiredProgram.srcPixelFragShader = customShader; - } else { - requiredProgram.srcPixelFragShader = sharedShaders->compileNamedShader(srcPixelFragShaderName, QGLShader::PartialFragmentShader); + requiredProgram.srcPixelFragShader = QGLEngineSharedShaders::CustomImageSrcFragmentShader; + requiredProgram.customStageSource = customSrcStage->source(); } const bool hasCompose = compositionMode > QPainter::CompositionMode_Plus; const bool hasMask = maskType != QGLEngineShaderManager::NoMask; // Choose fragment shader main function: - QGLEngineSharedShaders::ShaderName mainFragShaderName; - if (opacityMode == AttributeOpacity) { Q_ASSERT(!hasCompose && !hasMask); - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_ImageArrays; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_ImageArrays; } else { bool useGlobalOpacity = (opacityMode == UniformOpacity); if (hasCompose && hasMask && useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_CMO; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CMO; if (hasCompose && hasMask && !useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_CM; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CM; if (!hasCompose && hasMask && useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_MO; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_MO; if (!hasCompose && hasMask && !useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_M; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_M; if (hasCompose && !hasMask && useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_CO; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_CO; if (hasCompose && !hasMask && !useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_C; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_C; if (!hasCompose && !hasMask && useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader_O; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader_O; if (!hasCompose && !hasMask && !useGlobalOpacity) - mainFragShaderName = QGLEngineSharedShaders::MainFragmentShader; + requiredProgram.mainFragShader = QGLEngineSharedShaders::MainFragmentShader; } - requiredProgram.mainFragShader = sharedShaders->compileNamedShader(mainFragShaderName, QGLShader::PartialFragmentShader); - if (hasMask) { - QGLEngineSharedShaders::ShaderName maskShaderName = QGLEngineSharedShaders::InvalidShaderName; if (maskType == PixelMask) { - maskShaderName = QGLEngineSharedShaders::MaskFragmentShader; + requiredProgram.maskFragShader = QGLEngineSharedShaders::MaskFragmentShader; texCoords = true; } else if (maskType == SubPixelMaskPass1) { - maskShaderName = QGLEngineSharedShaders::RgbMaskFragmentShaderPass1; + requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskFragmentShaderPass1; texCoords = true; } else if (maskType == SubPixelMaskPass2) { - maskShaderName = QGLEngineSharedShaders::RgbMaskFragmentShaderPass2; + requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskFragmentShaderPass2; texCoords = true; } else if (maskType == SubPixelWithGammaMask) { - maskShaderName = QGLEngineSharedShaders::RgbMaskWithGammaFragmentShader; + requiredProgram.maskFragShader = QGLEngineSharedShaders::RgbMaskWithGammaFragmentShader; texCoords = true; } else { qCritical("QGLEngineShaderManager::useCorrectShaderProg() - Unknown mask type"); } - - requiredProgram.maskFragShader = sharedShaders->compileNamedShader(maskShaderName, QGLShader::PartialFragmentShader); } else { - requiredProgram.maskFragShader = 0; + requiredProgram.maskFragShader = QGLEngineSharedShaders::NoMaskFragmentShader; } if (hasCompose) { - QGLEngineSharedShaders::ShaderName compositionShaderName = QGLEngineSharedShaders::InvalidShaderName; switch (compositionMode) { case QPainter::CompositionMode_Multiply: - compositionShaderName = QGLEngineSharedShaders::MultiplyCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::MultiplyCompositionModeFragmentShader; break; case QPainter::CompositionMode_Screen: - compositionShaderName = QGLEngineSharedShaders::ScreenCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::ScreenCompositionModeFragmentShader; break; case QPainter::CompositionMode_Overlay: - compositionShaderName = QGLEngineSharedShaders::OverlayCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::OverlayCompositionModeFragmentShader; break; case QPainter::CompositionMode_Darken: - compositionShaderName = QGLEngineSharedShaders::DarkenCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::DarkenCompositionModeFragmentShader; break; case QPainter::CompositionMode_Lighten: - compositionShaderName = QGLEngineSharedShaders::LightenCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::LightenCompositionModeFragmentShader; break; case QPainter::CompositionMode_ColorDodge: - compositionShaderName = QGLEngineSharedShaders::ColorDodgeCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::ColorDodgeCompositionModeFragmentShader; break; case QPainter::CompositionMode_ColorBurn: - compositionShaderName = QGLEngineSharedShaders::ColorBurnCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::ColorBurnCompositionModeFragmentShader; break; case QPainter::CompositionMode_HardLight: - compositionShaderName = QGLEngineSharedShaders::HardLightCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::HardLightCompositionModeFragmentShader; break; case QPainter::CompositionMode_SoftLight: - compositionShaderName = QGLEngineSharedShaders::SoftLightCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::SoftLightCompositionModeFragmentShader; break; case QPainter::CompositionMode_Difference: - compositionShaderName = QGLEngineSharedShaders::DifferenceCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::DifferenceCompositionModeFragmentShader; break; case QPainter::CompositionMode_Exclusion: - compositionShaderName = QGLEngineSharedShaders::ExclusionCompositionModeFragmentShader; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::ExclusionCompositionModeFragmentShader; break; default: qWarning("QGLEngineShaderManager::useCorrectShaderProg() - Unsupported composition mode"); } - requiredProgram.compositionFragShader = sharedShaders->compileNamedShader(compositionShaderName, QGLShader::PartialFragmentShader); } else { - requiredProgram.compositionFragShader = 0; + requiredProgram.compositionFragShader = QGLEngineSharedShaders::NoCompositionModeFragmentShader; } - // Choose vertex shader main function - QGLEngineSharedShaders::ShaderName mainVertexShaderName = QGLEngineSharedShaders::InvalidShaderName; + // Choose vertex shader main function if (opacityMode == AttributeOpacity) { Q_ASSERT(texCoords); - mainVertexShaderName = QGLEngineSharedShaders::MainWithTexCoordsAndOpacityVertexShader; + requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainWithTexCoordsAndOpacityVertexShader; } else if (texCoords) { - mainVertexShaderName = QGLEngineSharedShaders::MainWithTexCoordsVertexShader; + requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainWithTexCoordsVertexShader; } else { - mainVertexShaderName = QGLEngineSharedShaders::MainVertexShader; + requiredProgram.mainVertexShader = QGLEngineSharedShaders::MainVertexShader; } - requiredProgram.mainVertexShader = sharedShaders->compileNamedShader(mainVertexShaderName, QGLShader::PartialVertexShader); requiredProgram.useTextureCoords = texCoords; requiredProgram.useOpacityAttribute = (opacityMode == AttributeOpacity); - // At this point, requiredProgram is fully populated so try to find the program in the cache currentShaderProg = sharedShaders->findProgramInCache(requiredProgram); diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 291d24c..50c1432 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -234,32 +234,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(OpenGL) -struct QGLEngineShaderProg -{ - QGLShader* mainVertexShader; - QGLShader* positionVertexShader; - QGLShader* mainFragShader; - QGLShader* srcPixelFragShader; - QGLShader* maskFragShader; // Can be null for no mask - QGLShader* compositionFragShader; // Can be null for GL-handled mode - QGLShaderProgram* program; - - QVector<uint> uniformLocations; - - bool useTextureCoords; - bool useOpacityAttribute; - - bool operator==(const QGLEngineShaderProg& other) { - // We don't care about the program - return ( mainVertexShader == other.mainVertexShader && - positionVertexShader == other.positionVertexShader && - mainFragShader == other.mainFragShader && - srcPixelFragShader == other.srcPixelFragShader && - maskFragShader == other.maskFragShader && - compositionFragShader == other.compositionFragShader - ); - } -}; /* struct QGLEngineCachedShaderProg @@ -280,15 +254,19 @@ static const GLuint QT_VERTEX_COORDS_ATTR = 0; static const GLuint QT_TEXTURE_COORDS_ATTR = 1; static const GLuint QT_OPACITY_ATTR = 2; +class QGLEngineShaderProg; + class QGLEngineSharedShaders : public QObject { Q_OBJECT public: - enum ShaderName { + + enum SnippetName { MainVertexShader, MainWithTexCoordsVertexShader, MainWithTexCoordsAndOpacityVertexShader, + // UntransformedPositionVertexShader must be first in the list: UntransformedPositionVertexShader, PositionOnlyVertexShader, PositionWithPatternBrushVertexShader, @@ -302,6 +280,7 @@ public: AffinePositionWithRadialGradientBrushVertexShader, AffinePositionWithTextureBrushVertexShader, + // MainFragmentShader_CMO must be first in the list: MainFragmentShader_CMO, MainFragmentShader_CM, MainFragmentShader_MO, @@ -312,6 +291,7 @@ public: MainFragmentShader, MainFragmentShader_ImageArrays, + // ImageSrcFragmentShader must be first in the list:: ImageSrcFragmentShader, ImageSrcWithPatternFragmentShader, NonPremultipliedImageSrcFragmentShader, @@ -325,11 +305,15 @@ public: ConicalGradientBrushSrcFragmentShader, ShockingPinkSrcFragmentShader, + // NoMaskFragmentShader must be first in the list: + NoMaskFragmentShader, MaskFragmentShader, RgbMaskFragmentShaderPass1, RgbMaskFragmentShaderPass2, RgbMaskWithGammaFragmentShader, + // NoCompositionModeFragmentShader must be first in the list: + NoCompositionModeFragmentShader, MultiplyCompositionModeFragmentShader, ScreenCompositionModeFragmentShader, OverlayCompositionModeFragmentShader, @@ -342,37 +326,88 @@ public: DifferenceCompositionModeFragmentShader, ExclusionCompositionModeFragmentShader, - TotalShaderCount, InvalidShaderName + TotalSnippetCount, InvalidSnippetName }; +#if defined (QT_DEBUG) + Q_ENUMS(SnippetName) + static QByteArray snippetNameStr(SnippetName snippetName); +#endif - QGLEngineSharedShaders(const QGLContext *context); +/* + // These allow the ShaderName enum to be used as a cache key + const int mainVertexOffset = 0; + const int positionVertexOffset = (1<<2) - PositionOnlyVertexShader; + const int mainFragOffset = (1<<6) - MainFragmentShader_CMO; + const int srcPixelOffset = (1<<10) - ImageSrcFragmentShader; + const int maskOffset = (1<<14) - NoMaskShader; + const int compositionOffset = (1 << 16) - MultiplyCompositionModeFragmentShader; +*/ - QGLShader *compileNamedShader(ShaderName name, QGLShader::ShaderType type); + QGLEngineSharedShaders(const QGLContext *context); QGLShaderProgram *simpleProgram() { return simpleShaderProg; } QGLShaderProgram *blitProgram() { return blitShaderProg; } // Compile the program if it's not already in the cache, return the item in the cache. QGLEngineShaderProg *findProgramInCache(const QGLEngineShaderProg &prog); // Compile the custom shader if it's not already in the cache, return the item in the cache. - QGLShader *compileCustomShader(QGLCustomShaderStage *stage, QGLShader::ShaderType type); static QGLEngineSharedShaders *shadersForContext(const QGLContext *context); + // Ideally, this would be static and cleanup all programs in all contexts which + // contain the custom code. Currently it is just a hint and we rely on deleted + // custom shaders being cleaned up by being kicked out of the cache when it's + // full. + void cleanupCustomStage(QGLCustomShaderStage* stage); + signals: void shaderProgNeedsChanging(); -private slots: - void shaderDestroyed(QObject *shader); - private: QGLSharedResourceGuard ctxGuard; QGLShaderProgram *blitShaderProg; QGLShaderProgram *simpleShaderProg; - QList<QGLEngineShaderProg> cachedPrograms; - QCache<QByteArray, QGLShader> customShaderCache; - QGLShader* compiledShaders[TotalShaderCount]; + QList<QGLEngineShaderProg*> cachedPrograms; - static const char* qglEngineShaderSourceCode[TotalShaderCount]; + static const char* qShaderSnippets[TotalSnippetCount]; +}; + + +class QGLEngineShaderProg +{ +public: + QGLEngineShaderProg() : program(0) {} + + ~QGLEngineShaderProg() { + if (program) + delete program; + } + + QGLEngineSharedShaders::SnippetName mainVertexShader; + QGLEngineSharedShaders::SnippetName positionVertexShader; + QGLEngineSharedShaders::SnippetName mainFragShader; + QGLEngineSharedShaders::SnippetName srcPixelFragShader; + QGLEngineSharedShaders::SnippetName maskFragShader; + QGLEngineSharedShaders::SnippetName compositionFragShader; + + QByteArray customStageSource; //TODO: Decent cache key for custom stages + QGLShaderProgram* program; + + QVector<uint> uniformLocations; + + bool useTextureCoords; + bool useOpacityAttribute; + + bool operator==(const QGLEngineShaderProg& other) { + // We don't care about the program + return ( mainVertexShader == other.mainVertexShader && + positionVertexShader == other.positionVertexShader && + mainFragShader == other.mainFragShader && + srcPixelFragShader == other.srcPixelFragShader && + maskFragShader == other.maskFragShader && + compositionFragShader == other.compositionFragShader && + customStageSource == other.customStageSource + ); + } }; class Q_OPENGL_EXPORT QGLEngineShaderManager : public QObject @@ -426,7 +461,7 @@ public: void setMaskType(MaskType); void setCompositionMode(QPainter::CompositionMode); void setCustomStage(QGLCustomShaderStage* stage); - void removeCustomStage(QGLCustomShaderStage* stage); + void removeCustomStage(); uint getUniformLocation(Uniform id); @@ -437,19 +472,7 @@ public: QGLShaderProgram* simpleProgram(); // Used to draw into e.g. stencil buffers QGLShaderProgram* blitProgram(); // Used to blit a texture into the framebuffer -/* - // These allow the ShaderName enum to be used as a cache key - const int mainVertexOffset = 0; - const int positionVertexOffset = (1<<2) - PositionOnlyVertexShader; - const int mainFragOffset = (1<<6) - MainFragmentShader_CMO; - const int srcPixelOffset = (1<<10) - ImageSrcFragmentShader; - const int maskOffset = (1<<14) - NoMaskShader; - const int compositionOffset = (1 << 16) - MultiplyCompositionModeFragmentShader; -*/ - -#if defined (QT_DEBUG) - Q_ENUMS(ShaderName) -#endif + QGLEngineSharedShaders* sharedShaders; private slots: void shaderProgNeedsChangingSlot() { shaderProgNeedsChanging = true; } @@ -466,9 +489,7 @@ private: QPainter::CompositionMode compositionMode; QGLCustomShaderStage* customSrcStage; - QGLEngineShaderProg* currentShaderProg; - QGLEngineSharedShaders *sharedShaders; - QGLShader *customShader; + QGLEngineShaderProg* currentShaderProg; }; QT_END_NAMESPACE diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 209cd36..4cf2a83 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -289,6 +289,7 @@ public: QScopedPointer<QPixmapFilter> convolutionFilter; QScopedPointer<QPixmapFilter> colorizeFilter; QScopedPointer<QPixmapFilter> blurFilter; + QScopedPointer<QPixmapFilter> animationBlurFilter; QScopedPointer<QPixmapFilter> fastBlurFilter; QScopedPointer<QPixmapFilter> dropShadowFilter; QScopedPointer<QPixmapFilter> fastDropShadowFilter; diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp index ad18a51..1163eba 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp @@ -114,7 +114,7 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen) if (m_join_style == Qt::RoundJoin) m_join_style = Qt::MiterJoin; m_curvyness_add = 0.5; - m_curvyness_mul = CURVE_FLATNESS; + m_curvyness_mul = CURVE_FLATNESS / m_inv_scale; m_roundness = 1; } else if (cosmetic) { m_curvyness_add = realWidth / 2; diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index a212675..7d6052b 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -103,7 +103,7 @@ x11 { LIBS_PRIVATE += -lfreetype } else { ### Note: how does this compile with a non-system freetype? - # This probably doesn't compile + # This probably does not compile } } else { DEFINES *= QT_NO_FREETYPE @@ -150,17 +150,15 @@ embedded { INCLUDEPATH += ../3rdparty/harfbuzz/src -wince*: { - contains(QT_CONFIG,opengles1) { - QMAKE_LIBS += "libGLES_CM.lib" - } - contains(QT_CONFIG,opengles1cl) { - QMAKE_LIBS += "libGLES_CL.lib" - } - contains(QT_CONFIG,opengles2) { - QMAKE_LIBS += "libGLESv2.lib" - } - +contains(QT_CONFIG,opengles1) { + LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1 + LIBS += $$QMAKE_LFLAGS_OPENGL_ES1 +} else:contains(QT_CONFIG,opengles1cl) { + LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1CL + LIBS += $$QMAKE_LFLAGS_OPENGL_ES1CL +} else:contains(QT_CONFIG,opengles2) { + LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES2 + LIBS += $$QMAKE_LFLAGS_OPENGL_ES2 } else { LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL LIBS += $$QMAKE_LFLAGS_OPENGL diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e80521b..ad177dc 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1773,10 +1773,12 @@ Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg() /*! \enum QGLContext::BindOption + \since 4.6 + A set of options to decide how to bind a texture using bindTexture(). \value NoBindOption Don't do anything, pass the texture straight - thru. + through. \value InvertedYBindOption Specifies that the texture should be flipped over the X axis so that the texture coordinate 0,0 corresponds to @@ -2137,7 +2139,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G Q_ASSERT(texture); if (texture->id > 0) - const_cast<QImage &>(image).data_ptr()->is_cached = true; + QImagePixmapCleanupHooks::enableCleanupHooks(image); return texture; } @@ -2158,7 +2160,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #ifndef QT_NO_DEBUG // Reset the gl error stack...git - while (glGetError() != GL_NO_ERROR); + while (glGetError() != GL_NO_ERROR) ; #endif // Scale the pixmap if needed. GL textures needs to have the @@ -2396,7 +2398,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, Q_ASSERT(texture); if (texture->id > 0) - const_cast<QPixmap &>(pixmap).data_ptr()->is_cached = true; + QImagePixmapCleanupHooks::enableCleanupHooks(pixmap); return texture; } @@ -2445,6 +2447,9 @@ int QGLContextPrivate::maxTextureSize() */ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) { + if (image.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(image, target, format, false, DefaultBindOption); return texture->id; @@ -2477,6 +2482,9 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) */ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format, BindOptions options) { + if (image.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(image, target, format, false, options); return texture->id; @@ -2486,6 +2494,9 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format, /*! \internal */ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format) { + if (image.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false, DefaultBindOption); return texture->id; @@ -2495,6 +2506,9 @@ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMa GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format, BindOptions options) { + if (image.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false, options); return texture->id; @@ -2507,6 +2521,9 @@ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMa */ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format) { + if (pixmap.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(pixmap, target, format, DefaultBindOption); return texture->id; @@ -2521,6 +2538,9 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma */ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, BindOptions options) { + if (pixmap.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(pixmap, target, format, options); return texture->id; @@ -2530,6 +2550,9 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma /*! \internal */ GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format) { + if (pixmap.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), DefaultBindOption); return texture->id; @@ -2538,6 +2561,9 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, Q GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format, BindOptions options) { + if (pixmap.isNull()) + return 0; + Q_D(QGLContext); QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), options); return texture->id; @@ -4595,6 +4621,9 @@ bool QGLWidget::autoBufferSwap() const */ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format) { + if (image.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(image, target, format, QGLContext::DefaultBindOption); } @@ -4608,6 +4637,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format) */ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options) { + if (image.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(image, target, format, options); } @@ -4617,6 +4649,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format, /*! \internal */ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format) { + if (image.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(image, GLenum(target), GLint(format), QGLContext::DefaultBindOption); } @@ -4624,6 +4659,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMac GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format, QGLContext::BindOptions options) { + if (image.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(image, GLenum(target), GLint(format), options); } @@ -4637,6 +4675,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMac */ GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format) { + if (pixmap.isNull()) + return 0; + Q_D(QGLWidget); return d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption); } diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index e14e7fb..079953f 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -399,6 +399,7 @@ private: friend class QGLTextureGlyphCache; friend class QGLShareRegister; friend class QGLSharedResourceGuard; + friend class QGLPixmapBlurFilter; friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags(); #ifdef Q_WS_MAC public: diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index 86e593d..899047a 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -53,6 +53,7 @@ #include <private/qfontengine_ft_p.h> #include <private/qt_x11_p.h> #include <private/qpixmap_x11_p.h> +#include <private/qimagepixmapcleanuphooks_p.h> #ifdef Q_OS_HPUX // for GLXPBuffer #include <private/qglpixelbuffer_p.h> @@ -1704,7 +1705,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con pixmapData->gl_surface = (Qt::HANDLE)glxPixmap; // Make sure the cleanup hook gets called so we can delete the glx pixmap - pixmapData->is_cached = true; + QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData); } GLuint textureId; diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 7180682..9b20297 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -42,6 +42,7 @@ #include "qgl.h" #include <private/qt_x11_p.h> #include <private/qpixmap_x11_p.h> +#include <private/qimagepixmapcleanuphooks_p.h> #include <private/qgl_p.h> #include <private/qpaintengine_opengl_p.h> #include "qgl_egl_p.h" @@ -531,7 +532,7 @@ bool Q_OPENGL_EXPORT qt_createEGLSurfaceForPixmap(QPixmapData* pmd, bool readOnl Q_ASSERT(sizeof(Qt::HANDLE) >= sizeof(EGLSurface)); // Just to make totally sure! pixmapData->gl_surface = (Qt::HANDLE)pixmapSurface; - pixmapData->is_cached = true; // Make sure the cleanup hook gets called + QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData); // Make sure the cleanup hook gets called return true; } diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 2af69e0..8768fbc 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -43,6 +43,8 @@ #include "private/qpixmapdata_gl_p.h" #include "private/qpaintengineex_opengl2_p.h" #include "private/qglengineshadermanager_p.h" +#include "private/qpixmapdata_p.h" +#include "private/qimagepixmapcleanuphooks_p.h" #include "qglpixmapfilter_p.h" #include "qgraphicssystem_gl_p.h" #include "qpaintengine_opengl_p.h" @@ -54,7 +56,7 @@ #include "private/qapplication_p.h" #include "private/qmath_p.h" - +#include "qmath.h" QT_BEGIN_NAMESPACE @@ -100,7 +102,7 @@ private: class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapBlurFilter> { public: - QGLPixmapBlurFilter(Qt::RenderHint hint); + QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint); void setUniforms(QGLShaderProgram *program); @@ -114,16 +116,20 @@ private: mutable QSize m_textureSize; mutable bool m_horizontalBlur; mutable bool m_singlePass; + mutable bool m_animatedBlur; + + mutable qreal m_t; + mutable QSize m_targetSize; mutable bool m_haveCached; mutable int m_cachedRadius; - mutable Qt::RenderHint m_hint; + mutable QGraphicsBlurEffect::BlurHint m_hint; }; class QGLPixmapDropShadowFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapDropShadowFilter> { public: - QGLPixmapDropShadowFilter(Qt::RenderHint hint); + QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHint hint); void setUniforms(QGLShaderProgram *program); @@ -137,7 +143,7 @@ private: mutable bool m_haveCached; mutable int m_cachedRadius; - mutable Qt::RenderHint m_hint; + mutable QGraphicsBlurEffect::BlurHint m_hint; }; extern QGLWidget *qt_gl_share_widget(); @@ -153,13 +159,18 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr case QPixmapFilter::BlurFilter: { const QPixmapBlurFilter *proto = static_cast<const QPixmapBlurFilter *>(prototype); - if (proto->blurHint() == Qt::PerformanceHint || proto->radius() <= 5) { + if (proto->blurHint() == QGraphicsBlurEffect::AnimationHint) { + if (!d->animationBlurFilter) + d->animationBlurFilter.reset(new QGLPixmapBlurFilter(proto->blurHint())); + return d->animationBlurFilter.data(); + } + if (proto->blurHint() == QGraphicsBlurEffect::PerformanceHint || proto->radius() <= 5) { if (!d->fastBlurFilter) - d->fastBlurFilter.reset(new QGLPixmapBlurFilter(Qt::PerformanceHint)); + d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::PerformanceHint)); return d->fastBlurFilter.data(); } if (!d->blurFilter) - d->blurFilter.reset(new QGLPixmapBlurFilter(Qt::QualityHint)); + d->blurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::QualityHint)); return d->blurFilter.data(); } @@ -167,11 +178,11 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr const QPixmapDropShadowFilter *proto = static_cast<const QPixmapDropShadowFilter *>(prototype); if (proto->blurRadius() <= 5) { if (!d->fastDropShadowFilter) - d->fastDropShadowFilter.reset(new QGLPixmapDropShadowFilter(Qt::PerformanceHint)); + d->fastDropShadowFilter.reset(new QGLPixmapDropShadowFilter(QGraphicsBlurEffect::PerformanceHint)); return d->fastDropShadowFilter.data(); } if (!d->dropShadowFilter) - d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter(Qt::QualityHint)); + d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter(QGraphicsBlurEffect::QualityHint)); return d->dropShadowFilter.data(); } @@ -305,43 +316,344 @@ static const char *qt_gl_texture_sampling_helper = " return texture2D(src, srcCoords).a;\n" "}\n"; -static const char *qt_gl_clamped_texture_sampling_helper = - "highp vec4 texture_dimensions;\n" // x = width, y = height, z = 0.5/width, w = 0.5/height - "lowp float clampedTexture2DAlpha(lowp sampler2D src, highp vec2 srcCoords) {\n" - " highp vec2 clampedCoords = clamp(srcCoords, texture_dimensions.zw, vec2(1.0) - texture_dimensions.zw);\n" - " highp vec2 t = clamp(min(srcCoords, vec2(1.0) - srcCoords) * srcDim + 0.5, 0.0, 1.0);\n" - " return texture2D(src, clampedCoords).a * t.x * t.y;\n" - "}\n" - "lowp vec4 clampedTexture2D(lowp sampler2D src, highp vec2 srcCoords) {\n" - " highp vec2 clampedCoords = clamp(srcCoords, texture_dimensions.zw, vec2(1.0) - texture_dimensions.zw);\n" - " highp vec2 t = clamp(min(srcCoords, vec2(1.0) - srcCoords) * srcDim + 0.5, 0.0, 1.0);\n" - " return texture2D(src, clampedCoords) * t.x * t.y;\n" - "}\n"; +QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint) + : m_animatedBlur(false) + , m_haveCached(false) + , m_cachedRadius(0) + , m_hint(hint) +{ +} -static QByteArray qt_gl_convertToClamped(const QByteArray &source) +// should be even numbers as they will be divided by two +static const int qCachedBlurLevels[] = { 6, 14, 30 }; +static const int qNumCachedBlurTextures = sizeof(qCachedBlurLevels) / sizeof(*qCachedBlurLevels); +static const int qMaxCachedBlurLevel = qCachedBlurLevels[qNumCachedBlurTextures - 1]; + +static qreal qLogBlurLevel(int level) { - QByteArray result; - result.append(qt_gl_clamped_texture_sampling_helper); - result.append(QByteArray(source).replace("texture2DAlpha", "clampedTexture2DAlpha") - .replace("texture2D", "clampedTexture2D")); - return result; + static bool initialized = false; + static qreal logBlurLevelCache[qNumCachedBlurTextures]; + if (!initialized) { + for (int i = 0; i < qNumCachedBlurTextures; ++i) + logBlurLevelCache[i] = qLn(qCachedBlurLevels[i]); + initialized = true; + } + return logBlurLevelCache[level]; } -QGLPixmapBlurFilter::QGLPixmapBlurFilter(Qt::RenderHint hint) - : m_haveCached(false) - , m_cachedRadius(0) - , m_hint(hint) +class QGLBlurTextureInfo +{ +public: + QGLBlurTextureInfo(QSize size, GLuint textureIds[]) + : m_size(size) + { + for (int i = 0; i < qNumCachedBlurTextures; ++i) + m_textureIds[i] = textureIds[i]; + } + + ~QGLBlurTextureInfo() + { + glDeleteTextures(qNumCachedBlurTextures, m_textureIds); + } + + QSize size() const { return m_size; } + GLuint textureId(int i) const { return m_textureIds[i]; } + +private: + GLuint m_textureIds[qNumCachedBlurTextures]; + QSize m_size; +}; + +class QGLBlurTextureCache : public QObject +{ +public: + static QGLBlurTextureCache *cacheForContext(const QGLContext *context); + + QGLBlurTextureCache(); + ~QGLBlurTextureCache(); + + QGLBlurTextureInfo *takeBlurTextureInfo(const QPixmap &pixmap); + bool fitsInCache(const QPixmap &pixmap) const; + bool hasBlurTextureInfo(const QPixmap &pixmap) const; + void insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTextureInfo *info); + void clearBlurTextureInfo(const QPixmap &pixmap); + + void timerEvent(QTimerEvent *event); + +private: + static void pixmapDestroyed(QPixmap *pixmap); + + QCache<quint64, QGLBlurTextureInfo > cache; + + static QList<QGLBlurTextureCache *> blurTextureCaches; + + int timerId; +}; + +QList<QGLBlurTextureCache *> QGLBlurTextureCache::blurTextureCaches; + +static void QGLBlurTextureCache_free(void *ptr) +{ + delete reinterpret_cast<QGLBlurTextureCache *>(ptr); +} + +Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_blur_texture_caches, (QGLBlurTextureCache_free)) + +QGLBlurTextureCache::QGLBlurTextureCache() + : timerId(0) +{ + cache.setMaxCost(4 * 1024 * 1024); + blurTextureCaches.append(this); +} + +QGLBlurTextureCache::~QGLBlurTextureCache() +{ + blurTextureCaches.removeAt(blurTextureCaches.indexOf(this)); +} + +void QGLBlurTextureCache::timerEvent(QTimerEvent *) +{ + killTimer(timerId); + timerId = 0; + + cache.clear(); +} + +QGLBlurTextureCache *QGLBlurTextureCache::cacheForContext(const QGLContext *context) +{ + QGLBlurTextureCache *p = reinterpret_cast<QGLBlurTextureCache *>(qt_blur_texture_caches()->value(context)); + if (!p) { + p = new QGLBlurTextureCache; + qt_blur_texture_caches()->insert(context, p); + } + return p; +} + +QGLBlurTextureInfo *QGLBlurTextureCache::takeBlurTextureInfo(const QPixmap &pixmap) +{ + return cache.take(pixmap.cacheKey()); +} + +void QGLBlurTextureCache::clearBlurTextureInfo(const QPixmap &pixmap) +{ + cache.remove(pixmap.cacheKey()); +} + +bool QGLBlurTextureCache::hasBlurTextureInfo(const QPixmap &pixmap) const +{ + return cache.contains(pixmap.cacheKey()); +} + +void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTextureInfo *info) +{ + static bool hookAdded = false; + if (!hookAdded) { + QImagePixmapCleanupHooks::instance()->addPixmapDestructionHook(pixmapDestroyed); + hookAdded = true; + } + + QImagePixmapCleanupHooks::enableCleanupHooks(pixmap); + cache.insert(pixmap.cacheKey(), info, pixmap.width() * pixmap.height()); + + if (timerId) + killTimer(timerId); + + timerId = startTimer(1000); +} + +bool QGLBlurTextureCache::fitsInCache(const QPixmap &pixmap) const +{ + return pixmap.width() * pixmap.height() <= cache.maxCost(); +} + +void QGLBlurTextureCache::pixmapDestroyed(QPixmap *pixmap) +{ + foreach (QGLBlurTextureCache *cache, blurTextureCaches) { + if (cache->hasBlurTextureInfo(*pixmap)) + cache->clearBlurTextureInfo(*pixmap); + } +} + +static const char *qt_gl_interpolate_filter = + "uniform lowp float interpolationValue;" + "uniform lowp sampler2D interpolateTarget;" + "uniform highp vec4 interpolateMapping;" + "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)" + "{" + " return mix(texture2D(interpolateTarget, interpolateMapping.xy + interpolateMapping.zw * srcCoords)," + " texture2D(src, srcCoords), interpolationValue);" + "}"; + +static void initializeTexture(GLuint id, int width, int height) { + glBindTexture(GL_TEXTURE_2D, id); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glBindTexture(GL_TEXTURE_2D, 0); } bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const { QGLPixmapBlurFilter *filter = const_cast<QGLPixmapBlurFilter *>(this); + QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext()); + QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx); + + if (m_hint == QGraphicsBlurEffect::AnimationHint && blurTextureCache->fitsInCache(src)) { + QRect targetRect = src.rect().adjusted(-qMaxCachedBlurLevel, -qMaxCachedBlurLevel, qMaxCachedBlurLevel, qMaxCachedBlurLevel); + // ensure even dimensions (going to divide by two) + targetRect.setWidth((targetRect.width() + 1) & ~1); + targetRect.setHeight((targetRect.height() + 1) & ~1); + + QGLBlurTextureInfo *info = 0; + if (blurTextureCache->hasBlurTextureInfo(src)) { + info = blurTextureCache->takeBlurTextureInfo(src); + } else { + m_animatedBlur = false; + m_hint = QGraphicsBlurEffect::QualityHint; + m_singlePass = false; + + QGLFramebufferObjectFormat format; + format.setInternalTextureFormat(GL_RGBA); + QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size() / 2, format, true); + + if (!fbo) + return false; + + QPainter fboPainter(fbo); + QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(fboPainter.paintEngine()); + + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); + + // ensure GL_LINEAR filtering is used for scaling down to half the size + fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); + fboPainter.setCompositionMode(QPainter::CompositionMode_Source); + fboPainter.drawPixmap(qMaxCachedBlurLevel / 2, qMaxCachedBlurLevel / 2, + targetRect.width() / 2 - qMaxCachedBlurLevel, targetRect.height() / 2 - qMaxCachedBlurLevel, src); + + GLuint textures[qNumCachedBlurTextures]; // blur textures + glGenTextures(qNumCachedBlurTextures, textures); + GLuint temp; // temp texture + glGenTextures(1, &temp); + + initializeTexture(temp, fbo->width(), fbo->height()); + m_textureSize = fbo->size(); + + int currentBlur = 0; + + QRect fboRect(0, 0, fbo->width(), fbo->height()); + GLuint sourceTexture = fbo->texture(); + for (int i = 0; i < qNumCachedBlurTextures; ++i) { + int targetBlur = qCachedBlurLevels[i] / 2; + + int blurDelta = qRound(qSqrt(targetBlur * targetBlur - currentBlur * currentBlur)); + QByteArray source = generateGaussianShader(blurDelta); + filter->setSource(source); + + currentBlur = targetBlur; + + // now we're going to be nasty and keep using the same FBO with different textures + glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, temp, 0); + + m_horizontalBlur = true; + filter->setOnPainter(&fboPainter); + engine->drawTexture(fboRect, sourceTexture, fbo->size(), fboRect); + filter->removeFromPainter(&fboPainter); + + sourceTexture = textures[i]; + initializeTexture(sourceTexture, fbo->width(), fbo->height()); + + glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, textures[i], 0); + + m_horizontalBlur = false; + filter->setOnPainter(&fboPainter); + engine->drawTexture(fboRect, temp, fbo->size(), fboRect); + filter->removeFromPainter(&fboPainter); + } + + glDeleteTextures(1, &temp); + + // reattach the original FBO texture + glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, fbo->texture(), 0); + + fboPainter.end(); + + qgl_fbo_pool()->release(fbo); + + info = new QGLBlurTextureInfo(fboRect.size(), textures); + } + + if (!m_haveCached || !m_animatedBlur) { + m_haveCached = true; + m_animatedBlur = true; + m_hint = QGraphicsBlurEffect::AnimationHint; + filter->setSource(qt_gl_interpolate_filter); + } + + QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine()); + painter->setRenderHint(QPainter::SmoothPixmapTransform); + filter->setOnPainter(painter); + + qreal logRadius = qLn(radius()); + + int t; + for (t = -1; t < qNumCachedBlurTextures - 2; ++t) { + if (logRadius < qLogBlurLevel(t+1)) + break; + } + + qreal logBase = t >= 0 ? qLogBlurLevel(t) : 0; + m_t = qBound(qreal(0), (logRadius - logBase) / (qLogBlurLevel(t+1) - logBase), qreal(1)); + + m_textureSize = info->size(); + + glActiveTexture(GL_TEXTURE0 + 3); + if (t >= 0) { + glBindTexture(GL_TEXTURE_2D, info->textureId(t)); + m_targetSize = info->size(); + } else { + QGLTexture *texture = + ctx->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption + | QGLContext::CanFlipNativePixmapBindOption); + m_targetSize = src.size(); + if (!(texture->options & QGLContext::InvertedYBindOption)) + m_targetSize.setHeight(-m_targetSize.height()); + } + + // restrict the target rect to the max of the radii we are interpolating between + int radiusDelta = qMaxCachedBlurLevel - qCachedBlurLevels[t+1]; + targetRect = targetRect.translated(pos.toPoint()).adjusted(radiusDelta, radiusDelta, -radiusDelta, -radiusDelta); + + radiusDelta /= 2; + QRect sourceRect = QRect(QPoint(), m_textureSize).adjusted(radiusDelta, radiusDelta, -radiusDelta, -radiusDelta); + + engine->drawTexture(targetRect, info->textureId(t+1), m_textureSize, sourceRect); + + glActiveTexture(GL_TEXTURE0 + 3); + glBindTexture(GL_TEXTURE_2D, 0); + + filter->removeFromPainter(painter); + blurTextureCache->insertBlurTextureInfo(src, info); + + return true; + } + + if (blurTextureCache->hasBlurTextureInfo(src)) + blurTextureCache->clearBlurTextureInfo(src); + int actualRadius = qRound(radius()); int filterRadius = actualRadius; int fastRadii[] = { 1, 2, 3, 5, 8, 15, 25 }; - if (m_hint == Qt::PerformanceHint) { + if (m_hint != QGraphicsBlurEffect::QualityHint) { uint i = 0; for (; i < (sizeof(fastRadii)/sizeof(*fastRadii))-1; ++i) { if (fastRadii[i+1] > filterRadius) @@ -352,9 +664,10 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const m_singlePass = filterRadius <= 3; - if (!m_haveCached || filterRadius != m_cachedRadius) { + if (!m_haveCached || m_animatedBlur || filterRadius != m_cachedRadius) { // Only regenerate the shader from source if parameters have changed. m_haveCached = true; + m_animatedBlur = false; m_cachedRadius = filterRadius; QByteArray source = generateGaussianShader(filterRadius, m_singlePass); filter->setSource(source); @@ -389,13 +702,12 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPainter fboPainter(fbo); - if (src.hasAlphaChannel()) { - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); - } + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); // ensure GL_LINEAR filtering is used fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); + fboPainter.setCompositionMode(QPainter::CompositionMode_Source); filter->setOnPainter(&fboPainter); QBrush pixmapBrush = src; pixmapBrush.setTransform(QTransform::fromTranslate(actualRadius, actualRadius)); @@ -428,7 +740,29 @@ void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - if (m_hint == Qt::QualityHint) { + if (m_animatedBlur) { + program->setUniformValue("interpolateTarget", 3); + program->setUniformValue("interpolationValue", GLfloat(m_t)); + + if (m_textureSize == m_targetSize) { + program->setUniformValue("interpolateMapping", 0.0f, 0.0f, 1.0f, 1.0f); + } else { + float offsetX = (-qMaxCachedBlurLevel - 0.5) / qreal(m_targetSize.width()); + float offsetY = (-qMaxCachedBlurLevel - 0.5) / qreal(m_targetSize.height()); + + if (m_targetSize.height() < 0) + offsetY = 1 + offsetY; + + float scaleX = 2.0f * qreal(m_textureSize.width()) / qreal(m_targetSize.width()); + float scaleY = 2.0f * qreal(m_textureSize.height()) / qreal(m_targetSize.height()); + + program->setUniformValue("interpolateMapping", offsetX, offsetY, scaleX, scaleY); + } + + return; + } + + if (m_hint == QGraphicsBlurEffect::QualityHint) { if (m_singlePass) program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); else if (m_horizontalBlur) @@ -578,7 +912,7 @@ QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius, bool singlePa return source; } -QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(Qt::RenderHint hint) +QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHint hint) : m_haveCached(false) , m_cachedRadius(0) , m_hint(hint) @@ -632,13 +966,12 @@ bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos, QPainter fboPainter(fbo); - if (src.hasAlphaChannel()) { - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); - } + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); // ensure GL_LINEAR filtering is used fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); + fboPainter.setCompositionMode(QPainter::CompositionMode_Source); filter->setOnPainter(&fboPainter); QBrush pixmapBrush = src; pixmapBrush.setTransform(QTransform::fromTranslate(actualRadius, actualRadius)); @@ -685,7 +1018,7 @@ void QGLPixmapDropShadowFilter::setUniforms(QGLShaderProgram *program) alpha); } - if (m_hint == Qt::QualityHint) { + if (m_hint == QGraphicsBlurEffect::QualityHint) { if (m_singlePass) program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); else if (m_horizontalBlur) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 90b496e..080c3b2 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -106,30 +106,6 @@ QT_BEGIN_NAMESPACE \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 2 - \section1 Partial shaders - - Desktop GLSL can attach an arbitrary number of vertex and fragment - shaders to a shader program. Embedded GLSL/ES on the other hand - supports only a single shader of each type on a shader program. - - Multiple shaders of the same type can be useful when large libraries - of shaders are needed. Common functions can be factored out into - library shaders that can be reused in multiple shader programs. - - To support this use of shaders, the application programmer can - create shaders with the QGLShader::PartialVertexShader and - QGLShader::PartialFragmentShader types. These types direct - QGLShader and QGLShaderProgram to delay shader compilation until - link time. - - When link() is called, the sources for the partial shaders are - concatenated, and a single vertex or fragment shader is compiled - and linked into the shader program. - - It is more efficient to use the QGLShader::VertexShader and - QGLShader::FragmentShader when there is only one shader of that - type in the program. - \sa QGLShader */ @@ -154,11 +130,6 @@ QT_BEGIN_NAMESPACE \value VertexShader Vertex shader written in the OpenGL Shading Language (GLSL). \value FragmentShader Fragment shader written in the OpenGL Shading Language (GLSL). - - \value PartialVertexShader Partial vertex shader that will be concatenated with all other partial vertex shaders at link time. - \value PartialFragmentShader Partial fragment shader that will be concatenated with all other partial fragment shaders at link time. - - \omitvalue PartialShader */ #ifndef GL_FRAGMENT_SHADER @@ -209,8 +180,6 @@ public: : shaderGuard(context) , shaderType(type) , compiled(false) - , isPartial((type & QGLShader::PartialShader) != 0) - , hasPartialSource(false) { } ~QGLShaderPrivate(); @@ -218,10 +187,7 @@ public: QGLSharedResourceGuard shaderGuard; QGLShader::ShaderType shaderType; bool compiled; - bool isPartial; - bool hasPartialSource; QString log; - QByteArray partialSource; bool create(); bool compile(QGLShader *q); @@ -243,8 +209,6 @@ bool QGLShaderPrivate::create() const QGLContext *context = shaderGuard.context(); if (!context) return false; - if (isPartial) - return true; if (qt_resolve_glsl_extensions(const_cast<QGLContext *>(context))) { GLuint shader; if (shaderType == QGLShader::VertexShader) @@ -264,11 +228,6 @@ bool QGLShaderPrivate::create() bool QGLShaderPrivate::compile(QGLShader *q) { - // Partial shaders are compiled during QGLShaderProgram::link(). - if (isPartial && hasPartialSource) { - compiled = true; - return true; - } GLuint shader = shaderGuard.id(); if (!shader) return false; @@ -441,21 +400,12 @@ static const char redefineHighp[] = Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - If shaderType() is PartialVertexShader or PartialFragmentShader, - then this function will always return true, even if the source code - is invalid. Partial shaders are compiled when QGLShaderProgram::link() - is called. - \sa compileFile() */ bool QGLShader::compile(const char *source) { Q_D(QGLShader); - if (d->isPartial) { - d->partialSource = QByteArray(source); - d->hasPartialSource = true; - return d->compile(this); - } else if (d->shaderGuard.id()) { + if (d->shaderGuard.id()) { QVarLengthArray<const char *, 4> src; QVarLengthArray<GLint, 4> srclen; int headerLen = 0; @@ -481,8 +431,7 @@ bool QGLShader::compile(const char *source) srclen.append(GLint(sizeof(qualifierDefines) - 1)); #endif #ifdef QGL_REDEFINE_HIGHP - if (d->shaderType == FragmentShader || - d->shaderType == PartialFragmentShader) { + if (d->shaderType == FragmentShader) { src.append(redefineHighp); srclen.append(GLint(sizeof(redefineHighp) - 1)); } @@ -497,71 +446,11 @@ bool QGLShader::compile(const char *source) } /*! - \internal -*/ -bool QGLShader::compile - (const QList<QGLShader *>& shaders, QGLShader::ShaderType type) -{ - Q_D(QGLShader); - QVarLengthArray<const char *, 16> src; - QVarLengthArray<GLint, 16> srclen; - if (!d->shaderGuard.id()) - return false; - foreach (QGLShader *shader, shaders) { - if (shader->shaderType() != type) - continue; - const char *source = shader->d_func()->partialSource.constData(); - int headerLen = 0; - if (src.isEmpty()) { - // First shader: handle the #version and #extension tags - // plus the precision qualifiers. - while (source && source[headerLen] == '#') { - // Skip #version and #extension directives at the start of - // the shader code. We need to insert the qualifierDefines - // and redefineHighp just after them. - if (qstrncmp(source + headerLen, "#version", 8) != 0 && - qstrncmp(source + headerLen, "#extension", 10) != 0) { - break; - } - while (source[headerLen] != '\0' && source[headerLen] != '\n') - ++headerLen; - if (source[headerLen] == '\n') - ++headerLen; - } - if (headerLen > 0) { - src.append(source); - srclen.append(GLint(headerLen)); - } -#ifdef QGL_DEFINE_QUALIFIERS - src.append(qualifierDefines); - srclen.append(GLint(sizeof(qualifierDefines) - 1)); -#endif -#ifdef QGL_REDEFINE_HIGHP - if (d->shaderType == FragmentShader || - d->shaderType == PartialFragmentShader) { - src.append(redefineHighp); - srclen.append(GLint(sizeof(redefineHighp) - 1)); - } -#endif - } - src.append(source + headerLen); - srclen.append(GLint(qstrlen(source + headerLen))); - } - glShaderSource(d->shaderGuard.id(), src.size(), src.data(), srclen.data()); - return d->compile(this); -} - -/*! \overload Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - If shaderType() is PartialVertexShader or PartialFragmentShader, - then this function will always return true, even if the source code - is invalid. Partial shaders are compiled when QGLShaderProgram::link() - is called. - \sa compileFile() */ bool QGLShader::compile(const QByteArray& source) @@ -575,11 +464,6 @@ bool QGLShader::compile(const QByteArray& source) Sets the \a source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise. - If shaderType() is PartialVertexShader or PartialFragmentShader, - then this function will always return true, even if the source code - is invalid. Partial shaders are compiled when QGLShaderProgram::link() - is called. - \sa compileFile() */ bool QGLShader::compile(const QString& source) @@ -592,11 +476,6 @@ bool QGLShader::compile(const QString& source) and compiles it. Returns true if the file could be opened and the source compiled, false otherwise. - If shaderType() is PartialVertexShader or PartialFragmentShader, - then this function will always return true, even if the source code - is invalid. Partial shaders are compiled when QGLShaderProgram::link() - is called. - \sa compile() */ bool QGLShader::compileFile(const QString& fileName) @@ -619,8 +498,6 @@ bool QGLShader::compileFile(const QString& fileName) QByteArray QGLShader::sourceCode() const { Q_D(const QGLShader); - if (d->isPartial) - return d->partialSource; GLuint shader = d->shaderGuard.id(); if (!shader) return QByteArray(); @@ -661,10 +538,6 @@ QString QGLShader::log() const /*! Returns the OpenGL identifier associated with this shader. - If shaderType() is PartialVertexShader or PartialFragmentShader, - this function will always return zero. Partial shaders are - created and compiled when QGLShaderProgram::link() is called. - \sa QGLShaderProgram::programId() */ GLuint QGLShader::shaderId() const @@ -684,7 +557,6 @@ public: : programGuard(context) , linked(false) , inited(false) - , hasPartialShaders(false) , removingShaders(false) , vertexShader(0) , fragmentShader(0) @@ -695,7 +567,6 @@ public: QGLSharedResourceGuard programGuard; bool linked; bool inited; - bool hasPartialShaders; bool removingShaders; QString log; QList<QGLShader *> shaders; @@ -812,13 +683,9 @@ bool QGLShaderProgram::addShader(QGLShader *shader) } if (!shader->d_func()->compiled) return false; - if (!shader->d_func()->isPartial) { - if (!shader->d_func()->shaderGuard.id()) - return false; - glAttachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id()); - } else { - d->hasPartialShaders = true; - } + if (!shader->d_func()->shaderGuard.id()) + return false; + glAttachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id()); d->linked = false; // Program needs to be relinked. d->shaders.append(shader); connect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed())); @@ -999,45 +866,6 @@ bool QGLShaderProgram::link() GLuint program = d->programGuard.id(); if (!program) return false; - if (d->hasPartialShaders) { - // Compile the partial vertex and fragment shaders. - if (d->hasShader(QGLShader::PartialVertexShader)) { - if (!d->vertexShader) { - d->vertexShader = - new QGLShader(QGLShader::VertexShader, this); - } - if (!d->vertexShader->compile - (d->shaders, QGLShader::PartialVertexShader)) { - d->log = d->vertexShader->log(); - return false; - } - glAttachShader(program, d->vertexShader->d_func()->shaderGuard.id()); - } else { - if (d->vertexShader) { - glDetachShader(program, d->vertexShader->d_func()->shaderGuard.id()); - delete d->vertexShader; - d->vertexShader = 0; - } - } - if (d->hasShader(QGLShader::PartialFragmentShader)) { - if (!d->fragmentShader) { - d->fragmentShader = - new QGLShader(QGLShader::FragmentShader, this); - } - if (!d->fragmentShader->compile - (d->shaders, QGLShader::PartialFragmentShader)) { - d->log = d->fragmentShader->log(); - return false; - } - glAttachShader(program, d->fragmentShader->d_func()->shaderGuard.id()); - } else { - if (d->fragmentShader) { - glDetachShader(program, d->fragmentShader->d_func()->shaderGuard.id()); - delete d->fragmentShader; - d->fragmentShader = 0; - } - } - } glLinkProgram(program); GLint value = 0; glGetProgramiv(program, GL_LINK_STATUS, &value); diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index 708cf09..b7bd2d7 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -66,12 +66,7 @@ public: enum ShaderTypeBits { VertexShader = 0x0001, - FragmentShader = 0x0002, - - PartialShader = 0x1000, - - PartialVertexShader = PartialShader | VertexShader, - PartialFragmentShader = PartialShader | FragmentShader + FragmentShader = 0x0002 }; Q_DECLARE_FLAGS(ShaderType, ShaderTypeBits) @@ -100,8 +95,6 @@ private: Q_DISABLE_COPY(QGLShader) Q_DECLARE_PRIVATE(QGLShader) - - bool compile(const QList<QGLShader *>& shaders, QGLShader::ShaderType type); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QGLShader::ShaderType) diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index c965947..5ca37ef 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -89,13 +89,22 @@ static inline QSize maybeRoundToNextPowerOfTwo(const QSize &sz) } -QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize, const QGLFramebufferObjectFormat &requestFormat) +QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize, const QGLFramebufferObjectFormat &requestFormat, bool strictSize) { QGLFramebufferObject *chosen = 0; QGLFramebufferObject *candidate = 0; for (int i = 0; !chosen && i < m_fbos.size(); ++i) { QGLFramebufferObject *fbo = m_fbos.at(i); + if (strictSize) { + if (fbo->size() == requestSize && fbo->format() == requestFormat) { + chosen = fbo; + break; + } else { + continue; + } + } + if (fbo->format() == requestFormat) { // choose the fbo with a matching format and the closest size if (!candidate || areaDiff(requestSize, candidate) > areaDiff(requestSize, fbo)) @@ -127,7 +136,10 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize } if (!chosen) { - chosen = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(requestSize), requestFormat); + if (strictSize) + chosen = new QGLFramebufferObject(requestSize, requestFormat); + else + chosen = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(requestSize), requestFormat); } if (!chosen->isValid()) { @@ -140,7 +152,8 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize void QGLFramebufferObjectPool::release(QGLFramebufferObject *fbo) { - m_fbos << fbo; + if (fbo) + m_fbos << fbo; } diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h index 6190d38..8a13e03 100644 --- a/src/opengl/qpixmapdata_gl_p.h +++ b/src/opengl/qpixmapdata_gl_p.h @@ -69,7 +69,7 @@ class QGLPixmapData; class QGLFramebufferObjectPool { public: - QGLFramebufferObject *acquire(const QSize &size, const QGLFramebufferObjectFormat &format); + QGLFramebufferObject *acquire(const QSize &size, const QGLFramebufferObjectFormat &format, bool strictSize = false); void release(QGLFramebufferObject *fbo); private: diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 8a485a0..047d9d8 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1178,6 +1178,8 @@ VGPaintType QVGPaintEnginePrivate::setBrush case Qt::TexturePattern: { // The brush is a texture specified by a QPixmap/QImage. QPixmapData *pd = brush.texture().pixmapData(); + if (!pd) + break; // null QPixmap VGImage vgImg; bool deref = false; if (pd->pixelType() == QPixmapData::BitmapType) { @@ -2893,6 +2895,8 @@ void qt_vg_drawVGImageStencil void QVGPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { QPixmapData *pd = pm.pixmapData(); + if (!pd) + return; // null QPixmap if (pd->classId() == QPixmapData::OpenVGClass) { Q_D(QVGPaintEngine); QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd); @@ -2910,6 +2914,8 @@ void QVGPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF void QVGPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm) { QPixmapData *pd = pm.pixmapData(); + if (!pd) + return; // null QPixmap if (pd->classId() == QPixmapData::OpenVGClass) { Q_D(QVGPaintEngine); QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd); @@ -2985,6 +2991,8 @@ void QVGPaintEngine::drawPixmaps // If the pixmap is not VG, or the transformation is projective, // then fall back to the default implementation. QPixmapData *pd = pixmap.pixmapData(); + if (!pd) + return; // null QPixmap if (pd->classId() != QPixmapData::OpenVGClass || !d->simpleTransform) { QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints); return; @@ -3581,6 +3589,8 @@ void QVGCompositionHelper::drawCursorPixmap // Fetch the VGImage from the pixmap if possible. QPixmapData *pd = pixmap.pixmapData(); + if (!pd) + return; // null QPixmap if (pd->classId() == QPixmapData::OpenVGClass) { QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd); if (vgpd->isValid()) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index f86e116..3254aa3 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -369,6 +369,8 @@ QImage::Format QVGPixmapData::sourceFormat() const Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap) { QPixmapData *pd = pixmap.pixmapData(); + if (!pd) + return VG_INVALID_HANDLE; // null QPixmap if (pd->classId() == QPixmapData::OpenVGClass) { QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd); if (vgpd->isValid()) diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp index 8e104db..e17c728 100644 --- a/src/openvg/qpixmapfilter_vg.cpp +++ b/src/openvg/qpixmapfilter_vg.cpp @@ -65,6 +65,9 @@ void QVGPixmapConvolutionFilter::draw (QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { + if (src.isNull()) + return; + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall // back to the default convolution filter implementation. @@ -135,6 +138,9 @@ QVGPixmapColorizeFilter::~QVGPixmapColorizeFilter() void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { + if (src.isNull()) + return; + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall // back to the default colorize filter implementation. @@ -225,6 +231,9 @@ QVGPixmapDropShadowFilter::~QVGPixmapDropShadowFilter() void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { + if (src.isNull()) + return; + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall // back to the default drop shadow filter implementation. @@ -290,6 +299,9 @@ QVGPixmapBlurFilter::~QVGPixmapBlurFilter() void QVGPixmapBlurFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { + if (src.isNull()) + return; + if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall // back to the default blur filter implementation. diff --git a/src/plugins/gfxdrivers/qvfb/main.cpp b/src/plugins/gfxdrivers/qvfb/main.cpp index bcaecab..beca37e 100644 --- a/src/plugins/gfxdrivers/qvfb/main.cpp +++ b/src/plugins/gfxdrivers/qvfb/main.cpp @@ -43,6 +43,7 @@ #include <qscreenvfb_qws.h> #include <qstringlist.h> +#ifndef QT_NO_LIBRARY QT_BEGIN_NAMESPACE class ScreenVfbDriver : public QScreenDriverPlugin @@ -78,3 +79,4 @@ Q_EXPORT_STATIC_PLUGIN(ScreenVfbDriver) Q_EXPORT_PLUGIN2(qscreenvfb, ScreenVfbDriver) QT_END_NAMESPACE +#endif //QT_NO_LIBRARY diff --git a/src/plugins/gfxdrivers/transformed/main.cpp b/src/plugins/gfxdrivers/transformed/main.cpp index 982882e..a9ff97d 100644 --- a/src/plugins/gfxdrivers/transformed/main.cpp +++ b/src/plugins/gfxdrivers/transformed/main.cpp @@ -42,7 +42,7 @@ #include <qscreendriverplugin_qws.h> #include <qscreentransformed_qws.h> #include <qstringlist.h> - +#ifndef QT_NO_LIBRARY QT_BEGIN_NAMESPACE class GfxTransformedDriver : public QScreenDriverPlugin @@ -68,9 +68,12 @@ QStringList GfxTransformedDriver::keys() const QScreen* GfxTransformedDriver::create(const QString& driver, int displayId) { +#ifndef QT_NO_QWS_TRANSFORMED if (driver.toLower() == "transformed") return new QTransformedScreen(displayId); - +#else //QT_NO_QWS_TRANSFORMED + printf("QT buildt with QT_NO_QWS_TRANSFORMED. No screen driver returned\n"); +#endif //QT_NO_QWS_TRANSFORMED return 0; } @@ -78,3 +81,4 @@ Q_EXPORT_STATIC_PLUGIN(GfxTransformedDriver) Q_EXPORT_PLUGIN2(qgfxtransformed, GfxTransformedDriver) QT_END_NAMESPACE +#endif //QT_NO_LIBRARY diff --git a/src/plugins/gfxdrivers/vnc/main.cpp b/src/plugins/gfxdrivers/vnc/main.cpp index aa20d11..58c8c25 100644 --- a/src/plugins/gfxdrivers/vnc/main.cpp +++ b/src/plugins/gfxdrivers/vnc/main.cpp @@ -43,6 +43,7 @@ #include <qscreenvnc_qws.h> #include <qstringlist.h> +#ifndef QT_NO_LIBRARY QT_BEGIN_NAMESPACE class GfxVncDriver : public QScreenDriverPlugin @@ -68,9 +69,12 @@ QStringList GfxVncDriver::keys() const QScreen* GfxVncDriver::create(const QString& driver, int displayId) { +#ifndef QT_NO_QWS_VNC if (driver.toLower() == "vnc") return new QVNCScreen(displayId); - +#else //QT_NO_QWS_VNC + printf("QT buildt with QT_NO_QWS_VNC. No screen driver returned\n"); +#endif //QT_NO_QWS_VNC return 0; } @@ -78,3 +82,5 @@ Q_EXPORT_STATIC_PLUGIN(GfxVncDriver) Q_EXPORT_PLUGIN2(qgfxvnc, GfxVncDriver) QT_END_NAMESPACE + +#endif //QT_NO_LIBRARY diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index 345489f..caf1018 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -1190,6 +1190,7 @@ bool QObjectDelegate::getOwnPropertySlot(QScriptObject *object, JSC::ExecState * const JSC::Identifier &propertyName, JSC::PropertySlot &slot) { +#ifndef QT_NO_PROPERTIES QByteArray name = QString(propertyName.ustring()).toLatin1(); QObject *qobject = data->value; if (!qobject) { @@ -1296,12 +1297,16 @@ bool QObjectDelegate::getOwnPropertySlot(QScriptObject *object, JSC::ExecState * } return QScriptObjectDelegate::getOwnPropertySlot(object, exec, propertyName, slot); +#else //QT_NO_PROPERTIES + return false; +#endif //QT_NO_PROPERTIES } void QObjectDelegate::put(QScriptObject *object, JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSValue value, JSC::PutPropertySlot &slot) { +#ifndef QT_NO_PROPERTIES QByteArray name = ((QString)propertyName.ustring()).toLatin1(); QObject *qobject = data->value; if (!qobject) { @@ -1392,12 +1397,14 @@ void QObjectDelegate::put(QScriptObject *object, JSC::ExecState* exec, } QScriptObjectDelegate::put(object, exec, propertyName, value, slot); +#endif //QT_NO_PROPERTIES } bool QObjectDelegate::deleteProperty(QScriptObject *object, JSC::ExecState *exec, const JSC::Identifier& propertyName, bool checkDontDelete) { +#ifndef QT_NO_PROPERTIES QByteArray name = ((QString)propertyName.ustring()).toLatin1(); QObject *qobject = data->value; if (!qobject) { @@ -1436,6 +1443,9 @@ bool QObjectDelegate::deleteProperty(QScriptObject *object, JSC::ExecState *exec } return QScriptObjectDelegate::deleteProperty(object, exec, propertyName, checkDontDelete); +#else //QT_NO_PROPERTIES + return false; +#endif //QT_NO_PROPERTIES } bool QObjectDelegate::getPropertyAttributes(const QScriptObject *object, @@ -1443,6 +1453,7 @@ bool QObjectDelegate::getPropertyAttributes(const QScriptObject *object, const JSC::Identifier &propertyName, unsigned &attributes) const { +#ifndef QT_NO_PROPERTIES // ### try to avoid duplicating logic from getOwnPropertySlot() QByteArray name = ((QString)propertyName.ustring()).toLatin1(); QObject *qobject = data->value; @@ -1511,12 +1522,16 @@ bool QObjectDelegate::getPropertyAttributes(const QScriptObject *object, } return QScriptObjectDelegate::getPropertyAttributes(object, exec, propertyName, attributes); +#else //QT_NO_PROPERTIES + return false; +#endif //QT_NO_PROPERTIES } void QObjectDelegate::getOwnPropertyNames(QScriptObject *object, JSC::ExecState *exec, JSC::PropertyNameArray &propertyNames, bool includeNonEnumerable) { +#ifndef QT_NO_PROPERTIES QObject *qobject = data->value; if (!qobject) { QString message = QString::fromLatin1("cannot get property names of deleted QObject"); @@ -1560,6 +1575,7 @@ void QObjectDelegate::getOwnPropertyNames(QScriptObject *object, JSC::ExecState } QScriptObjectDelegate::getOwnPropertyNames(object, exec, propertyNames, includeNonEnumerable); +#endif //QT_NO_PROPERTIES } void QObjectDelegate::markChildren(QScriptObject *object, JSC::MarkStack& markStack) diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp index 2508833..ca1502c 100644 --- a/src/sql/drivers/tds/qsql_tds.cpp +++ b/src/sql/drivers/tds/qsql_tds.cpp @@ -164,13 +164,13 @@ Q_GLOBAL_STATIC(QTDSErrorHash, errs) extern "C" { static int CS_PUBLIC qTdsMsgHandler (DBPROCESS* dbproc, - DBINT /*msgno*/, + DBINT msgno, int msgstate, int severity, char* msgtext, - char* /*srvname*/, + char* srvname, char* /*procname*/, - int /*line*/) + int line) { QTDSResultPrivate* p = errs()->value(dbproc); @@ -181,9 +181,20 @@ static int CS_PUBLIC qTdsMsgHandler (DBPROCESS* dbproc, } if (severity > 0) { - QString errMsg = QString::fromLatin1("%1 (%2)").arg(QString::fromAscii(msgtext)).arg( - msgstate); + QString errMsg = QString::fromLatin1("%1 (Msg %2, Level %3, State %4, Server %5, Line %6)") + .arg(QString::fromAscii(msgtext)) + .arg(msgno) + .arg(severity) + .arg(msgstate) + .arg(QString::fromAscii(srvname)) + .arg(line); p->addErrorMsg(errMsg); + if (severity > 10) { + // Severe messages are really errors in the sense of lastError + errMsg = p->getErrorMsgs(); + p->lastError = qMakeError(errMsg, QSqlError::UnknownError, msgno); + p->clearErrorMsgs(); + } } return INT_CANCEL; diff --git a/src/src.pro b/src/src.pro index 238f534..5307612 100644 --- a/src/src.pro +++ b/src/src.pro @@ -32,6 +32,7 @@ contains(QT_CONFIG, webkit) { } contains(QT_CONFIG, script): SRC_SUBDIRS += src_script contains(QT_CONFIG, scripttools): SRC_SUBDIRS += src_scripttools +contains(QT_CONFIG, declarative): SRC_SUBDIRS += src_declarative SRC_SUBDIRS += src_plugins src_s60main.subdir = $$QT_SOURCE_TREE/src/s60main @@ -92,6 +93,8 @@ src_javascriptcore.subdir = $$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore src_javascriptcore.target = sub-javascriptcore src_webkit.subdir = $$QT_SOURCE_TREE/src/3rdparty/webkit/WebCore src_webkit.target = sub-webkit +src_declarative.subdir = $$QT_SOURCE_TREE/src/declarative +src_declarative.target = sub-declarative #CONFIG += ordered !wince*:!symbian:!ordered { @@ -118,10 +121,12 @@ src_webkit.target = sub-webkit src_tools_uic3.depends = src_qt3support src_xml src_tools_idc.depends = src_corelib src_tools_activeqt.depends = src_tools_idc src_gui + src_declarative.depends = src_xml src_gui src_script src_network src_svg src_plugins.depends = src_gui src_sql src_svg contains(QT_CONFIG, webkit) { src_webkit.depends = src_gui src_sql src_network src_xml contains(QT_CONFIG, phonon):src_webkit.depends += src_phonon + contains(QT_CONFIG, declarative):src_declarative.depends += src_webkit #exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): src_webkit.depends += src_javascriptcore } contains(QT_CONFIG, qt3support): src_plugins.depends += src_qt3support diff --git a/src/xmlpatterns/expr/qncnameconstructor_p.h b/src/xmlpatterns/expr/qncnameconstructor_p.h index 6875c48..bbf9726 100644 --- a/src/xmlpatterns/expr/qncnameconstructor_p.h +++ b/src/xmlpatterns/expr/qncnameconstructor_p.h @@ -112,7 +112,7 @@ namespace QPatternist { return QtXmlPatterns::tr("The target name in a processing instruction " "cannot be %1 in any combination of upper " - "and lower case. Therefore, is %2 invalid.") + "and lower case. Therefore, %2 is invalid.") .arg(formatKeyword("xml"), formatKeyword(lexTarget)); } }; diff --git a/src/xmlpatterns/parser/qquerytransformparser.cpp b/src/xmlpatterns/parser/qquerytransformparser.cpp index 5894b83..c250d0c 100644 --- a/src/xmlpatterns/parser/qquerytransformparser.cpp +++ b/src/xmlpatterns/parser/qquerytransformparser.cpp @@ -418,7 +418,7 @@ static void registerNamedTemplate(const QXmlName &name, if(e) { - parseInfo->staticContext->error(QtXmlPatterns::tr("A template by name %1 " + parseInfo->staticContext->error(QtXmlPatterns::tr("A template with name %1 " "has already been declared.") .arg(formatKeyword(parseInfo->staticContext->namePool(), name)), @@ -882,7 +882,7 @@ static void variableUnavailable(const QXmlName &variableName, const ParserContext *const parseInfo, const YYLTYPE &location) { - parseInfo->staticContext->error(QtXmlPatterns::tr("No variable by name %1 exists") + parseInfo->staticContext->error(QtXmlPatterns::tr("No variable with name %1 exists") .arg(formatKeyword(parseInfo->staticContext->namePool(), variableName)), ReportContext::XPST0008, fromYYLTYPE(location, parseInfo)); } @@ -4028,7 +4028,7 @@ yyreduce: const AtomicValue::Ptr val(Decimal::fromLexical((yyvsp[(2) - (2)].sval))); if(val->hasError()) { - parseInfo->staticContext->error(QtXmlPatterns::tr("The value of attribute %1 must of type %2, which %3 isn't.") + parseInfo->staticContext->error(QtXmlPatterns::tr("The value of attribute %1 must be of type %2, which %3 isn't.") .arg(formatKeyword(QLatin1String("priority")), formatType(parseInfo->staticContext->namePool(), BuiltinTypes::xsDecimal), formatData((yyvsp[(2) - (2)].sval))), @@ -4104,7 +4104,7 @@ yyreduce: else if ((yyvsp[(5) - (7)].sval) == CommonNamespaces::XML || (yyvsp[(3) - (7)].sval) == QLatin1String("xml")) { parseInfo->staticContext->error(QtXmlPatterns::tr( - "The prefix %1 can not be bound. By default, it is already bound " + "The prefix %1 cannot be bound. By default, it is already bound " "to the namespace %2.") .arg(formatKeyword("xml")) .arg(formatURI(CommonNamespaces::XML)), @@ -4415,7 +4415,7 @@ yyreduce: allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(3) - (9)].enums.Bool)); if(variableByName((yyvsp[(5) - (9)].qName), parseInfo)) { - parseInfo->staticContext->error(QtXmlPatterns::tr("A variable by name %1 has already " + parseInfo->staticContext->error(QtXmlPatterns::tr("A variable with name %1 has already " "been declared.") .arg(formatKeyword(parseInfo->staticContext->namePool()->toLexical((yyvsp[(5) - (9)].qName)))), parseInfo->isXSLT() ? ReportContext::XTSE0630 : ReportContext::XQST0049, @@ -4455,7 +4455,7 @@ yyreduce: else { parseInfo->staticContext->error(QtXmlPatterns::tr("No value is available for the external " - "variable by name %1.") + "variable with name %1.") .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(5) - (9)].qName))), parseInfo->isXSLT() ? ReportContext::XTDE0050 : ReportContext::XPDY0002, fromYYLTYPE((yyloc), parseInfo)); @@ -4674,7 +4674,7 @@ yyreduce: { if((*it)->name() == (yyvsp[(3) - (3)].functionArgument)->name()) { - parseInfo->staticContext->error(QtXmlPatterns::tr("An argument by name %1 has already " + parseInfo->staticContext->error(QtXmlPatterns::tr("An argument with name %1 has already " "been declared. Every argument name " "must be unique.") .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(3) - (3)].functionArgument)->name())), @@ -6679,7 +6679,7 @@ yyreduce: (yyval.expr) = create(func, (yyloc), parseInfo); else { - parseInfo->staticContext->error(QtXmlPatterns::tr("No function by name %1 is available.") + parseInfo->staticContext->error(QtXmlPatterns::tr("No function with name %1 is available.") .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(1) - (4)].qName))), ReportContext::XPST0017, fromYYLTYPE((yyloc), parseInfo)); } @@ -6929,7 +6929,7 @@ yyreduce: &ryy, true); if(declaredAttributes.contains(att)) { - parseInfo->staticContext->error(QtXmlPatterns::tr("An attribute by name %1 has already appeared on this element.") + parseInfo->staticContext->error(QtXmlPatterns::tr("An attribute with name %1 has already appeared on this element.") .arg(formatKeyword(parseInfo->staticContext->namePool(), att)), ReportContext::XQST0040, fromYYLTYPE((yyloc), parseInfo)); diff --git a/src/xmlpatterns/schema/qxsdschemahelper.cpp b/src/xmlpatterns/schema/qxsdschemahelper.cpp index e9f32c2..7813808 100644 --- a/src/xmlpatterns/schema/qxsdschemahelper.cpp +++ b/src/xmlpatterns/schema/qxsdschemahelper.cpp @@ -727,7 +727,7 @@ bool XsdSchemaHelper::isValidAttributeUsesRestriction(const XsdAttributeUse::Lis } } else { if (!wildcard) { - errorMsg = QtXmlPatterns::tr("Derived attribute %1 does not exists in the base definition.").arg(formatAttribute(derivedAttributeUse->attribute()->displayName(namePool))); + errorMsg = QtXmlPatterns::tr("Derived attribute %1 does not exist in the base definition.").arg(formatAttribute(derivedAttributeUse->attribute()->displayName(namePool))); return false; } diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp index 41c6b82..beb28bb 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp @@ -5959,7 +5959,7 @@ void XsdSchemaParser::validateIdAttribute(const char *elementName) attributeContentError("id", elementName, value, BuiltinTypes::xsID); } else { if (m_idCache->hasId(value)) { - error(QtXmlPatterns::tr("Component with id %1 has been defined previously.").arg(formatData(value))); + error(QtXmlPatterns::tr("Component with ID %1 has been defined previously.").arg(formatData(value))); } else { m_idCache->addId(value); } diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp index fda3548..622a39f 100644 --- a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp +++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp @@ -469,7 +469,7 @@ bool XsdValidatingInstanceReader::validateElement(const XsdElement::Ptr &declara // 3.2.3.2 if (declaration->valueConstraint() && declaration->valueConstraint()->variety() == XsdElement::ValueConstraint::Fixed) { - error(QtXmlPatterns::tr("Fixed value constrained not allowed if element is nillable.")); + error(QtXmlPatterns::tr("Fixed value constraint not allowed if element is nillable.")); return false; } } @@ -699,7 +699,7 @@ bool XsdValidatingInstanceReader::validateElementComplexType(const XsdElement::P if (complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed) { if (declaration->valueConstraint() && declaration->valueConstraint()->variety() == XsdElement::ValueConstraint::Fixed) { if (hasChildElement()) { - error(QtXmlPatterns::tr("Element %1 can not contain other elements, as it has a fixed content.").arg(formatKeyword(declaration->displayName(m_namePool)))); + error(QtXmlPatterns::tr("Element %1 cannot contain other elements, as it has a fixed content.").arg(formatKeyword(declaration->displayName(m_namePool)))); return false; } diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 0f7a7f1..1ec4c16 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -501,3 +501,5 @@ contains(QT_CONFIG, webkit): SUBDIRS += \ qwebhistoryinterface \ qwebelement \ qwebhistory + +contains(QT_CONFIG, declarative): SUBDIRS += declarative diff --git a/tests/auto/collections/tst_collections.cpp b/tests/auto/collections/tst_collections.cpp index 670cff0..f97805e 100644 --- a/tests/auto/collections/tst_collections.cpp +++ b/tests/auto/collections/tst_collections.cpp @@ -164,6 +164,7 @@ private slots: void qtimerList(); void containerTypedefs(); void forwardDeclared(); + void alignment(); }; struct LargeStatic { @@ -3481,5 +3482,113 @@ void tst_Collections::forwardDeclared() { typedef QSet<T1> C; C *x = 0; /* C::iterator i; */ C::const_iterator j; Q_UNUSED(x) } } +#if defined(Q_ALIGNOF) && defined(Q_DECL_ALIGN) + +class Q_DECL_ALIGN(4) Aligned4 +{ + char i; +public: + Aligned4(int i = 0) : i(i) {} + bool checkAligned() const + { + return (quintptr(this) & 3) == 0; + } + + inline bool operator==(const Aligned4 &other) const { return i == other.i; } + inline bool operator<(const Aligned4 &other) const { return i < other.i; } + friend inline int qHash(const Aligned4 &a) { return qHash(a.i); } +}; + +class Q_DECL_ALIGN(128) Aligned128 +{ + char i; +public: + Aligned128(int i = 0) : i(i) {} + bool checkAligned() const + { + return (quintptr(this) & 127) == 0; + } + + inline bool operator==(const Aligned128 &other) const { return i == other.i; } + inline bool operator<(const Aligned128 &other) const { return i < other.i; } + friend inline int qHash(const Aligned128 &a) { return qHash(a.i); } +}; + +template<typename C> +void testVectorAlignment() +{ + typedef typename C::value_type Aligned; + C container; + container.append(Aligned()); + QVERIFY(container[0].checkAligned()); + + for (int i = 0; i < 200; ++i) + container.append(Aligned()); + + for (int i = 0; i < container.size(); ++i) + QVERIFY(container.at(i).checkAligned()); +} + +template<typename C> +void testContiguousCacheAlignment() +{ + typedef typename C::value_type Aligned; + C container(150); + container.append(Aligned()); + QVERIFY(container[container.firstIndex()].checkAligned()); + + for (int i = 0; i < 200; ++i) + container.append(Aligned()); + + for (int i = container.firstIndex(); i < container.lastIndex(); ++i) + QVERIFY(container.at(i).checkAligned()); +} + +template<typename C> +void testAssociativeContainerAlignment() +{ + typedef typename C::key_type Key; + typedef typename C::mapped_type Value; + C container; + container.insert(Key(), Value()); + + typename C::const_iterator it = container.constBegin(); + QVERIFY(it.key().checkAligned()); + QVERIFY(it.value().checkAligned()); + + // add some more elements + for (int i = 0; i < 200; ++i) + container.insert(Key(i), Value(i)); + + it = container.constBegin(); + for ( ; it != container.constEnd(); ++it) { + QVERIFY(it.key().checkAligned()); + QVERIFY(it.value().checkAligned()); + } +} + +void tst_Collections::alignment() +{ + testVectorAlignment<QVector<Aligned4> >(); + testVectorAlignment<QVector<Aligned128> >(); + testContiguousCacheAlignment<QContiguousCache<Aligned4> >(); + testContiguousCacheAlignment<QContiguousCache<Aligned128> >(); + testAssociativeContainerAlignment<QMap<Aligned4, Aligned4> >(); + testAssociativeContainerAlignment<QMap<Aligned4, Aligned128> >(); + testAssociativeContainerAlignment<QMap<Aligned128, Aligned4> >(); + testAssociativeContainerAlignment<QMap<Aligned128, Aligned128> >(); + testAssociativeContainerAlignment<QHash<Aligned4, Aligned4> >(); + testAssociativeContainerAlignment<QHash<Aligned4, Aligned128> >(); + testAssociativeContainerAlignment<QHash<Aligned128, Aligned4> >(); + testAssociativeContainerAlignment<QHash<Aligned128, Aligned128> >(); +} + +#else +void tst_Collections::alignment() +{ + QSKIP("Compiler doesn't support necessary extension keywords", SkipAll) +} +#endif + QTEST_APPLESS_MAIN(tst_Collections) #include "tst_collections.moc" diff --git a/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp b/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp index 20ca759..b4d2ac8 100644 --- a/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp +++ b/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp @@ -61,6 +61,8 @@ private slots: void setError(); void isFormatSupported_data(); void isFormatSupported(); + void nearestFormat_data(); + void nearestFormat(); void start_data(); void start(); }; @@ -232,6 +234,22 @@ void tst_QAbstractVideoSurface::isFormatSupported() QCOMPARE(surface.isFormatSupported(format), supported); } +void tst_QAbstractVideoSurface::nearestFormat_data() +{ + isFormatSupported_data(); +} + +void tst_QAbstractVideoSurface::nearestFormat() +{ + QFETCH(SupportedFormatMap, supportedFormats); + QFETCH(QVideoSurfaceFormat, format); + QFETCH(bool, supported); + + QtTestVideoSurface surface(supportedFormats); + + QCOMPARE(surface.nearestFormat(format) == format, supported); +} + void tst_QAbstractVideoSurface::start_data() { QTest::addColumn<QVideoSurfaceFormat>("format"); @@ -256,35 +274,35 @@ void tst_QAbstractVideoSurface::start() surface.setError(QAbstractVideoSurface::ResourceError); QSignalSpy formatSpy(&surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat))); - QSignalSpy startedSpy(&surface, SIGNAL(startedChanged(bool))); + QSignalSpy activeSpy(&surface, SIGNAL(activeChanged(bool))); - QVERIFY(!surface.isStarted()); + QVERIFY(!surface.isActive()); QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat()); QVERIFY(surface.start(format)); - QVERIFY(surface.isStarted()); + QVERIFY(surface.isActive()); QCOMPARE(surface.surfaceFormat(), format); QCOMPARE(formatSpy.count(), 1); - QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.at(0).at(0)), format); + QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.last().at(0)), format); - QCOMPARE(startedSpy.count(), 1); - QCOMPARE(startedSpy.at(0).at(0).toBool(), true); + QCOMPARE(activeSpy.count(), 1); + QCOMPARE(activeSpy.last().at(0).toBool(), true); // error() is reset on a successful start. QCOMPARE(surface.error(), QAbstractVideoSurface::NoError); surface.stop(); - QVERIFY(!surface.isStarted()); + QVERIFY(!surface.isActive()); QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat()); QCOMPARE(formatSpy.count(), 2); - QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.at(1).at(0)), QVideoSurfaceFormat()); + QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.last().at(0)), QVideoSurfaceFormat()); - QCOMPARE(startedSpy.count(), 2); - QCOMPARE(startedSpy.at(1).at(0).toBool(), false); + QCOMPARE(activeSpy.count(), 2); + QCOMPARE(activeSpy.last().at(0).toBool(), false); } QTEST_MAIN(tst_QAbstractVideoSurface) diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp index add0945..56fc53a 100644 --- a/tests/auto/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/qdatastream/tst_qdatastream.cpp @@ -3100,22 +3100,6 @@ void tst_QDataStream::streamToAndFromQByteArray() void tst_QDataStream::streamRealDataTypes() { -#if defined(Q_OS_WINCE) - // Note: Probably actually same 'qreal being typedeffed as float instead of double' issue as in Symbian - // instead of what CE skip message says. - QSKIP("Skipped on CE as it demands too much memory and fragments", SkipAll); -#elif defined(Q_OS_SYMBIAN) - // qreal is typedeffed float in symbian instead of double like in most platforms, so reference stream - // gets corrupted. Basically this test is flawed, as one shouldn't use naked typedeffed types in - // streams that are meant to work cross-platform. - // As this test also tests other floating point using classes, we do not simply skip it, but work around - // the qreal issue by redefining qreal as double for the duration of this function. - // Note that streaming classes works because they do explicitly use double instead of qreal when - // writing/reading to/from stream. -# define qreal double - qWarning("Note: streamRealDataTypes test redefines qreal as double in symbian!!!"); -#endif - // Generate QPicture from SVG. QSvgRenderer renderer(svgFile); QVERIFY(renderer.isValid()); @@ -3163,7 +3147,6 @@ void tst_QDataStream::streamRealDataTypes() file.close(); } - qreal a, b, c, d, e, f; QPointF point; QRectF rect; QPolygonF polygon; @@ -3180,28 +3163,50 @@ void tst_QDataStream::streamRealDataTypes() QDataStream stream(&file); stream.setVersion(QDataStream::Qt_4_2); - stream >> a >> b >> c >> d >> e >> f >> point - >> rect >> polygon >> matrix >> p; - if (i == 1) - stream >> pict; - stream >> textLength >> col >> rGrad >> cGrad - >> pen; - - QCOMPARE(stream.status(), QDataStream::Ok); - - QCOMPARE(a, qreal(0)); - QCOMPARE(b, qreal(1.0)); - QCOMPARE(c, qreal(1.1)); - QCOMPARE(d, qreal(3.14)); - QCOMPARE(e, qreal(-3.14)); - QCOMPARE(f, qreal(-1)); + if (i == 0) { + // the reference stream for 4.2 contains doubles, + // so we must read them out as doubles! + double a, b, c, d, e, f; + stream >> a; + QCOMPARE(a, 0.0); + stream >> b; + QCOMPARE(b, 1.0); + stream >> c; + QCOMPARE(c, 1.1); + stream >> d; + QCOMPARE(d, 3.14); + stream >> e; + QCOMPARE(e, -3.14); + stream >> f; + QCOMPARE(f, -1.0); + } else { + qreal a, b, c, d, e, f; + stream >> a; + QCOMPARE(a, qreal(0)); + stream >> b; + QCOMPARE(b, qreal(1.0)); + stream >> c; + QCOMPARE(c, qreal(1.1)); + stream >> d; + QCOMPARE(d, qreal(3.14)); + stream >> e; + QCOMPARE(e, qreal(-3.14)); + stream >> f; + QCOMPARE(f, qreal(-1)); + } + stream >> point; QCOMPARE(point, QPointF(3, 5)); + stream >> rect; QCOMPARE(rect, QRectF(-1, -2, 3, 4)); + stream >> polygon; QCOMPARE((QVector<QPointF> &)polygon, (QPolygonF() << QPointF(0, 0) << QPointF(1, 2))); + stream >> matrix; QCOMPARE(matrix, QMatrix().rotate(90).scale(2, 2)); + stream >> p; QCOMPARE(p, path); + if (i == 1) { + stream >> pict; - if (i == 0) { QByteArray pictA, pictB; QBuffer bufA, bufB; QVERIFY(bufA.open(QIODevice::ReadWrite)); @@ -3212,8 +3217,11 @@ void tst_QDataStream::streamRealDataTypes() QCOMPARE(pictA, pictB); } + stream >> textLength; QCOMPARE(textLength, QTextLength(QTextLength::VariableLength, 1.5)); + stream >> col; QCOMPARE(col, color); + stream >> rGrad; QCOMPARE(rGrad.style(), radialBrush.style()); QCOMPARE(rGrad.matrix(), radialBrush.matrix()); QCOMPARE(rGrad.gradient()->type(), radialBrush.gradient()->type()); @@ -3222,6 +3230,7 @@ void tst_QDataStream::streamRealDataTypes() QCOMPARE(((QRadialGradient *)rGrad.gradient())->center(), ((QRadialGradient *)radialBrush.gradient())->center()); QCOMPARE(((QRadialGradient *)rGrad.gradient())->focalPoint(), ((QRadialGradient *)radialBrush.gradient())->focalPoint()); QCOMPARE(((QRadialGradient *)rGrad.gradient())->radius(), ((QRadialGradient *)radialBrush.gradient())->radius()); + stream >> cGrad; QCOMPARE(cGrad.style(), conicalBrush.style()); QCOMPARE(cGrad.matrix(), conicalBrush.matrix()); QCOMPARE(cGrad.gradient()->type(), conicalBrush.gradient()->type()); @@ -3231,11 +3240,11 @@ void tst_QDataStream::streamRealDataTypes() QCOMPARE(((QConicalGradient *)cGrad.gradient())->angle(), ((QConicalGradient *)conicalBrush.gradient())->angle()); QCOMPARE(cGrad, conicalBrush); + stream >> pen; QCOMPARE(pen.widthF(), qreal(1.5)); + + QCOMPARE(stream.status(), QDataStream::Ok); } -#if defined(Q_OS_SYMBIAN) - #undef qreal -#endif } #ifdef QT3_SUPPORT diff --git a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index baf769f..91050f5 100644 --- a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -103,6 +103,8 @@ private slots: void getComplexSignal_data(); void getComplexSignal(); + void followSignal(); + void createErrors_data(); void createErrors(); @@ -130,6 +132,9 @@ tst_QDBusAbstractInterface::tst_QDBusAbstractInterface() void tst_QDBusAbstractInterface::initTestCase() { + // enable debugging temporarily: + putenv("QDBUS_DEBUG=1"); + // register the object QDBusConnection con = QDBusConnection::sessionBus(); QVERIFY(con.isConnected()); @@ -432,6 +437,60 @@ void tst_QDBusAbstractInterface::getComplexSignal() QCOMPARE(s[0][0].value<RegisteredType>(), expectedValue); } +void tst_QDBusAbstractInterface::followSignal() +{ + const QString serviceToFollow = "com.trolltech.tst_qdbusabstractinterface.FollowMe"; + Pinger p = getPinger(serviceToFollow); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusConnection con = p->connection(); + QVERIFY(!con.interface()->isServiceRegistered(serviceToFollow)); + Pinger control = getPinger(""); + + // we need to connect the signal somewhere in order for D-Bus to enable the rules + QTestEventLoop::instance().connect(p.data(), SIGNAL(voidSignal()), SLOT(exitLoop())); + QTestEventLoop::instance().connect(control.data(), SIGNAL(voidSignal()), SLOT(exitLoop())); + QSignalSpy s(p.data(), SIGNAL(voidSignal())); + + emit targetObj.voidSignal(); + QTestEventLoop::instance().enterLoop(200); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // signal must not have been received because the service isn't registered + QVERIFY(s.isEmpty()); + + // now register the service + QDBusReply<QDBusConnectionInterface::RegisterServiceReply> r = + con.interface()->registerService(serviceToFollow, QDBusConnectionInterface::DontQueueService, + QDBusConnectionInterface::DontAllowReplacement); + QVERIFY(r.isValid() && r.value() == QDBusConnectionInterface::ServiceRegistered); + QVERIFY(con.interface()->isServiceRegistered(serviceToFollow)); + + // emit the signal again: + emit targetObj.voidSignal(); + QTestEventLoop::instance().enterLoop(2); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // now the signal must have been received: + QCOMPARE(s.size(), 1); + QVERIFY(s.at(0).size() == 0); + s.clear(); + + // disconnect the signal + disconnect(p.data(), SIGNAL(voidSignal()), &QTestEventLoop::instance(), 0); + + // emit the signal again: + emit targetObj.voidSignal(); + QTestEventLoop::instance().enterLoop(2); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // and now it mustn't have been received + QVERIFY(s.isEmpty()); + + // cleanup: + con.interface()->unregisterService(serviceToFollow); +} + void tst_QDBusAbstractInterface::createErrors_data() { QTest::addColumn<QString>("service"); diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp index e31a3a0..62d6342 100644 --- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp @@ -171,6 +171,13 @@ class tst_QDBusInterface: public QObject { Q_OBJECT MyObject obj; +public slots: + void testServiceOwnerChanged(const QString &service) + { + if (service == "com.example.Test") + QTestEventLoop::instance().exitLoop(); + } + private slots: void initTestCase(); @@ -235,32 +242,13 @@ void tst_QDBusInterface::invalidAfterServiceOwnerChanged() QDBusInterface invalidInterface("com.example.Test", "/"); QVERIFY(!invalidInterface.isValid()); + QTestEventLoop::instance().connect(connIface, SIGNAL(serviceOwnerChanged(QString, QString, QString)), + SLOT(exitLoop())); QVERIFY(connIface->registerService("com.example.Test") == QDBusConnectionInterface::ServiceRegistered); - QSignalSpy serviceOwnerChangedSpy(connIface, SIGNAL(serviceOwnerChanged(QString, QString, QString))); - - QEventLoop loop; - QObject::connect(connIface, SIGNAL(serviceOwnerChanged(QString, QString, QString)), - &loop, SLOT(quit())); - loop.exec(); - - // at least once, but other services might have changed while running the test, too. - QVERIFY(serviceOwnerChangedSpy.count() >= 1); - bool foundOurService = false; - for (int i = 0; i < serviceOwnerChangedSpy.count(); ++i) { - QList<QVariant> args = serviceOwnerChangedSpy.at(i); - QString name = args[0].toString(); - QString oldOwner = args[1].toString(); - QString newOwner = args[2].toString(); - if (name == QLatin1String("com.example.Test")) { - if (newOwner == conn.baseService()) { - foundOurService = true; - break; - } - } - } - QVERIFY(foundOurService); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(!invalidInterface.isValid()); } diff --git a/tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro b/tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro new file mode 100644 index 0000000..4970f16 --- /dev/null +++ b/tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +QT = core +contains(QT_CONFIG,dbus): { + SOURCES += tst_qdbusservicewatcher.cpp + QT += dbus +} else { + SOURCES += ../qdbusmarshall/dummy.cpp +} diff --git a/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp b/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp new file mode 100644 index 0000000..10b43b1 --- /dev/null +++ b/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp @@ -0,0 +1,273 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtDBus/QDBusServiceWatcher> +#include <QtDBus> +#include <QtTest> + +class tst_QDBusServiceWatcher: public QObject +{ + Q_OBJECT + QString serviceName; +public: + tst_QDBusServiceWatcher(); + +private slots: + void initTestCase(); + void cleanup(); + + void watchForCreation(); + void watchForDisappearance(); + void watchForOwnerChange(); + void modeChange(); +}; + +tst_QDBusServiceWatcher::tst_QDBusServiceWatcher() + : serviceName("com.example.TestName") +{ +} + +void tst_QDBusServiceWatcher::initTestCase() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); +} + +void tst_QDBusServiceWatcher::cleanup() +{ + // ensure that the name isn't registered + QDBusConnection::sessionBus().unregisterService(serviceName); +} + +void tst_QDBusServiceWatcher::watchForCreation() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForRegistration); + + QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString))); + QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString))); + QSignalSpy spyO(&watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString))); + QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceRegistered(QString)), SLOT(exitLoop())); + + // register a name + QVERIFY(con.registerService(serviceName)); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyU.count(), 0); + + QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QVERIFY(spyO.at(0).at(1).toString().isEmpty()); + QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); + + spyR.clear(); + spyU.clear(); + spyO.clear(); + + // unregister it: + con.unregisterService(serviceName); + + // and register again + QVERIFY(con.registerService(serviceName)); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyU.count(), 0); + + QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QVERIFY(spyO.at(0).at(1).toString().isEmpty()); + QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); +} + +void tst_QDBusServiceWatcher::watchForDisappearance() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForUnregistration); + + QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString))); + QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString))); + QSignalSpy spyO(&watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString))); + QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceUnregistered(QString)), SLOT(exitLoop())); + + // register a name + QVERIFY(con.registerService(serviceName)); + + // unregister it: + con.unregisterService(serviceName); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 0); + + QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); + QVERIFY(spyO.at(0).at(2).toString().isEmpty()); +} + +void tst_QDBusServiceWatcher::watchForOwnerChange() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForOwnerChange); + + QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString))); + QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString))); + QSignalSpy spyO(&watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString))); + QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceRegistered(QString)), SLOT(exitLoop())); + + // register a name + QVERIFY(con.registerService(serviceName)); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyU.count(), 0); + + QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QVERIFY(spyO.at(0).at(1).toString().isEmpty()); + QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); + + spyR.clear(); + spyU.clear(); + spyO.clear(); + + // unregister it: + con.unregisterService(serviceName); + + // and register again + QVERIFY(con.registerService(serviceName)); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyO.count(), 2); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); + QVERIFY(spyO.at(0).at(2).toString().isEmpty()); + QCOMPARE(spyO.at(1).at(0).toString(), serviceName); + QVERIFY(spyO.at(1).at(1).toString().isEmpty()); + QCOMPARE(spyO.at(1).at(2).toString(), con.baseService()); +} + +void tst_QDBusServiceWatcher::modeChange() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForRegistration); + + QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString))); + QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString))); + QSignalSpy spyO(&watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString))); + QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceRegistered(QString)), SLOT(exitLoop())); + + // register a name + QVERIFY(con.registerService(serviceName)); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyU.count(), 0); + + QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QVERIFY(spyO.at(0).at(1).toString().isEmpty()); + QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); + + spyR.clear(); + spyU.clear(); + spyO.clear(); + + watcher.setWatchMode(QDBusServiceWatcher::WatchForUnregistration); + + // unregister it: + con.unregisterService(serviceName); + + QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceUnregistered(QString)), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(spyR.count(), 0); + + QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.at(0).at(0).toString(), serviceName); + + QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); + QVERIFY(spyO.at(0).at(2).toString().isEmpty()); +} + +QTEST_MAIN(tst_QDBusServiceWatcher) +#include "tst_qdbusservicewatcher.moc" diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp index 0d58554e..6637202 100644 --- a/tests/auto/qdom/tst_qdom.cpp +++ b/tests/auto/qdom/tst_qdom.cpp @@ -322,7 +322,6 @@ void tst_QDom::toString_01_data() */ void tst_QDom::toString_01() { - QFAIL("make test fail instead of timing out, will be fixed later (QT-2357)"); QFETCH(QString, fileName); QFile f(fileName); diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index e036e4b..e9f0476 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -118,6 +118,16 @@ public: void setAutoBufferSwap(bool on) { QGLWidget::setAutoBufferSwap(on); } }; +static int appDefaultDepth() +{ + static int depth = 0; + if (depth == 0) { + QPixmap pm(1, 1); + depth = pm.depth(); + } + return depth; +} + // Using INT_MIN and INT_MAX will cause failures on systems // where "int" is 64-bit, so use the explicit values instead. #define TEST_INT_MIN (-2147483647 - 1) @@ -714,6 +724,8 @@ public: void tst_QGL::graphicsViewClipping() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); const int size = 64; UnclippedWidget *widget = new UnclippedWidget; widget->setFixedSize(size, size); @@ -866,6 +878,8 @@ public: void tst_QGL::glWidgetRendering() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); GLWidget w; w.show(); @@ -1089,6 +1103,8 @@ protected: void tst_QGL::glFBOUseInGLWidget() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); if (!QGLFramebufferObject::hasOpenGLFramebufferObjects()) QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle); @@ -1116,6 +1132,8 @@ void tst_QGL::glFBOUseInGLWidget() void tst_QGL::glWidgetReparent() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); // Try it as a top-level first: GLWidget *widget = new GLWidget; widget->setGeometry(0, 0, 200, 30); @@ -1582,6 +1600,8 @@ protected: void tst_QGL::replaceClipping() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); ReplaceClippingGLWidget glw; glw.resize(300, 300); glw.show(); @@ -1707,6 +1727,8 @@ protected: void tst_QGL::clipTest() { + if (appDefaultDepth() < 24) + QSKIP("This test won't work for bit depths < 24", SkipAll); ClipTestGLWidget glw; glw.resize(220, 220); glw.show(); diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index fbeb425..55294d5 100644 --- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -357,7 +357,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data() QTest::newRow("log,transparent") << int(Qt::LogicalCoordinates) << int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode) - << QSize(12, 12) << QPoint(-1, -1) + << QSize(14, 14) << QPoint(-2, -2) << 0x00000000u; QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates) @@ -372,7 +372,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data() QTest::newRow("dev,transparent") << int(Qt::DeviceCoordinates) << int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode) - << QSize(22, 22) << QPoint(39, 39) + << QSize(24, 24) << QPoint(38, 38) << 0x00000000u; QTest::newRow("dev,effectrect") << int(Qt::DeviceCoordinates) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 1081fd5..d65c6ec 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -7679,20 +7679,6 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() QCOMPARE(items.size(), 1); QCOMPARE(items.at(0), static_cast<QGraphicsItem *>(item3)); - item1->repaints = 0; - item2->repaints = 0; - item3->repaints = 0; - - view.viewport()->update(75, 75, 20, 20); - QTest::qWait(50); - - // item1 is the effect source and must therefore be repainted. - // item2 intersects with the exposed region - // item3 is just another child outside the exposed region - QCOMPARE(item1->repaints, 1); - QCOMPARE(item2->repaints, 1); - QCOMPARE(item3->repaints, 0); - scene.setItemIndexMethod(QGraphicsScene::NoIndex); QTest::qWait(100); diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index d8ab06e..9b15ab1 100644 --- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp @@ -259,7 +259,7 @@ void tst_QGraphicsTransform::rotation3d() // Check that "rotation" produces the 4x4 form of the 3x3 matrix. // i.e. third row and column are 0 0 1 0. - t.setIdentity(); + t.setToIdentity(); rotation.applyTo(&t); QMatrix4x4 r(expected); if (sizeof(qreal) == sizeof(float) && angle == 268) { @@ -274,7 +274,7 @@ void tst_QGraphicsTransform::rotation3d() rotation.setAxis(QVector3D(0, 0, 0)); rotation.setOrigin(QVector3D(10, 10, 0)); - t.setIdentity(); + t.setToIdentity(); rotation.applyTo(&t); QVERIFY(t.isIdentity()); @@ -337,7 +337,7 @@ void tst_QGraphicsTransform::rotation3dArbitraryAxis() // Check that "rotation" produces the 4x4 form of the 3x3 matrix. // i.e. third row and column are 0 0 1 0. - t.setIdentity(); + t.setToIdentity(); rotation.applyTo(&t); QMatrix4x4 r(expected); QVERIFY(qFuzzyCompare(t, r)); diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index be39d00..ab7b0ac 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -976,7 +976,7 @@ void tst_QLocalSocket::writeOnlySocket() #if defined(Q_OS_SYMBIAN) QTest::qWait(250); #endif - QVERIFY(server.waitForNewConnection()); + QVERIFY(server.waitForNewConnection(200)); QLocalSocket* serverSocket = server.nextPendingConnection(); QVERIFY(serverSocket); diff --git a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp index ff5e00f..d6d217f2 100644 --- a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp @@ -151,14 +151,8 @@ private slots: void convertGeneric(); - void extractAxisRotation_data(); - void extractAxisRotation(); - - void extractTranslation_data(); - void extractTranslation(); - - void inferSpecialType_data(); - void inferSpecialType(); + void optimize_data(); + void optimize(); void columnsAndRows(); @@ -515,13 +509,13 @@ void tst_QMatrixNxN::create2x2() m5 = m3; QVERIFY(isSame(m5, uniqueValues2)); - m5.setIdentity(); + m5.setToIdentity(); QVERIFY(isIdentity(m5)); QMatrix2x2 m6(uniqueValues2); QVERIFY(isSame(m6, uniqueValues2)); qreal vals[4]; - m6.toValueArray(vals); + m6.copyDataTo(vals); for (int index = 0; index < 4; ++index) QCOMPARE(vals[index], uniqueValues2[index]); } @@ -550,13 +544,13 @@ void tst_QMatrixNxN::create3x3() m5 = m3; QVERIFY(isSame(m5, uniqueValues3)); - m5.setIdentity(); + m5.setToIdentity(); QVERIFY(isIdentity(m5)); QMatrix3x3 m6(uniqueValues3); QVERIFY(isSame(m6, uniqueValues3)); qreal vals[9]; - m6.toValueArray(vals); + m6.copyDataTo(vals); for (int index = 0; index < 9; ++index) QCOMPARE(vals[index], uniqueValues3[index]); } @@ -585,13 +579,13 @@ void tst_QMatrixNxN::create4x4() m5 = m3; QVERIFY(isSame(m5, uniqueValues4)); - m5.setIdentity(); + m5.setToIdentity(); QVERIFY(isIdentity(m5)); QMatrix4x4 m6(uniqueValues4); QVERIFY(isSame(m6, uniqueValues4)); qreal vals[16]; - m6.toValueArray(vals); + m6.copyDataTo(vals); for (int index = 0; index < 16; ++index) QCOMPARE(vals[index], uniqueValues4[index]); @@ -627,13 +621,13 @@ void tst_QMatrixNxN::create4x3() m5 = m3; QVERIFY(isSame(m5, uniqueValues4x3)); - m5.setIdentity(); + m5.setToIdentity(); QVERIFY(isIdentity(m5)); QMatrix4x3 m6(uniqueValues4x3); QVERIFY(isSame(m6, uniqueValues4x3)); qreal vals[12]; - m6.toValueArray(vals); + m6.copyDataTo(vals); for (int index = 0; index < 12; ++index) QCOMPARE(vals[index], uniqueValues4x3[index]); } @@ -802,7 +796,7 @@ void tst_QMatrixNxN::transposed4x3() QMatrix4x3 m3(uniqueValues4x3); QMatrix3x4 m4 = m3.transposed(); qreal values[12]; - m4.toValueArray(values); + m4.copyDataTo(values); for (int index = 0; index < 12; ++index) QCOMPARE(values[index], transposedValues3x4[index]); } @@ -1296,7 +1290,7 @@ void tst_QMatrixNxN::multiply4x3() QGenericMatrix<3, 3, qreal> m4; m4 = m1 * m2; qreal values[9]; - m4.toValueArray(values); + m4.copyDataTo(values); for (int index = 0; index < 9; ++index) QCOMPARE(values[index], ((const qreal *)m3Values)[index]); } @@ -1898,7 +1892,7 @@ void tst_QMatrixNxN::inverted4x4() } // Test again, after inferring the special matrix type. - m1.inferSpecialType(); + m1.optimize(); m2 = m1.inverted(&inv); QVERIFY(isSame(m2, (const qreal *)m2Values)); QCOMPARE(inv, invertible); @@ -1913,12 +1907,12 @@ void tst_QMatrixNxN::orthonormalInverse4x4() m2.rotate(45.0, 1.0, 0.0, 0.0); m2.translate(10.0, 0.0, 0.0); - // Use inferSpecialType() to drop the internal flags that + // Use optimize() to drop the internal flags that // mark the matrix as orthonormal. This will force inverted() // to compute m3.inverted() the long way. We can then compare // the result to what the faster algorithm produces on m2. QMatrix4x4 m3 = m2; - m3.inferSpecialType(); + m3.optimize(); bool invertible; QVERIFY(qFuzzyCompare(m2.inverted(&invertible), m3.inverted())); QVERIFY(invertible); @@ -1926,7 +1920,7 @@ void tst_QMatrixNxN::orthonormalInverse4x4() QMatrix4x4 m4; m4.rotate(45.0, 0.0, 1.0, 0.0); QMatrix4x4 m5 = m4; - m5.inferSpecialType(); + m5.optimize(); QVERIFY(qFuzzyCompare(m4.inverted(), m5.inverted())); QMatrix4x4 m6; @@ -1934,7 +1928,7 @@ void tst_QMatrixNxN::orthonormalInverse4x4() m1.translate(-20.0, 20.0, 15.0); m1.rotate(25, 1.0, 0.0, 0.0); QMatrix4x4 m7 = m6; - m7.inferSpecialType(); + m7.optimize(); QVERIFY(qFuzzyCompare(m6.inverted(), m7.inverted())); } @@ -2081,7 +2075,7 @@ void tst_QMatrixNxN::scale4x4() m8.scale(x); QVERIFY(isSame(m8, (const qreal *)resultValues)); - m8.inferSpecialType(); + m8.optimize(); m8.scale(1.0f); QVERIFY(isSame(m8, (const qreal *)resultValues)); @@ -2412,7 +2406,7 @@ void tst_QMatrixNxN::rotate4x4() if (x != 0 || y != 0 || z != 0) { QQuaternion q = QQuaternion::fromAxisAndAngle(QVector3D(x, y, z), angle); - QVector3D vq = q.rotateVector(v1); + QVector3D vq = q.rotatedVector(v1); QVERIFY(fuzzyCompare(vq.x(), v1x)); QVERIFY(fuzzyCompare(vq.y(), v1y)); QVERIFY(fuzzyCompare(vq.z(), v1z)); @@ -2509,7 +2503,7 @@ void tst_QMatrixNxN::normalMatrix() // Perform the test again, after inferring special matrix types. // This tests the optimized paths in the normalMatrix() function. - m1.inferSpecialType(); + m1.optimize(); n1 = m1.normalMatrix(); if (invertible) @@ -2850,120 +2844,6 @@ void tst_QMatrixNxN::convertGeneric() QVERIFY(isSame(m11, conv4x4)); } -void tst_QMatrixNxN::extractAxisRotation_data() -{ - QTest::addColumn<float>("x"); - QTest::addColumn<float>("y"); - QTest::addColumn<float>("z"); - QTest::addColumn<float>("angle"); - - QTest::newRow("1, 0, 0, 0 deg") << 1.0f << 0.0f << 0.0f << 0.0f; - QTest::newRow("1, 0, 0, 90 deg") << 1.0f << 0.0f << 0.0f << 90.0f; - QTest::newRow("1, 0, 0, 270 deg") << 1.0f << 0.0f << 0.0f << 270.0f; - QTest::newRow("1, 0, 0, 45 deg") << 1.0f << 0.0f << 0.0f << 45.0f; - QTest::newRow("1, 0, 0, 120 deg") << 1.0f << 0.0f << 0.0f << 120.0f; - QTest::newRow("1, 0, 0, 300 deg") << 1.0f << 0.0f << 0.0f << 300.0f; - - QTest::newRow("0, 1, 0, 90 deg") << 0.0f << 1.0f << 0.0f << 90.0f; - QTest::newRow("0, 1, 0, 270 deg") << 0.0f << 1.0f << 0.0f << 270.0f; - QTest::newRow("0, 1, 0, 45 deg") << 0.0f << 1.0f << 0.0f << 45.0f; - QTest::newRow("0, 1, 0, 120 deg") << 0.0f << 1.0f << 0.0f << 120.0f; - QTest::newRow("0, 1, 0, 300 deg") << 0.0f << 1.0f << 0.0f << 300.0f; - - QTest::newRow("0, 0, 1, 90 deg") << 0.0f << 0.0f << 1.0f << 90.0f; - QTest::newRow("0, 0, 1, 270 deg") << 0.0f << 0.0f << 1.0f << 270.0f; - QTest::newRow("0, 0, 1, 45 deg") << 0.0f << 0.0f << 1.0f << 45.0f; - QTest::newRow("0, 0, 1, 120 deg") << 0.0f << 0.0f << 1.0f << 120.0f; - QTest::newRow("0, 0, 1, 300 deg") << 0.0f << 0.0f << 1.0f << 300.0f; - - QTest::newRow("1, 1, 1, 90 deg") << 1.0f << 1.0f << 1.0f << 90.0f; - QTest::newRow("1, 1, 1, 270 deg") << 1.0f << 1.0f << 1.0f << 270.0f; - QTest::newRow("1, 1, 1, 45 deg") << 1.0f << 1.0f << 1.0f << 45.0f; - QTest::newRow("1, 1, 1, 120 deg") << 1.0f << 1.0f << 1.0f << 120.0f; - QTest::newRow("1, 1, 1, 300 deg") << 1.0f << 1.0f << 1.0f << 300.0f; -} - -void tst_QMatrixNxN::extractAxisRotation() -{ - QFETCH(float, x); - QFETCH(float, y); - QFETCH(float, z); - QFETCH(float, angle); - - QMatrix4x4 m; - QVector3D origAxis(x, y, z); - - m.rotate(angle, x, y, z); - - origAxis.normalize(); - QVector3D extractedAxis; - qreal extractedAngle; - - m.extractAxisRotation(extractedAngle, extractedAxis); - - if (angle > 180) { - QVERIFY(fuzzyCompare(360.0f - angle, extractedAngle)); - QVERIFY(fuzzyCompare(extractedAxis, -origAxis)); - } else { - QVERIFY(fuzzyCompare(angle, extractedAngle)); - QVERIFY(fuzzyCompare(extractedAxis, origAxis)); - } -} - -void tst_QMatrixNxN::extractTranslation_data() -{ - QTest::addColumn<QMatrix4x4>("rotation"); - QTest::addColumn<float>("x"); - QTest::addColumn<float>("y"); - QTest::addColumn<float>("z"); - - static QMatrix4x4 m1; - - QTest::newRow("identity, 100, 50, 25") - << m1 << 100.0f << 50.0f << 250.0f; - - m1.rotate(45.0, 1.0, 0.0, 0.0); - QTest::newRow("rotX 45 + 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f; - - m1.setIdentity(); - m1.rotate(45.0, 0.0, 1.0, 0.0); - QTest::newRow("rotY 45 + 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f; - - m1.setIdentity(); - m1.rotate(75, 0.0, 0.0, 1.0); - m1.rotate(25, 1.0, 0.0, 0.0); - m1.rotate(45, 0.0, 1.0, 0.0); - QTest::newRow("rotZ 75, rotX 25, rotY 45, 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f; -} - -void tst_QMatrixNxN::extractTranslation() -{ - QFETCH(QMatrix4x4, rotation); - QFETCH(float, x); - QFETCH(float, y); - QFETCH(float, z); - - rotation.translate(x, y, z); - - QVector3D vec = rotation.extractTranslation(); - - QVERIFY(fuzzyCompare(vec.x(), x)); - QVERIFY(fuzzyCompare(vec.y(), y)); - QVERIFY(fuzzyCompare(vec.z(), z)); - - QMatrix4x4 lookAt; - QVector3D eye(1.5f, -2.5f, 2.5f); - lookAt.lookAt(eye, - QVector3D(10.0f, 10.0f, 10.0f), - QVector3D(0.0f, 1.0f, 0.0f)); - - QVector3D extEye = lookAt.extractTranslation(); - - QVERIFY(fuzzyCompare(eye.x(), -extEye.x())); - QVERIFY(fuzzyCompare(eye.y(), -extEye.y())); - QVERIFY(fuzzyCompare(eye.z(), -extEye.z())); -} - // Copy of "flagBits" in qmatrix4x4.h. enum { Identity = 0x0001, // Identity matrix @@ -2981,7 +2861,7 @@ struct Matrix4x4 }; // Test the inferring of special matrix types. -void tst_QMatrixNxN::inferSpecialType_data() +void tst_QMatrixNxN::optimize_data() { QTest::addColumn<void *>("mValues"); QTest::addColumn<int>("flagBits"); @@ -3029,13 +2909,13 @@ void tst_QMatrixNxN::inferSpecialType_data() QTest::newRow("below") << (void *)belowValues << (int)General; } -void tst_QMatrixNxN::inferSpecialType() +void tst_QMatrixNxN::optimize() { QFETCH(void *, mValues); QFETCH(int, flagBits); QMatrix4x4 m((const qreal *)mValues); - m.inferSpecialType(); + m.optimize(); QCOMPARE(reinterpret_cast<Matrix4x4 *>(&m)->flagBits, flagBits); } @@ -3362,7 +3242,7 @@ void tst_QMatrixNxN::mapVector() QFETCH(void *, mValues); QMatrix4x4 m1((const qreal *)mValues); - m1.inferSpecialType(); + m1.optimize(); QVector3D v(3.5f, -1.0f, 2.5f); diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 2bd1684..db46b66 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -1755,9 +1755,7 @@ void tst_QSslSocket::readFromClosedSocket() socket->close(); QVERIFY(!socket->bytesAvailable()); QVERIFY(!socket->bytesToWrite()); - socket->waitForDisconnected(); - QVERIFY(!socket->bytesAvailable()); - QVERIFY(!socket->bytesToWrite()); + QVERIFY(socket->state() == QAbstractSocket::UnconnectedState); } void tst_QSslSocket::writeBigChunk() diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 975b301..9a2b2ed 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -162,7 +162,7 @@ private slots: void defaultGlobalRestorePolicy(); void globalRestorePolicySetToRestore(); - void globalRestorePolicySetToDoNotRestore(); + void globalRestorePolicySetToDontRestore(); void noInitialStateForInitialState(); @@ -184,7 +184,7 @@ private slots: void twoAnimatedTransitions(); void playAnimationTwice(); void nestedTargetStateForAnimation(); - void polishedSignalTransitionsReuseAnimationGroup(); + void propertiesAssignedSignalTransitionsReuseAnimationGroup(); void animatedGlobalRestoreProperty(); void specificTargetValueOfAnimation(); @@ -286,8 +286,8 @@ void tst_QStateMachine::transitionToRootState() machine.addState(initialState); machine.setInitialState(initialState); - QAbstractTransition *trans = initialState->addTransition(new EventTransition(QEvent::User, &machine)); - QVERIFY(trans != 0); + QAbstractTransition *trans = new EventTransition(QEvent::User, &machine); + initialState->addTransition(trans); QCOMPARE(trans->sourceState(), initialState); QCOMPARE(trans->targetState(), static_cast<QAbstractState *>(&machine)); @@ -310,7 +310,7 @@ void tst_QStateMachine::transitionFromRootState() QState *root = &machine; QState *s1 = new QState(root); EventTransition *trans = new EventTransition(QEvent::User, s1); - QCOMPARE(root->addTransition(trans), static_cast<QAbstractTransition *>(trans)); + root->addTransition(trans); QCOMPARE(trans->sourceState(), root); QCOMPARE(trans->targetState(), static_cast<QAbstractState *>(s1)); } @@ -984,7 +984,7 @@ void tst_QStateMachine::customErrorStateNotInGraph() void tst_QStateMachine::restoreProperties() { QStateMachine machine; - QCOMPARE(machine.globalRestorePolicy(), QStateMachine::DoNotRestoreProperties); + QCOMPARE(machine.globalRestorePolicy(), QStateMachine::DontRestoreProperties); machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); QObject *object = new QObject(&machine); @@ -1155,7 +1155,7 @@ void tst_QStateMachine::stateEntryAndExit() QCOMPARE(t->targetState(), (QAbstractState*)s2); QCOMPARE(t->targetStates().size(), 1); QCOMPARE(t->targetStates().at(0), (QAbstractState*)s2); - QCOMPARE(s1->addTransition(t), (QAbstractTransition*)t); + s1->addTransition(t); QCOMPARE(t->sourceState(), (QState*)s1); QCOMPARE(t->machine(), &machine); @@ -1173,7 +1173,7 @@ void tst_QStateMachine::stateEntryAndExit() s2->removeTransition(trans); QCOMPARE(trans->sourceState(), (QState*)0); QCOMPARE(trans->targetState(), (QAbstractState*)s3); - QCOMPARE(s2->addTransition(trans), trans); + s2->addTransition(trans); QCOMPARE(trans->sourceState(), (QState*)s2); } @@ -1319,9 +1319,9 @@ void tst_QStateMachine::assignProperty() QCOMPARE(s1->objectName(), QString::fromLatin1("foo")); { - QSignalSpy polishedSpy(s1, SIGNAL(polished())); + QSignalSpy propertiesAssignedSpy(s1, SIGNAL(propertiesAssigned())); machine.start(); - QTRY_COMPARE(polishedSpy.count(), 1); + QTRY_COMPARE(propertiesAssignedSpy.count(), 1); } // nested states @@ -1340,11 +1340,11 @@ void tst_QStateMachine::assignPropertyWithAnimation() // Single animation { QStateMachine machine; - QVERIFY(machine.animationsEnabled()); - machine.setAnimationsEnabled(false); - QVERIFY(!machine.animationsEnabled()); - machine.setAnimationsEnabled(true); - QVERIFY(machine.animationsEnabled()); + QVERIFY(machine.isAnimated()); + machine.setAnimated(false); + QVERIFY(!machine.isAnimated()); + machine.setAnimated(true); + QVERIFY(machine.isAnimated()); QObject obj; obj.setProperty("foo", 321); obj.setProperty("bar", 654); @@ -1371,7 +1371,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() QCOMPARE(trans->animations().size(), 1); QCOMPARE(trans->animations().at(0), (QAbstractAnimation*)&anim); QFinalState *s3 = new QFinalState(&machine); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1399,7 +1399,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() anim2.setDuration(150); trans->addAnimation(&anim2); QFinalState *s3 = new QFinalState(&machine); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1427,7 +1427,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() group.addAnimation(new QPropertyAnimation(&obj, "bar")); trans->addAnimation(&group); QFinalState *s3 = new QFinalState(&machine); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1473,10 +1473,10 @@ void tst_QStateMachine::assignPropertyWithAnimation() anim2.setDuration(250); trans->addAnimation(&anim2); - s21->addTransition(s21, SIGNAL(polished()), s22); + s21->addTransition(s21, SIGNAL(propertiesAssigned()), s22); QFinalState *s3 = new QFinalState(&machine); - s22->addTransition(s2, SIGNAL(polished()), s3); + s22->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1513,13 +1513,13 @@ void tst_QStateMachine::assignPropertyWithAnimation() machine.setInitialState(group); machine.start(); QTRY_COMPARE(machine.configuration().contains(s1), true); - QSignalSpy polishedSpy(s2, SIGNAL(polished())); + QSignalSpy propertiesAssignedSpy(s2, SIGNAL(propertiesAssigned())); emitter.emitSignalWithNoArg(); QTRY_COMPARE(machine.configuration().contains(s2), true); - QVERIFY(polishedSpy.isEmpty()); + QVERIFY(propertiesAssignedSpy.isEmpty()); emitter.emitSignalWithNoArg(); // will cause animations from s1-->s2 to abort QTRY_COMPARE(machine.configuration().contains(s3), true); - QVERIFY(polishedSpy.isEmpty()); + QVERIFY(propertiesAssignedSpy.isEmpty()); QCOMPARE(obj.property("foo").toInt(), 911); QCOMPARE(obj.property("bar").toInt(), 789); } @@ -2736,10 +2736,10 @@ void tst_QStateMachine::restorePolicyNotInherited() }*/ -void tst_QStateMachine::globalRestorePolicySetToDoNotRestore() +void tst_QStateMachine::globalRestorePolicySetToDontRestore() { QStateMachine machine; - machine.setGlobalRestorePolicy(QStateMachine::DoNotRestoreProperties); + machine.setGlobalRestorePolicy(QStateMachine::DontRestoreProperties); QObject *propertyHolder = new QObject(&machine); propertyHolder->setProperty("a", 1); @@ -3089,7 +3089,7 @@ void tst_QStateMachine::twoAnimations() QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); machine.start(); @@ -3117,7 +3117,9 @@ void tst_QStateMachine::twoAnimatedTransitions() QState *s2 = new QState(&machine); s2->assignProperty(object, "foo", 5.0); QPropertyAnimation *fooAnimation = new QPropertyAnimation(object, "foo", s2); - s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(fooAnimation); + EventTransition *trans = new EventTransition(QEvent::User, s2); + s1->addTransition(trans); + trans->addAnimation(fooAnimation); QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3126,7 +3128,9 @@ void tst_QStateMachine::twoAnimatedTransitions() QState *s4 = new QState(&machine); s4->assignProperty(object, "foo", 2.0); QPropertyAnimation *fooAnimation2 = new QPropertyAnimation(object, "foo", s4); - s3->addTransition(new EventTransition(QEvent::User, s4))->addAnimation(fooAnimation2); + trans = new EventTransition(QEvent::User, s4); + s3->addTransition(trans); + trans->addAnimation(fooAnimation2); QState *s5 = new QState(&machine); QObject::connect(s5, SIGNAL(entered()), QApplication::instance(), SLOT(quit())); @@ -3161,7 +3165,9 @@ void tst_QStateMachine::playAnimationTwice() QState *s2 = new QState(&machine); s2->assignProperty(object, "foo", 5.0); QPropertyAnimation *fooAnimation = new QPropertyAnimation(object, "foo", s2); - s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(fooAnimation); + EventTransition *trans = new EventTransition(QEvent::User, s2); + s1->addTransition(trans); + trans->addAnimation(fooAnimation); QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3169,7 +3175,9 @@ void tst_QStateMachine::playAnimationTwice() QState *s4 = new QState(&machine); s4->assignProperty(object, "foo", 2.0); - s3->addTransition(new EventTransition(QEvent::User, s4))->addAnimation(fooAnimation); + trans = new EventTransition(QEvent::User, s4); + s3->addTransition(trans); + trans->addAnimation(fooAnimation); QState *s5 = new QState(&machine); QObject::connect(s5, SIGNAL(entered()), QApplication::instance(), SLOT(quit())); @@ -3213,14 +3221,16 @@ void tst_QStateMachine::nestedTargetStateForAnimation() QState *s2Child2 = new QState(s2); s2Child2->assignProperty(object, "bar", 11.0); - QAbstractTransition *at = s2Child->addTransition(new EventTransition(QEvent::User, s2Child2)); + QAbstractTransition *at = new EventTransition(QEvent::User, s2Child2); + s2Child->addTransition(at); QPropertyAnimation *animation = new QPropertyAnimation(object, "bar", s2); animation->setDuration(2000); connect(animation, SIGNAL(finished()), &counter, SLOT(slot())); at->addAnimation(animation); - at = s1->addTransition(new EventTransition(QEvent::User, s2)); + at = new EventTransition(QEvent::User, s2); + s1->addTransition(at); animation = new QPropertyAnimation(object, "foo", s2); connect(animation, SIGNAL(finished()), &counter, SLOT(slot())); @@ -3231,7 +3241,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation() at->addAnimation(animation); QState *s3 = new QState(&machine); - s2->addTransition(s2Child, SIGNAL(polished()), s3); + s2->addTransition(s2Child, SIGNAL(propertiesAssigned()), s3); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3248,7 +3258,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation() QCOMPARE(counter.counter, 2); } -void tst_QStateMachine::polishedSignalTransitionsReuseAnimationGroup() +void tst_QStateMachine::propertiesAssignedSignalTransitionsReuseAnimationGroup() { QStateMachine machine; QObject *object = new QObject(&machine); @@ -3265,9 +3275,9 @@ void tst_QStateMachine::polishedSignalTransitionsReuseAnimationGroup() QParallelAnimationGroup animationGroup; animationGroup.addAnimation(new QPropertyAnimation(object, "foo")); QSignalSpy animationFinishedSpy(&animationGroup, SIGNAL(finished())); - s1->addTransition(s1, SIGNAL(polished()), s2)->addAnimation(&animationGroup); - s2->addTransition(s2, SIGNAL(polished()), s3)->addAnimation(&animationGroup); - s3->addTransition(s3, SIGNAL(polished()), s4); + s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2)->addAnimation(&animationGroup); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3)->addAnimation(&animationGroup); + s3->addTransition(s3, SIGNAL(propertiesAssigned()), s4); machine.setInitialState(s1); QSignalSpy machineFinishedSpy(&machine, SIGNAL(finished())); @@ -3299,7 +3309,8 @@ void tst_QStateMachine::animatedGlobalRestoreProperty() QState *s4 = new QState(&machine); QObject::connect(s4, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2)); + QAbstractTransition *at = new EventTransition(QEvent::User, s2); + s1->addTransition(at); QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", s2); connect(pa, SIGNAL(finished()), &counter, SLOT(slot())); at->addAnimation(pa); @@ -3341,7 +3352,9 @@ void tst_QStateMachine::specificTargetValueOfAnimation() QPropertyAnimation *anim = new QPropertyAnimation(object, "foo"); anim->setEndValue(10.0); - s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(anim); + EventTransition *trans = new EventTransition(QEvent::User, s2); + s1->addTransition(trans); + trans->addAnimation(anim); QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3495,7 +3508,8 @@ void tst_QStateMachine::overrideDefaultAnimationWithSpecific() QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2)); + QAbstractTransition *at = new EventTransition(QEvent::User, s2); + s1->addTransition(at); QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo"); connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); diff --git a/tests/auto/qstringbuilder1/qstringbuilder1.pro b/tests/auto/qstringbuilder1/qstringbuilder1.pro index 1ca9d45..5bb14d4 100644 --- a/tests/auto/qstringbuilder1/qstringbuilder1.pro +++ b/tests/auto/qstringbuilder1/qstringbuilder1.pro @@ -3,7 +3,4 @@ load(qttest_p4) QT = core SOURCES += tst_qstringbuilder1.cpp -HEADERS += ../qstringbuilder1/stringbuilder.h - -DEFINES += SCENARIO=1 diff --git a/tests/auto/qstringbuilder1/stringbuilder.cpp b/tests/auto/qstringbuilder1/stringbuilder.cpp index 9fea137..f35d4d2 100644 --- a/tests/auto/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/qstringbuilder1/stringbuilder.cpp @@ -39,61 +39,9 @@ ** ****************************************************************************/ -// This is included in various .cpp files as a compile test for various scenarios -// depending on NO_CAST_* and QT_USE_FAST_OPERATOR_PLUS and QT_USE_FAST_CONCATENATION - -#if SCENARIO == 1 -// this is the "no harm done" version. Only operator% is active, -// with NO_CAST * defined -#define P % -#undef QT_USE_FAST_OPERATOR_PLUS -#undef QT_USE_FAST_CONCATENATION -#define QT_NO_CAST_FROM_ASCII -#define QT_NO_CAST_TO_ASCII -#endif - - -#if SCENARIO == 2 -// this is the "full" version. Operator+ is replaced by a QStringBuilder -// based version -// with NO_CAST * defined -#define P + -#define QT_USE_FAST_OPERATOR_PLUS -#define QT_USE_FAST_CONCATENATION -#define QT_NO_CAST_FROM_ASCII -#define QT_NO_CAST_TO_ASCII -#endif - -#if SCENARIO == 3 -// this is the "no harm done" version. Only operator% is active, -// with NO_CAST * _not_ defined -#define P % -#undef QT_USE_FAST_OPERATOR_PLUS -#undef QT_USE_FAST_CONCATENATION -#undef QT_NO_CAST_FROM_ASCII -#undef QT_NO_CAST_TO_ASCII -#endif - -#if SCENARIO == 4 -// this is the "full" version. Operator+ is replaced by a QStringBuilder -// based version -// with NO_CAST * _not_ defined -#define P + -#define QT_USE_FAST_OPERATOR_PLUS -#define QT_USE_FAST_CONCATENATION -#undef QT_NO_CAST_FROM_ASCII -#undef QT_NO_CAST_TO_ASCII -#endif - -#include <QtTest/QtTest> -#include "stringbuilder.h" - -//TESTED_CLASS=QStringBuilder -//TESTED_FILES=qstringbuilder.cpp - #define LITERAL "some literal" -void tst_QStringBuilder::scenario() +void runScenario() { QLatin1Literal l1literal(LITERAL); QLatin1String l1string(LITERAL); @@ -129,5 +77,3 @@ void tst_QStringBuilder::scenario() QCOMPARE(r, r2); #endif } - -QTEST_APPLESS_MAIN(tst_QStringBuilder) diff --git a/tests/auto/qstringbuilder1/stringbuilder.h b/tests/auto/qstringbuilder1/stringbuilder.h deleted file mode 100644 index 5ac9dbe..0000000 --- a/tests/auto/qstringbuilder1/stringbuilder.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite 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 Technology Preview License Agreement accompanying -** this package. -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TST_QSTRINGBUILDER_H -#define TST_QSTRINGBUILDER_H - -#include <qobject.h> - -class tst_QStringBuilder : public QObject -{ - Q_OBJECT - -private slots: - void scenario(); -}; - -#endif diff --git a/tests/auto/qstringbuilder1/tst_qstringbuilder1.cpp b/tests/auto/qstringbuilder1/tst_qstringbuilder1.cpp index bd2e4b0..d0a613c 100644 --- a/tests/auto/qstringbuilder1/tst_qstringbuilder1.cpp +++ b/tests/auto/qstringbuilder1/tst_qstringbuilder1.cpp @@ -39,4 +39,35 @@ ** ****************************************************************************/ -#include "../qstringbuilder1/stringbuilder.cpp" + +// SCENARIO 1 +// this is the "no harm done" version. Only operator% is active, +// with NO_CAST * defined +#define P % +#undef QT_USE_FAST_OPERATOR_PLUS +#undef QT_USE_FAST_CONCATENATION +#define QT_NO_CAST_FROM_ASCII +#define QT_NO_CAST_TO_ASCII + + +#include <QtTest/QtTest> + +//TESTED_CLASS=QStringBuilder +//TESTED_FILES=qstringbuilder.cpp + +#define LITERAL "some literal" + +void runScenario(); // Defined in stringbuilder.cpp #included below. + +class tst_QStringBuilder1 : public QObject +{ + Q_OBJECT + +private slots: + void scenario() { runScenario(); } +}; + +#include "stringbuilder.cpp" +#include "tst_qstringbuilder1.moc" + +QTEST_APPLESS_MAIN(tst_QStringBuilder1) diff --git a/tests/auto/qstringbuilder2/qstringbuilder2.pro b/tests/auto/qstringbuilder2/qstringbuilder2.pro index c0b3ebc..4152dc3 100644 --- a/tests/auto/qstringbuilder2/qstringbuilder2.pro +++ b/tests/auto/qstringbuilder2/qstringbuilder2.pro @@ -3,6 +3,3 @@ load(qttest_p4) QT = core SOURCES += tst_qstringbuilder2.cpp -HEADERS += ../qstringbuilder1/stringbuilder.h - -DEFINES += SCENARIO=2 diff --git a/tests/auto/qstringbuilder2/tst_qstringbuilder2.cpp b/tests/auto/qstringbuilder2/tst_qstringbuilder2.cpp index bd2e4b0..4470928 100644 --- a/tests/auto/qstringbuilder2/tst_qstringbuilder2.cpp +++ b/tests/auto/qstringbuilder2/tst_qstringbuilder2.cpp @@ -39,4 +39,36 @@ ** ****************************************************************************/ + +// SCENARIO 2 +// this is the "full" version. Operator+ is replaced by a QStringBuilder +// based version +// with NO_CAST * defined +#define P + +#define QT_USE_FAST_OPERATOR_PLUS +#define QT_USE_FAST_CONCATENATION +#define QT_NO_CAST_FROM_ASCII +#define QT_NO_CAST_TO_ASCII + + +#include <QtTest/QtTest> + +//TESTED_CLASS=QStringBuilder +//TESTED_FILES=qstringbuilder.cpp + +#define LITERAL "some literal" + +void runScenario(); // Defined in stringbuilder.cpp #included below. + +class tst_QStringBuilder2 : public QObject +{ + Q_OBJECT + +private slots: + void scenario() { runScenario(); } +}; + #include "../qstringbuilder1/stringbuilder.cpp" +#include "tst_qstringbuilder2.moc" + +QTEST_APPLESS_MAIN(tst_QStringBuilder2) diff --git a/tests/auto/qstringbuilder3/qstringbuilder3.pro b/tests/auto/qstringbuilder3/qstringbuilder3.pro index 93d1a39..b4d2225 100644 --- a/tests/auto/qstringbuilder3/qstringbuilder3.pro +++ b/tests/auto/qstringbuilder3/qstringbuilder3.pro @@ -3,6 +3,3 @@ load(qttest_p4) QT = core SOURCES += tst_qstringbuilder3.cpp -HEADERS += ../qstringbuilder1/stringbuilder.h - -DEFINES += SCENARIO=3 diff --git a/tests/auto/qstringbuilder3/tst_qstringbuilder3.cpp b/tests/auto/qstringbuilder3/tst_qstringbuilder3.cpp index bd2e4b0..30f0181 100644 --- a/tests/auto/qstringbuilder3/tst_qstringbuilder3.cpp +++ b/tests/auto/qstringbuilder3/tst_qstringbuilder3.cpp @@ -39,4 +39,35 @@ ** ****************************************************************************/ + +// SCENARIO 3 +// this is the "no harm done" version. Only operator% is active, +// with NO_CAST * _not_ defined +#define P % +#undef QT_USE_FAST_OPERATOR_PLUS +#undef QT_USE_FAST_CONCATENATION +#undef QT_NO_CAST_FROM_ASCII +#undef QT_NO_CAST_TO_ASCII + + +#include <QtTest/QtTest> + +//TESTED_CLASS=QStringBuilder +//TESTED_FILES=qstringbuilder.cpp + +#define LITERAL "some literal" + +void runScenario(); // Defined in stringbuilder.cpp #included below. + +class tst_QStringBuilder3 : public QObject +{ + Q_OBJECT + +private slots: + void scenario() { runScenario(); } +}; + #include "../qstringbuilder1/stringbuilder.cpp" +#include "tst_qstringbuilder3.moc" + +QTEST_APPLESS_MAIN(tst_QStringBuilder3) diff --git a/tests/auto/qstringbuilder4/qstringbuilder4.pro b/tests/auto/qstringbuilder4/qstringbuilder4.pro index eeec447..6ec5228 100644 --- a/tests/auto/qstringbuilder4/qstringbuilder4.pro +++ b/tests/auto/qstringbuilder4/qstringbuilder4.pro @@ -3,6 +3,3 @@ load(qttest_p4) QT = core SOURCES += tst_qstringbuilder4.cpp -HEADERS += ../qstringbuilder1/stringbuilder.h - -DEFINES += SCENARIO=4 diff --git a/tests/auto/qstringbuilder4/tst_qstringbuilder4.cpp b/tests/auto/qstringbuilder4/tst_qstringbuilder4.cpp index 2159283..95b4ec3 100644 --- a/tests/auto/qstringbuilder4/tst_qstringbuilder4.cpp +++ b/tests/auto/qstringbuilder4/tst_qstringbuilder4.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** This file is part of the test suite module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -39,4 +39,36 @@ ** ****************************************************************************/ + +// SCENARIO 4 +// this is the "full" version. Operator+ is replaced by a QStringBuilder +// based version +// with NO_CAST * _not_ defined +#define P + +#define QT_USE_FAST_OPERATOR_PLUS +#define QT_USE_FAST_CONCATENATION +#undef QT_NO_CAST_FROM_ASCII +#undef QT_NO_CAST_TO_ASCII + + +#include <QtTest/QtTest> + +//TESTED_CLASS=QStringBuilder +//TESTED_FILES=qstringbuilder.cpp + +#define LITERAL "some literal" + +void runScenario(); // Defined in stringbuilder.cpp #included below. + +class tst_QStringBuilder4 : public QObject +{ + Q_OBJECT + +private slots: + void scenario() { runScenario(); } +}; + #include "../qstringbuilder1/stringbuilder.cpp" +#include "tst_qstringbuilder4.moc" + +QTEST_APPLESS_MAIN(tst_QStringBuilder4) diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index fe87dfb..7c3f4f2 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -118,6 +118,7 @@ private slots: void smallTextLengthWordWrap(); void smallTextLengthWrapAtWordBoundaryOrAnywhere(); void testLineBreakingAllSpaces(); + void lineWidthFromBOM(); private: @@ -1306,6 +1307,18 @@ void tst_QTextLayout::columnWrapWithTabs() } +void tst_QTextLayout::lineWidthFromBOM() +{ + const QString string(QChar(0xfeff)); // BYTE ORDER MARK + QTextLayout layout(string); + layout.beginLayout(); + QTextLine line = layout.createLine(); + line.setLineWidth(INT_MAX / 256); + layout.endLayout(); + + // Don't spin into an infinite loop + } + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp index 7ea2163..9418be0 100644 --- a/tests/auto/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp @@ -719,6 +719,8 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest() QProcess serverProcess; serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"), QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(serverProcess.waitForStarted(3000), + qPrintable("Failed to start subprocess: " + serverProcess.errorString())); // Wait until the server has started and reports success. while (!serverProcess.canReadLine()) @@ -732,6 +734,9 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest() clientProcess.start(QString::fromLatin1("clientserver/clientserver connectedclient %1 %2") .arg(QLatin1String("127.0.0.1")).arg(serverPort), QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(clientProcess.waitForStarted(3000), + qPrintable("Failed to start subprocess: " + clientProcess.errorString())); + // Wait until the server has started and reports success. while (!clientProcess.canReadLine()) QVERIFY(clientProcess.waitForReadyRead(3000)); @@ -779,6 +784,8 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest() QProcess serverProcess; serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"), QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(serverProcess.waitForStarted(3000), + qPrintable("Failed to start subprocess: " + serverProcess.errorString())); // Wait until the server has started and reports success. while (!serverProcess.canReadLine()) @@ -792,6 +799,9 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest() clientProcess.start(QString::fromLatin1("clientserver/clientserver unconnectedclient %1 %2") .arg(QLatin1String("127.0.0.1")).arg(serverPort), QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(clientProcess.waitForStarted(3000), + qPrintable("Failed to start subprocess: " + clientProcess.errorString())); + // Wait until the server has started and reports success. while (!clientProcess.canReadLine()) QVERIFY(clientProcess.waitForReadyRead(3000)); diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index e2a606f..3d68a73 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -1432,8 +1432,10 @@ void tst_QVariant::matrix4x4() QVariant variant; QMatrix4x4 matrix = qVariantValue<QMatrix4x4>(variant); QVERIFY(matrix.isIdentity()); - qVariantSetValue(variant, QMatrix4x4().scale(2.0)); - QCOMPARE(QMatrix4x4().scale(2.0), qVariantValue<QMatrix4x4>(variant)); + QMatrix4x4 m; + m.scale(2.0f); + qVariantSetValue(variant, m); + QCOMPARE(m, qVariantValue<QMatrix4x4>(variant)); void *mmatrix = QMetaType::construct(QVariant::Matrix4x4, 0); QVERIFY(mmatrix); diff --git a/tests/auto/qvideoframe/tst_qvideoframe.cpp b/tests/auto/qvideoframe/tst_qvideoframe.cpp index b231069..432ef5c 100644 --- a/tests/auto/qvideoframe/tst_qvideoframe.cpp +++ b/tests/auto/qvideoframe/tst_qvideoframe.cpp @@ -524,7 +524,7 @@ void tst_QVideoFrame::assign() void tst_QVideoFrame::map_data() { QTest::addColumn<QSize>("size"); - QTest::addColumn<int>("numBytes"); + QTest::addColumn<int>("mappedBytes"); QTest::addColumn<int>("bytesPerLine"); QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat"); QTest::addColumn<QAbstractVideoBuffer::MapMode>("mode"); @@ -554,29 +554,29 @@ void tst_QVideoFrame::map_data() void tst_QVideoFrame::map() { QFETCH(QSize, size); - QFETCH(int, numBytes); + QFETCH(int, mappedBytes); QFETCH(int, bytesPerLine); QFETCH(QVideoFrame::PixelFormat, pixelFormat); QFETCH(QAbstractVideoBuffer::MapMode, mode); - QVideoFrame frame(numBytes, size, bytesPerLine, pixelFormat); + QVideoFrame frame(mappedBytes, size, bytesPerLine, pixelFormat); QVERIFY(!frame.bits()); - QCOMPARE(frame.numBytes(), 0); + QCOMPARE(frame.mappedBytes(), 0); QCOMPARE(frame.bytesPerLine(), 0); QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); QVERIFY(frame.map(mode)); QVERIFY(frame.bits()); - QCOMPARE(frame.numBytes(), numBytes); + QCOMPARE(frame.mappedBytes(), mappedBytes); QCOMPARE(frame.bytesPerLine(), bytesPerLine); QCOMPARE(frame.mapMode(), mode); frame.unmap(); QVERIFY(!frame.bits()); - QCOMPARE(frame.numBytes(), 0); + QCOMPARE(frame.mappedBytes(), 0); QCOMPARE(frame.bytesPerLine(), 0); QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); } @@ -614,21 +614,21 @@ void tst_QVideoFrame::mapImage() QVideoFrame frame(image); QVERIFY(!frame.bits()); - QCOMPARE(frame.numBytes(), 0); + QCOMPARE(frame.mappedBytes(), 0); QCOMPARE(frame.bytesPerLine(), 0); QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); QVERIFY(frame.map(mode)); QVERIFY(frame.bits()); - QCOMPARE(frame.numBytes(), image.numBytes()); + QCOMPARE(frame.mappedBytes(), image.numBytes()); QCOMPARE(frame.bytesPerLine(), image.bytesPerLine()); QCOMPARE(frame.mapMode(), mode); frame.unmap(); QVERIFY(!frame.bits()); - QCOMPARE(frame.numBytes(), 0); + QCOMPARE(frame.mappedBytes(), 0); QCOMPARE(frame.bytesPerLine(), 0); QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); } diff --git a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp index 9623e80..a47cb48 100644 --- a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp +++ b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp @@ -68,8 +68,8 @@ private slots: void scanLineDirection(); void frameRate_data(); void frameRate(); - void yuvColorSpace_data(); - void yuvColorSpace(); + void yCbCrColorSpace_data(); + void yCbCrColorSpace(); void pixelAspectRatio_data(); void pixelAspectRatio(); void sizeHint_data(); @@ -81,9 +81,6 @@ private slots: void assign(); }; -Q_DECLARE_METATYPE(QVideoSurfaceFormat::ViewportMode) - - tst_QVideoSurfaceFormat::tst_QVideoSurfaceFormat() { } @@ -122,7 +119,7 @@ void tst_QVideoSurfaceFormat::constructNull() QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom); QCOMPARE(format.frameRate(), 0.0); QCOMPARE(format.pixelAspectRatio(), QSize(1, 1)); - QCOMPARE(format.yuvColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined); + QCOMPARE(format.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined); } void tst_QVideoSurfaceFormat::construct_data() @@ -161,7 +158,7 @@ void tst_QVideoSurfaceFormat::construct() QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom); QCOMPARE(format.frameRate(), 0.0); QCOMPARE(format.pixelAspectRatio(), QSize(1, 1)); - QCOMPARE(format.yuvColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined); + QCOMPARE(format.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined); } void tst_QVideoSurfaceFormat::frameSize_data() @@ -202,45 +199,23 @@ void tst_QVideoSurfaceFormat::viewport_data() QTest::addColumn<QSize>("initialSize"); QTest::addColumn<QRect>("viewport"); QTest::addColumn<QSize>("newSize"); - QTest::addColumn<QVideoSurfaceFormat::ViewportMode>("viewportMode"); QTest::addColumn<QRect>("expectedViewport"); QTest::newRow("grow reset") << QSize(64, 64) << QRect(8, 8, 48, 48) << QSize(1024, 1024) - << QVideoSurfaceFormat::ResetViewport << QRect(0, 0, 1024, 1024); - QTest::newRow("grow keep") - << QSize(64, 64) - << QRect(8, 8, 48, 48) - << QSize(1024, 1024) - << QVideoSurfaceFormat::KeepViewport - << QRect(8, 8, 48, 48); QTest::newRow("shrink reset") << QSize(1024, 1024) << QRect(8, 8, 1008, 1008) << QSize(64, 64) - << QVideoSurfaceFormat::ResetViewport << QRect(0, 0, 64, 64); - QTest::newRow("shrink keep") - << QSize(1024, 1024) - << QRect(8, 8, 1008, 1008) - << QSize(64, 64) - << QVideoSurfaceFormat::KeepViewport - << QRect(8, 8, 56, 56); QTest::newRow("unchanged reset") << QSize(512, 512) << QRect(8, 8, 496, 496) << QSize(512, 512) - << QVideoSurfaceFormat::ResetViewport << QRect(0, 0, 512, 512); - QTest::newRow("unchanged keep") - << QSize(512, 512) - << QRect(8, 8, 496, 496) - << QSize(512, 512) - << QVideoSurfaceFormat::KeepViewport - << QRect(8, 8, 496, 496); } void tst_QVideoSurfaceFormat::viewport() @@ -248,7 +223,6 @@ void tst_QVideoSurfaceFormat::viewport() QFETCH(QSize, initialSize); QFETCH(QRect, viewport); QFETCH(QSize, newSize); - QFETCH(QVideoSurfaceFormat::ViewportMode, viewportMode); QFETCH(QRect, expectedViewport); { @@ -261,7 +235,7 @@ void tst_QVideoSurfaceFormat::viewport() QCOMPARE(format.viewport(), viewport); QCOMPARE(format.property("viewport").toRect(), viewport); - format.setFrameSize(newSize, viewportMode); + format.setFrameSize(newSize); QCOMPARE(format.viewport(), expectedViewport); QCOMPARE(format.property("viewport").toRect(), expectedViewport); @@ -350,9 +324,9 @@ void tst_QVideoSurfaceFormat::frameRate() } } -void tst_QVideoSurfaceFormat::yuvColorSpace_data() +void tst_QVideoSurfaceFormat::yCbCrColorSpace_data() { - QTest::addColumn<QVideoSurfaceFormat::YuvColorSpace>("colorspace"); + QTest::addColumn<QVideoSurfaceFormat::YCbCrColorSpace>("colorspace"); QTest::newRow("undefined") << QVideoSurfaceFormat::YCbCr_Undefined; @@ -364,24 +338,24 @@ void tst_QVideoSurfaceFormat::yuvColorSpace_data() << QVideoSurfaceFormat::YCbCr_JPEG; } -void tst_QVideoSurfaceFormat::yuvColorSpace() +void tst_QVideoSurfaceFormat::yCbCrColorSpace() { - QFETCH(QVideoSurfaceFormat::YuvColorSpace, colorspace); + QFETCH(QVideoSurfaceFormat::YCbCrColorSpace, colorspace); { QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32); - format.setYuvColorSpace(colorspace); + format.setYCbCrColorSpace(colorspace); - QCOMPARE(format.yuvColorSpace(), colorspace); - QCOMPARE(qvariant_cast<QVideoSurfaceFormat::YuvColorSpace>(format.property("yuvColorSpace")), + QCOMPARE(format.yCbCrColorSpace(), colorspace); + QCOMPARE(qvariant_cast<QVideoSurfaceFormat::YCbCrColorSpace>(format.property("yCbCrColorSpace")), colorspace); } { QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32); - format.setProperty("yuvColorSpace", qVariantFromValue(colorspace)); + format.setProperty("yCbCrColorSpace", qVariantFromValue(colorspace)); - QCOMPARE(format.yuvColorSpace(), colorspace); - QCOMPARE(qvariant_cast<QVideoSurfaceFormat::YuvColorSpace>(format.property("yuvColorSpace")), + QCOMPARE(format.yCbCrColorSpace(), colorspace); + QCOMPARE(qvariant_cast<QVideoSurfaceFormat::YCbCrColorSpace>(format.property("yCbCrColorSpace")), colorspace); } } @@ -483,7 +457,7 @@ void tst_QVideoSurfaceFormat::staticPropertyNames() QVERIFY(propertyNames.contains("scanLineDirection")); QVERIFY(propertyNames.contains("frameRate")); QVERIFY(propertyNames.contains("pixelAspectRatio")); - QVERIFY(propertyNames.contains("yuvColorSpace")); + QVERIFY(propertyNames.contains("yCbCrColorSpace")); QVERIFY(propertyNames.contains("sizeHint")); QCOMPARE(propertyNames.count(), 10); } @@ -566,19 +540,26 @@ void tst_QVideoSurfaceFormat::compare() QCOMPARE(format1 == format4, false); QCOMPARE(format1 != format4, true); - format2.setFrameSize(1024, 768, QVideoSurfaceFormat::ResetViewport); + format2.setFrameSize(1024, 768); // Not equal, frame size differs. QCOMPARE(format1 == format2, false); QCOMPARE(format1 != format2, true); - format1.setFrameSize(1024, 768, QVideoSurfaceFormat::KeepViewport); + format1.setFrameSize(1024, 768); + + // Equal. + QCOMPARE(format1 == format2, true); + QCOMPARE(format1 != format2, false); + + format1.setViewport(QRect(0, 0, 800, 600)); + format2.setViewport(QRect(112, 84, 800, 600)); - // Not equal, viewport differs. + // Not equal, viewports differ. QCOMPARE(format1 == format2, false); QCOMPARE(format1 != format2, true); - format1.setViewport(QRect(0, 0, 1024, 768)); + format1.setViewport(QRect(112, 84, 800, 600)); // Equal. QCOMPARE(format1 == format2, true); @@ -620,13 +601,13 @@ void tst_QVideoSurfaceFormat::compare() QCOMPARE(format1 == format2, true); QCOMPARE(format1 != format2, false); - format2.setYuvColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601); + format2.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601); // Not equal yuv color space differs. QCOMPARE(format1 == format2, false); QCOMPARE(format1 != format2, true); - format1.setYuvColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601); + format1.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601); // Equal. QCOMPARE(format1 == format2, true); diff --git a/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp b/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp index 71f45ff..f80b579 100644 --- a/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp +++ b/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp @@ -220,7 +220,7 @@ void tst_QMatrix4x4::mapVector3D() QVector3D v(10.5f, -2.0f, 3.0f); QVector3D result; - m1.inferSpecialType(); + m1.optimize(); QBENCHMARK { result = m1 * v; @@ -244,7 +244,7 @@ void tst_QMatrix4x4::mapVector2D() QPointF v(10.5f, -2.0f); QPointF result; - m1.inferSpecialType(); + m1.optimize(); QBENCHMARK { result = m1 * v; diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index dd3823b..e2b7d58 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -249,6 +249,7 @@ Configure::Configure( int& argc, char** argv ) dictionary[ "MULTIMEDIA" ] = "yes"; dictionary[ "DIRECTSHOW" ] = "no"; dictionary[ "WEBKIT" ] = "auto"; + dictionary[ "DECLARATIVE" ] = "no"; dictionary[ "PLUGIN_MANIFESTS" ] = "yes"; QString version; @@ -905,6 +906,10 @@ void Configure::parseCmdLine() dictionary[ "WEBKIT" ] = "no"; } else if( configCmdLine.at(i) == "-webkit" ) { dictionary[ "WEBKIT" ] = "yes"; + } else if( configCmdLine.at(i) == "-no-declarative" ) { + dictionary[ "DECLARATIVE" ] = "no"; + } else if( configCmdLine.at(i) == "-declarative" ) { + dictionary[ "DECLARATIVE" ] = "yes"; } else if( configCmdLine.at(i) == "-no-plugin-manifests" ) { dictionary[ "PLUGIN_MANIFESTS" ] = "no"; } else if( configCmdLine.at(i) == "-plugin-manifests" ) { @@ -1412,7 +1417,6 @@ void Configure::applySpecSpecifics() dictionary[ "WEBKIT" ] = "no"; dictionary[ "PHONON" ] = "yes"; dictionary[ "DIRECTSHOW" ] = "no"; - dictionary[ "LTCG" ] = "yes"; // We only apply MMX/IWMMXT for mkspecs we know they work if (dictionary[ "XQMAKESPEC" ].startsWith("wincewm")) { dictionary[ "MMX" ] = "yes"; @@ -1746,6 +1750,8 @@ bool Configure::displayHelp() desc("SCRIPT", "yes", "-script", "Build the QtScript module."); desc("SCRIPTTOOLS", "no", "-no-scripttools", "Do not build the QtScriptTools module."); desc("SCRIPTTOOLS", "yes", "-scripttools", "Build the QtScriptTools module."); + desc("DECLARATIVE", "no", "-no-declarative", "Do not build the declarative module"); + desc("DECLARATIVE", "yes", "-declarative", "Build the declarative module"); desc( "-arch <arch>", "Specify an architecture.\n" "Available values for <arch>:"); @@ -2508,6 +2514,9 @@ void Configure::generateOutputVars() if (dictionary["WEBKIT"] == "yes") qtConfig += "webkit"; + if (dictionary["DECLARATIVE"] == "yes") + qtConfig += "declarative"; + // We currently have no switch for QtSvg, so add it unconditionally. qtConfig += "svg"; @@ -2876,6 +2885,7 @@ void Configure::generateConfigfiles() if(dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS"; if(dictionary["IPV6"] == "no") qconfigList += "QT_NO_IPV6"; if(dictionary["WEBKIT"] == "no") qconfigList += "QT_NO_WEBKIT"; + if(dictionary["DECLARATIVE"] == "no") qconfigList += "QT_NO_DECLARATIVE"; if(dictionary["PHONON"] == "no") qconfigList += "QT_NO_PHONON"; if(dictionary["MULTIMEDIA"] == "no") qconfigList += "QT_NO_MULTIMEDIA"; if(dictionary["XMLPATTERNS"] == "no") qconfigList += "QT_NO_XMLPATTERNS"; @@ -3033,7 +3043,7 @@ void Configure::generateConfigfiles() << "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl << endl << "/* Build date */" << endl - << "static const char qt_configure_installation [11 + 12] = \"" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl + << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl << endl; if(!dictionary[ "QT_HOST_PREFIX" ].isNull()) tmpStream << "#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)" << endl; @@ -3174,6 +3184,7 @@ void Configure::displayConfig() cout << "Phonon support.............." << dictionary[ "PHONON" ] << endl; cout << "QtMultimedia support........" << dictionary[ "MULTIMEDIA" ] << endl; cout << "WebKit support.............." << dictionary[ "WEBKIT" ] << endl; + cout << "Declarative support........." << dictionary[ "DECLARATIVE" ] << endl; cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl; cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl; cout << "Graphics System............." << dictionary[ "GRAPHICS_SYSTEM" ] << endl; diff --git a/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp b/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp index 2789bd3..f4f3d24 100644 --- a/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp +++ b/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp @@ -399,6 +399,7 @@ static const char *currentTabNameKey = "currentTabName"; static const char *currentTabIconKey = "currentTabIcon"; static const char *currentTabToolTipKey = "currentTabToolTip"; static const char *currentTabWhatsThisKey = "currentTabWhatsThis"; +static const char *tabMovableKey = "movable"; QTabWidgetPropertySheet::QTabWidgetPropertySheet(QTabWidget *object, QObject *parent) : QDesignerPropertySheet(object, parent), @@ -411,6 +412,8 @@ QTabWidgetPropertySheet::QTabWidgetPropertySheet(QTabWidget *object, QObject *pa formWindowBase()->addReloadableProperty(this, indexOf(QLatin1String(currentTabIconKey))); createFakeProperty(QLatin1String(currentTabToolTipKey), qVariantFromValue(qdesigner_internal::PropertySheetStringValue())); createFakeProperty(QLatin1String(currentTabWhatsThisKey), qVariantFromValue(qdesigner_internal::PropertySheetStringValue())); + // Prevent the tab widget's drag and drop handling from interfering with Designer's + createFakeProperty(QLatin1String(tabMovableKey), QVariant(false)); } QTabWidgetPropertySheet::TabWidgetProperty QTabWidgetPropertySheet::tabWidgetPropertyFromName(const QString &name) diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index 9bc6641..7f09a1c 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -269,6 +269,7 @@ MainWindow::MainWindow() m_editActiveModel(-1), m_statistics(0) { + setUnifiedTitleAndToolBarOnMac(true); m_ui.setupUi(this); #ifndef Q_WS_MAC diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index 07cdb59..725129a 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -162,6 +162,10 @@ class Config #define CONFIG_FILEEXTENSIONS "fileextensions" +#ifdef QDOC_QML +#define CONFIG_QMLONLY "qmlonly" +#endif + QT_END_NAMESPACE #endif diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index a32f92b..c07be8b 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -353,6 +353,10 @@ QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary) QString name = taggedQmlNode(node); if (summary) { name = linkTag(node,name); + } else if (node->type() == Node::QmlProperty) { + const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(node); + if (pn->isAttached()) + name.prepend(pn->element() + QLatin1Char('.')); } name = "<@name>" + name + "</@name>"; QString synopsis = name; @@ -1109,15 +1113,15 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, if (qmlClassNode) { if (style == Summary) { FastSection qmlproperties(qmlClassNode, - "QML Properties", + "Properties", "property", "properties"); FastSection qmlattachedproperties(qmlClassNode, - "QML Attached Properties", + "Attached Properties", "property", "properties"); FastSection qmlsignals(qmlClassNode, - "QML Signals", + "Signals", "signal", "signals"); FastSection qmlattachedsignals(qmlClassNode, @@ -1125,7 +1129,7 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, "signal", "signals"); FastSection qmlmethods(qmlClassNode, - "QML Methods", + "Methods", "method", "methods"); FastSection qmlattachedmethods(qmlClassNode, @@ -1173,12 +1177,12 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, append(sections,qmlattachedmethods); } else if (style == Detailed) { - FastSection qmlproperties(qmlClassNode,"QML Property Documentation"); - FastSection qmlattachedproperties(qmlClassNode,"QML Attached Property Documentation"); - FastSection qmlsignals(qmlClassNode,"QML Signal Documentation"); - FastSection qmlattachedsignals(qmlClassNode,"QML Attached Signal Documentation"); - FastSection qmlmethods(qmlClassNode,"QML Method Documentation"); - FastSection qmlattachedmethods(qmlClassNode,"QML Attached Method Documentation"); + FastSection qmlproperties(qmlClassNode, "Property Documentation"); + FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation"); + FastSection qmlsignals(qmlClassNode,"Signal Documentation"); + FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation"); + FastSection qmlmethods(qmlClassNode,"Method Documentation"); + FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation"); NodeList::ConstIterator c = qmlClassNode->childNodes().begin(); while (c != qmlClassNode->childNodes().end()) { if ((*c)->subType() == Node::QmlPropertyGroup) { diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 84ec3f4..cabbe38 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -799,14 +799,26 @@ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc, } } if (qmlPropGroup) { - new QmlPropertyNode(qmlPropGroup,property,type,attached); + const ClassNode *correspondingClass = static_cast<const QmlClassNode*>(qmlPropGroup->parent())->classNode(); + PropertyNode *correspondingProperty = 0; + if (correspondingClass) + correspondingProperty = static_cast<PropertyNode*>((Node*)correspondingClass->findNode(property, Node::Property)); + QmlPropertyNode *qmlPropNode = new QmlPropertyNode(qmlPropGroup,property,type,attached); + if (correspondingProperty) { + bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*'); + qmlPropNode->setWritable(writableList || correspondingProperty->isWritable()); + } ++arg; while (arg != args.end()) { if (splitQmlPropertyArg(doc,(*arg),type,element,property)) { - new QmlPropertyNode(qmlPropGroup, + QmlPropertyNode * qmlPropNode = new QmlPropertyNode(qmlPropGroup, property, type, attached); + if (correspondingProperty) { + bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*'); + qmlPropNode->setWritable(writableList || correspondingProperty->isWritable()); + } } ++arg; } @@ -1751,15 +1763,15 @@ bool CppCodeParser::matchProperty(InnerNode *parent) if (key == "READ") tre->addPropertyFunction(property, value, PropertyNode::Getter); - else if (key == "WRITE") + else if (key == "WRITE") { tre->addPropertyFunction(property, value, PropertyNode::Setter); - else if (key == "STORED") + property->setWritable(true); + } else if (key == "STORED") property->setStored(value.toLower() == "true"); else if (key == "DESIGNABLE") property->setDesignable(value.toLower() == "true"); else if (key == "RESET") tre->addPropertyFunction(property, value, PropertyNode::Resetter); - else if (key == "NOTIFY") { tre->addPropertyFunction(property, value, PropertyNode::Notifier); } diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 748390f..f4931b8 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -2841,6 +2841,10 @@ void Doc::initialize(const Config& config) DocParser::sourceDirs = config.getStringList(CONFIG_SOURCEDIRS); DocParser::quoting = config.getBool(CONFIG_QUOTINGINFORMATION); +#ifdef QDOC_QML + QmlClassNode::qmlOnly = config.getBool(CONFIG_QMLONLY); +#endif + QStringMap reverseAliasMap; QSet<QString> commands = config.subVars(CONFIG_ALIAS); diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp index 4973387..52f54c0 100644 --- a/tools/qdoc3/helpprojectwriter.cpp +++ b/tools/qdoc3/helpprojectwriter.cpp @@ -187,8 +187,16 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const details << node->parent()->name()+"::"+node->name(); } else if (node->type() == Node::Fake) { const FakeNode *fake = static_cast<const FakeNode *>(node); - details << fake->fullTitle(); - details << fake->fullTitle(); +#ifdef QDOC_QML + if (fake->subType() == Node::QmlClass) { + details << (QmlClassNode::qmlOnly ? fake->name() : fake->fullTitle()); + details << "QML." + fake->name(); + } else +#endif + { + details << fake->fullTitle(); + details << fake->fullTitle(); + } } else { details << node->name(); details << node->name(); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 18c7916..afd1e74 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -3467,10 +3467,13 @@ QString HtmlGenerator::refForNode(const Node *node) ref += "-" + QString::number(func->overloadNumber()); } break; - case Node::Property: -#ifdef QDOC_QML +#ifdef QDOC_QML + case Node::Fake: + if (node->subType() != Node::QmlPropertyGroup) + break; case Node::QmlProperty: #endif + case Node::Property: ref = node->name() + "-prop"; break; #ifdef QDOC_QML @@ -3512,9 +3515,9 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative) // ### reintroduce this test, without breaking .dcf files if (fn != outFileName()) #endif - link += fn; + link += fn; - if (!node->isInnerNode()) { + if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) { ref = refForNode(node); if (relative && fn == fileName(relative) && ref == refForNode(relative)) return QString(); @@ -4189,13 +4192,15 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(node); NodeList::ConstIterator p = qpgn->childNodes().begin(); out() << "<div class=\"qmlproto\">"; - out() << "<table class=\"qmlname\">"; + out() << "<table width=\"100%\" class=\"qmlname\">"; while (p != qpgn->childNodes().end()) { if ((*p)->type() == Node::QmlProperty) { qpn = static_cast<const QmlPropertyNode*>(*p); out() << "<tr><td>"; out() << "<a name=\"" + refForNode(qpn) + "\"></a>"; + if (!qpn->isWritable()) + out() << "<span class=\"qmlreadonly\">read-only</span>"; generateQmlItem(qpn, relative, marker, false); out() << "</td></tr>"; if (qpgn->isDefault()) { @@ -4276,7 +4281,7 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* cn, } /*! - Output the "[Xxx instantiates the C++ class QFxXxx]" + Output the "[Xxx instantiates the C++ class QmlGraphicsXxx]" line for the QML element, if there should be one. If there is no class node, or if the class node status @@ -4306,7 +4311,7 @@ void HtmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, } /*! - Output the "[QFxXxx is instantiated by QML element Xxx]" + Output the "[QmlGraphicsXxx is instantiated by QML element Xxx]" line for the class, if there should be one. If there is no QML element, or if the class node status diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 61855bc..ecb4a44 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1127,6 +1127,8 @@ bool TargetNode::isInnerNode() const } #ifdef QDOC_QML +bool QmlClassNode::qmlOnly = false; + /*! Constructor for the Qml class node. */ @@ -1135,7 +1137,7 @@ QmlClassNode::QmlClassNode(InnerNode *parent, const ClassNode* cn) : FakeNode(parent, name, QmlClass), cnode(cn) { - setTitle("QML " + name + " Element Reference"); + setTitle((qmlOnly ? "" : "QML ") + name + " Element Reference"); } /*! diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 20ccb95..5712879 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -362,6 +362,8 @@ class QmlClassNode : public FakeNode const ClassNode* classNode() const { return cnode; } virtual QString fileBase() const; + static bool qmlOnly; + private: const ClassNode* cnode; }; @@ -374,7 +376,7 @@ class QmlPropGroupNode : public FakeNode bool attached); virtual ~QmlPropGroupNode() { } - const QString& element() const { return name(); } + const QString& element() const { return parent()->name(); } void setDefault() { isdefault = true; } bool isDefault() const { return isdefault; } bool isAttached() const { return att; } @@ -396,14 +398,16 @@ class QmlPropertyNode : public LeafNode void setDataType(const QString& dataType) { dt = dataType; } void setStored(bool stored) { sto = toTrool(stored); } void setDesignable(bool designable) { des = toTrool(designable); } + void setWritable(bool writable) { wri = toTrool(writable); } const QString &dataType() const { return dt; } QString qualifiedDataType() const { return dt; } bool isStored() const { return fromTrool(sto,true); } bool isDesignable() const { return fromTrool(des,false); } + bool isWritable() const { return fromTrool(wri,true); } bool isAttached() const { return att; } - const QString& element() const { return parent()->name(); } + const QString& element() const { return static_cast<QmlPropGroupNode*>(parent())->element(); } private: enum Trool { Trool_True, Trool_False, Trool_Default }; @@ -414,6 +418,7 @@ class QmlPropertyNode : public LeafNode QString dt; Trool sto; Trool des; + Trool wri; bool att; }; @@ -635,6 +640,7 @@ class PropertyNode : public LeafNode void addSignal(FunctionNode *function, FunctionRole role); void setStored(bool stored) { sto = toTrool(stored); } void setDesignable(bool designable) { des = toTrool(designable); } + void setWritable(bool writable) { wri = toTrool(writable); } void setOverriddenFrom(const PropertyNode *baseProperty); const QString &dataType() const { return dt; } @@ -647,6 +653,7 @@ class PropertyNode : public LeafNode NodeList notifiers() const { return functions(Notifier); } bool isStored() const { return fromTrool(sto, storedDefault()); } bool isDesignable() const { return fromTrool(des, designableDefault()); } + bool isWritable() const { return fromTrool(wri, writableDefault()); } const PropertyNode *overriddenFrom() const { return overrides; } private: @@ -657,11 +664,13 @@ class PropertyNode : public LeafNode bool storedDefault() const { return true; } bool designableDefault() const { return !setters().isEmpty(); } + bool writableDefault() const { return !setters().isEmpty(); } QString dt; NodeList funcs[NumFunctionRoles]; Trool sto; Trool des; + Trool wri; const PropertyNode *overrides; }; diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 83ea561..7d9fbee 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -81,14 +81,13 @@ QString PageGenerator::fileBase(const Node *node) { if (node->relates()) node = node->relates(); - else if (!node->isInnerNode()) { + else if (!node->isInnerNode()) node = node->parent(); #ifdef QDOC_QML - if (node->subType() == Node::QmlPropertyGroup) { - node = node->parent(); - } -#endif + if (node->subType() == Node::QmlPropertyGroup) { + node = node->parent(); } +#endif QString base = node->doc().baseName(); if (!base.isEmpty()) @@ -97,6 +96,7 @@ QString PageGenerator::fileBase(const Node *node) const Node *p = node; forever { + const Node *pp = p->parent(); base.prepend(p->name()); #ifdef QDOC_QML /* @@ -104,15 +104,10 @@ QString PageGenerator::fileBase(const Node *node) we prepend "qml-" to the file name of QML element doc files. */ - if ((p->subType() == Node::QmlClass) || - (p->subType() == Node::QmlPropertyGroup)) - base.prepend("qml-"); - else if ((p->type() == Node::QmlProperty) || - (p->type() == Node::QmlSignal) || - (p->type() == Node::QmlMethod)) + if (p->subType() == Node::QmlClass) { base.prepend("qml-"); + } #endif - const Node *pp = p->parent(); if (!pp || pp->name().isEmpty() || pp->type() == Node::Fake) break; base.prepend(QLatin1Char('-')); diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css index 320da66..b8cae8e 100644 --- a/tools/qdoc3/test/classic.css +++ b/tools/qdoc3/test/classic.css @@ -268,10 +268,15 @@ span.string,span.char border-style: solid; border-color: #ddd; font-weight: bold; - padding: 6px 0px 6px 10px; + padding: 6px 10px 6px 10px; margin: 42px 0px 0px 0px; } +.qmlreadonly { + float: right; + color: red +} + .qmldoc { } diff --git a/tools/qdoc3/test/qt-cpp-ignore.qdocconf b/tools/qdoc3/test/qt-cpp-ignore.qdocconf index 1efc215..dcf33dc 100644 --- a/tools/qdoc3/test/qt-cpp-ignore.qdocconf +++ b/tools/qdoc3/test/qt-cpp-ignore.qdocconf @@ -69,6 +69,7 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \ QT_END_NAMESPACE \ QT_END_INCLUDE_NAMESPACE \ PHONON_EXPORT \ + Q_DECLARATIVE_EXPORT \ Q_GADGET \ QWEBKIT_EXPORT Cpp.ignoredirectives = Q_DECLARE_HANDLE \ diff --git a/tools/tools.pro b/tools/tools.pro index 4b36115..87ba3c9 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -26,6 +26,7 @@ mac { embedded:SUBDIRS += kmap2qmap +contains(QT_CONFIG, declarative):SUBDIRS += qmlviewer qmldebugger contains(QT_CONFIG, dbus):SUBDIRS += qdbus !wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns xmlpatternsvalidator embedded: SUBDIRS += makeqpf diff --git a/translations/qt_sl.ts b/translations/qt_sl.ts index 517ce71..c7684e3 100644 --- a/translations/qt_sl.ts +++ b/translations/qt_sl.ts @@ -12,7 +12,7 @@ <context> <name>FakeReply</name> <message> - <location filename="../src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp" line="+2191"/> + <location filename="../src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp" line="+2193"/> <source>Fake error !</source> <translation>Lažna napaka.</translation> </message> @@ -23,14 +23,6 @@ </message> </context> <context> - <name>InputPrivate</name> - <message> - <location filename="../src/multimedia/audio/qaudioinput_alsa_p.cpp" line="+653"/> - <source>PUSH: read in bytes = %1 (frames=%2)</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> <name>Phonon::</name> <message> <location filename="../src/3rdparty/phonon/phonon/phononnamespace.cpp" line="+55"/> @@ -117,10 +109,10 @@ da je nameščen paket libgstreamer-plugins-base.</translation> <translation>Manjka potreben kodek. Za predvajanje te vsebine morate namestiti sledeče kodeke: %0</translation> </message> <message> - <location line="+676"/> + <location line="+681"/> <location line="+8"/> <location line="+15"/> - <location line="+9"/> + <location line="+22"/> <location line="+6"/> <location line="+19"/> <location line="+339"/> @@ -129,12 +121,12 @@ da je nameščen paket libgstreamer-plugins-base.</translation> <translation>Ni moč odpreti večpredstavnostnega vira.</translation> </message> <message> - <location line="-407"/> + <location line="-420"/> <source>Invalid source type.</source> <translation>Neveljavna vrsta vira.</translation> </message> <message> - <location line="+381"/> + <location line="+394"/> <source>Could not locate media source.</source> <translation>Ni moč najti večpredstavnostnega vira.</translation> </message> @@ -150,11 +142,63 @@ da je nameščen paket libgstreamer-plugins-base.</translation> </message> </context> <context> + <name>Phonon::MMF</name> + <message> + <location filename="../src/3rdparty/phonon/mmf/audiooutput.cpp" line="+108"/> + <source>Audio Output</source> + <translation>Predvajanje zvoka</translation> + </message> + <message> + <location line="+1"/> + <source>The audio output device</source> + <translation>Naprava za predvajanje zvoka</translation> + </message> +</context> +<context> <name>Phonon::MMF::AudioEqualizer</name> <message> - <location filename="../src/3rdparty/phonon/mmf/audioequalizer.cpp" line="+70"/> + <location filename="../src/3rdparty/phonon/mmf/audioequalizer.cpp" line="+75"/> <source>Frequency band, %1 Hz</source> - <translation type="unfinished"></translation> + <translation>Frekvenčni pas, %1 Hz</translation> + </message> +</context> +<context> + <name>Phonon::MMF::EffectFactory</name> + <message> + <location filename="../src/3rdparty/phonon/mmf/effectfactory.cpp" line="+65"/> + <source>audio equalizer</source> + <translation>izenačevalnik zvoka</translation> + </message> + <message> + <location line="+2"/> + <source>Bass boost</source> + <translation>Ojačanje basov</translation> + </message> + <message> + <location line="+2"/> + <source>Distance Attenuation</source> + <translation>Utišanje zaradi razdalje</translation> + </message> + <message> + <location line="+2"/> + <location line="+2"/> + <source>Environmental Reverb</source> + <translation>Okoljsko odmevanje</translation> + </message> + <message> + <location line="+2"/> + <source>Loudness</source> + <translation>Glasnost</translation> + </message> + <message> + <location line="+2"/> + <source>Source Orientation</source> + <translation>Usmerjenost vira</translation> + </message> + <message> + <location line="+2"/> + <source>Stereo Widening</source> + <translation>Razširitev sterea</translation> </message> </context> <context> @@ -888,7 +932,7 @@ v <translation>Dejanje na vtičnici ni podprto</translation> </message> <message> - <location line="+187"/> + <location line="+200"/> <source>Socket operation timed out</source> <translation>Čas za dejanje na vtičnici je potekel</translation> </message> @@ -922,6 +966,14 @@ v </message> </context> <context> + <name>QAccessibleButton</name> + <message> + <location filename="../src/plugins/accessible/widgets/simplewidgets.cpp" line="+250"/> + <source>Press</source> + <translation>Pritisni</translation> + </message> +</context> +<context> <name>QApplication</name> <message> <location filename="../src/gui/accessible/qaccessibleobject.cpp" line="+376"/> @@ -939,7 +991,7 @@ v <translation>Napaka nezdružljivosti knjižnice Qt</translation> </message> <message> - <location filename="../src/gui/kernel/qapplication.cpp" line="+2306"/> + <location filename="../src/gui/kernel/qapplication.cpp" line="+2290"/> <source>QT_LAYOUT_DIRECTION</source> <comment>Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout.</comment> <translation>LTR</translation> @@ -951,117 +1003,6 @@ v </message> </context> <context> - <name>QAudioInputPrivate</name> - <message> - <location filename="../src/multimedia/audio/qaudioinput_alsa_p.cpp" line="-367"/> - <source>QAudioInput: snd_pcm_hw_params_any: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+6"/> - <source>QAudioInput: snd_pcm_hw_params_set_rate_resample: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioInput: snd_pcm_hw_params_set_access: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioInput: snd_pcm_hw_params_set_format: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioInput: snd_pcm_hw_params_set_channels: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioInput: snd_pcm_hw_params_set_rate_near: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioInput: snd_pcm_hw_params_set_buffer_time_near: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioInput: snd_pcm_hw_params_set_period_time_near: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioInput: snd_pcm_hw_params_set_periods_near: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioInput: snd_pcm_hw_params: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+98"/> - <source>PULL: read in bytes = %1 (frames=%2)</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QAudioOutputPrivate</name> - <message> - <location filename="../src/multimedia/audio/qaudiooutput_alsa_p.cpp" line="+307"/> - <source>QAudioOutput: snd_pcm_hw_params_any: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+6"/> - <source>QAudioOutput: snd_pcm_hw_params_set_rate_resample: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioOutput: snd_pcm_hw_params_set_access: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioOutput: snd_pcm_hw_params_set_format: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioOutput: snd_pcm_hw_params_set_channels: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioOutput: snd_pcm_hw_params_set_rate_near: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioOutput: snd_pcm_hw_params_set_buffer_time_near: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioOutput: snd_pcm_hw_params_set_period_time_near: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioOutput: snd_pcm_hw_params_set_periods_near: err = %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>QAudioOutput: snd_pcm_hw_params: err = %1</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> <name>QAxSelect</name> <message> <location filename="../src/activeqt/container/qaxselect.ui"/> @@ -1087,7 +1028,7 @@ v <context> <name>QCheckBox</name> <message> - <location filename="../src/plugins/accessible/widgets/simplewidgets.cpp" line="+114"/> + <location filename="../src/plugins/accessible/widgets/simplewidgets.cpp" line="-136"/> <source>Uncheck</source> <translation>Odznači</translation> </message> @@ -1105,7 +1046,7 @@ v <context> <name>QColorDialog</name> <message> - <location filename="../src/gui/dialogs/qcolordialog.cpp" line="+1348"/> + <location filename="../src/gui/dialogs/qcolordialog.cpp" line="+1349"/> <source>Hu&e:</source> <translation>&Odtenek:</translation> </message> @@ -1145,7 +1086,7 @@ v <translation>Izberite barvo</translation> </message> <message> - <location line="+178"/> + <location line="+180"/> <source>&Basic colors</source> <translation>&Osnovne barve</translation> </message> @@ -1214,7 +1155,7 @@ v <location line="+4"/> <source>%1: does not exist</source> <comment>QSystemSemaphore</comment> - <translation type="unfinished">%1: ne obstaja</translation> + <translation>%1: ne obstaja</translation> </message> <message> <location line="+5"/> @@ -1345,7 +1286,7 @@ v <message> <location filename="../src/gui/dialogs/qmessagebox.cpp" line="+1872"/> <location line="+464"/> - <location filename="../src/gui/widgets/qdialogbuttonbox.cpp" line="+619"/> + <location filename="../src/gui/widgets/qdialogbuttonbox.cpp" line="+606"/> <source>OK</source> <translation>V redu</translation> </message> @@ -1544,7 +1485,7 @@ v <translation>Usodna napaka:</translation> </message> <message> - <location line="+199"/> + <location line="+200"/> <source>&Show this message again</source> <translation>&To sporočilo naslednjič spet prikaži</translation> </message> @@ -1565,7 +1506,7 @@ v <message> <location line="-140"/> <source>Will not rename sequential file using block copy</source> - <translation type="unfinished"></translation> + <translation>Sekvenčna datoteka ne bo preimenovana z uporabo kopiranja blokov</translation> </message> <message> <location line="+23"/> @@ -1596,7 +1537,7 @@ v <context> <name>QFileDialog</name> <message> - <location filename="../src/gui/dialogs/qfiledialog.cpp" line="+556"/> + <location filename="../src/gui/dialogs/qfiledialog.cpp" line="+558"/> <location line="+450"/> <source>All Files (*)</source> <translation>Vse datoteke (*)</translation> @@ -1724,7 +1665,7 @@ Ali jo kljub temu želite izbrisati?</translation> <translation>Ni bilo moč izbrisati mape.</translation> </message> <message> - <location line="+404"/> + <location line="+410"/> <source>Recent Places</source> <translation>Nedavna mesta</translation> </message> @@ -1734,12 +1675,12 @@ Ali jo kljub temu želite izbrisati?</translation> <translation>Vse datoteke (*.*)</translation> </message> <message> - <location filename="../src/gui/dialogs/qfiledialog.cpp" line="-2540"/> + <location filename="../src/gui/dialogs/qfiledialog.cpp" line="-2546"/> <source>Save As</source> <translation>Shrani kot</translation> </message> <message> - <location filename="../src/gui/itemviews/qfileiconprovider.cpp" line="+441"/> + <location filename="../src/gui/itemviews/qfileiconprovider.cpp" line="+461"/> <source>Drive</source> <translation>Pogon</translation> </message> @@ -1918,50 +1859,50 @@ Ali jo kljub temu želite izbrisati?</translation> <name>QFontDatabase</name> <message> <location filename="../src/gui/text/qfontdatabase.cpp" line="+102"/> - <location line="+1330"/> + <location line="+1335"/> <source>Normal</source> <translation>Normalno</translation> </message> <message> - <location line="-1327"/> + <location line="-1332"/> <location line="+12"/> - <location line="+1303"/> + <location line="+1308"/> <source>Bold</source> <translation>Polkrepko</translation> </message> <message> - <location line="-1312"/> - <location line="+1314"/> + <location line="-1317"/> + <location line="+1319"/> <source>Demi Bold</source> <translation type="unfinished"></translation> </message> <message> - <location line="-1311"/> + <location line="-1316"/> <location line="+18"/> - <location line="+1289"/> + <location line="+1294"/> <source>Black</source> <translation type="unfinished">Črni</translation> </message> <message> - <location line="-1299"/> + <location line="-1304"/> <source>Demi</source> <translation type="unfinished"></translation> </message> <message> <location line="+6"/> - <location line="+1299"/> + <location line="+1304"/> <source>Light</source> <translation>Lahko</translation> </message> <message> - <location line="-1153"/> - <location line="+1156"/> + <location line="-1158"/> + <location line="+1161"/> <source>Italic</source> <translation>Ležeče</translation> </message> <message> - <location line="-1153"/> - <location line="+1155"/> + <location line="-1158"/> + <location line="+1160"/> <source>Oblique</source> <translation>Nagnjeno</translation> </message> @@ -2063,32 +2004,32 @@ Ali jo kljub temu želite izbrisati?</translation> <message> <location line="+3"/> <source>Thai</source> - <translation type="unfinished">Tajski</translation> + <translation>Tajska</translation> </message> <message> <location line="+3"/> <source>Lao</source> - <translation type="unfinished">Laoška</translation> + <translation>Laoška</translation> </message> <message> <location line="+3"/> <source>Tibetan</source> - <translation type="unfinished">tibetansko</translation> + <translation>Tibetanska</translation> </message> <message> <location line="+3"/> <source>Myanmar</source> - <translation type="unfinished">Mjanmar</translation> + <translation>Mjanmarska</translation> </message> <message> <location line="+3"/> <source>Georgian</source> - <translation type="unfinished">gruzijsko</translation> + <translation>Gruzijska</translation> </message> <message> <location line="+3"/> <source>Khmer</source> - <translation type="unfinished">Kmersko</translation> + <translation>Kmerska</translation> </message> <message> <location line="+3"/> @@ -2118,7 +2059,7 @@ Ali jo kljub temu želite izbrisati?</translation> <message> <location line="+3"/> <source>Symbol</source> - <translation type="unfinished">Znak</translation> + <translation>Simbol</translation> </message> <message> <location line="+3"/> @@ -2134,7 +2075,7 @@ Ali jo kljub temu želite izbrisati?</translation> <context> <name>QFontDialog</name> <message> - <location filename="../src/gui/dialogs/qfontdialog.cpp" line="+774"/> + <location filename="../src/gui/dialogs/qfontdialog.cpp" line="+776"/> <source>&Font</source> <translation>&Pisava</translation> </message> @@ -2174,7 +2115,7 @@ Ali jo kljub temu želite izbrisati?</translation> <translation>S&istem pisanja</translation> </message> <message> - <location line="-607"/> + <location line="-609"/> <location line="+257"/> <source>Select Font</source> <translation>Izberite pisavo</translation> @@ -2337,13 +2278,9 @@ Ali jo kljub temu želite izbrisati?</translation> <context> <name>QHostInfoAgent</name> <message> - <location filename="../src/network/kernel/qhostinfo_unix.cpp" line="+178"/> - <location line="+9"/> - <location line="+80"/> + <location filename="../src/network/kernel/qhostinfo_unix.cpp" line="+257"/> <location line="+32"/> - <location filename="../src/network/kernel/qhostinfo_win.cpp" line="+165"/> - <location line="+9"/> - <location line="+56"/> + <location filename="../src/network/kernel/qhostinfo_win.cpp" line="+220"/> <location line="+27"/> <source>Host not found</source> <translation>Ni moč najti gostitelja</translation> @@ -2364,20 +2301,20 @@ Ali jo kljub temu želite izbrisati?</translation> <translation>Neznana napaka</translation> </message> <message> - <location filename="../src/network/kernel/qhostinfo_win.cpp" line="-71"/> + <location filename="../src/network/kernel/qhostinfo_win.cpp" line="-67"/> <source>No host name given</source> - <translation type="unfinished">Podano ni bilo nobeno ime gostitelja</translation> + <translation>Podano ni bilo nobeno ime gostitelja</translation> </message> <message> <location line="+0"/> <source>Invalid hostname</source> - <translation type="unfinished">Neveljavno ime gostitelja</translation> + <translation>Neveljavno ime gostitelja</translation> </message> </context> <context> <name>QHttp</name> <message> - <location filename="../src/network/access/qhttp.cpp" line="+1577"/> + <location filename="../src/network/access/qhttp.cpp" line="+1582"/> <location line="+820"/> <location filename="../src/qt3support/network/q3http.cpp" line="+1159"/> <location line="+567"/> @@ -2409,7 +2346,7 @@ Ali jo kljub temu želite izbrisati?</translation> <translation>Strežnik je nepričakovano prekinil povezavo</translation> </message> <message> - <location line="+179"/> + <location line="+200"/> <source>Unknown authentication method</source> <translation>Neznan način overjanja</translation> </message> @@ -2419,13 +2356,13 @@ Ali jo kljub temu želite izbrisati?</translation> <translation>Napaka pri pisanju odziva na napravo</translation> </message> <message> - <location filename="../src/network/access/qhttpnetworkconnection.cpp" line="+560"/> + <location filename="../src/network/access/qhttpnetworkconnection.cpp" line="+569"/> <location filename="../src/qt3support/network/q3http.cpp" line="+38"/> <source>Connection refused</source> <translation>Povezava je zavrnjena</translation> </message> <message> - <location filename="../src/network/access/qhttp.cpp" line="-304"/> + <location filename="../src/network/access/qhttp.cpp" line="-325"/> <location filename="../src/network/access/qhttpnetworkconnection.cpp" line="-4"/> <location filename="../src/qt3support/network/q3http.cpp" line="+3"/> <source>Host %1 not found</source> @@ -2440,7 +2377,7 @@ Ali jo kljub temu želite izbrisati?</translation> <translation>Zahtevek HTTP ni uspel</translation> </message> <message> - <location line="+73"/> + <location line="+94"/> <location filename="../src/qt3support/network/q3http.cpp" line="+69"/> <source>Invalid HTTP response header</source> <translation>Neveljavna glava odgovora HTTP</translation> @@ -2495,7 +2432,7 @@ Ali jo kljub temu želite izbrisati?</translation> <translation>Potrebna je overitev</translation> </message> <message> - <location line="-138"/> + <location line="-159"/> <source>Connection refused (or timed out)</source> <translation>Povezava je bila zavrnjena (ali pa je potekel čas)</translation> </message> @@ -2694,7 +2631,7 @@ Ali jo kljub temu želite izbrisati?</translation> <context> <name>QIODevice</name> <message> - <location filename="../src/corelib/global/qglobal.cpp" line="+2046"/> + <location filename="../src/corelib/global/qglobal.cpp" line="+2058"/> <source>Permission denied</source> <translation>Nimate dovoljenja</translation> </message> @@ -3174,7 +3111,7 @@ Ali jo kljub temu želite izbrisati?</translation> <context> <name>QMenuBar</name> <message> - <location filename="../src/gui/widgets/qmenu_symbian.cpp" line="+401"/> + <location filename="../src/gui/widgets/qmenu_symbian.cpp" line="+410"/> <source>Actions</source> <translation>Dejanja</translation> </message> @@ -3527,7 +3464,7 @@ Ali jo kljub temu želite izbrisati?</translation> <message> <location line="+59"/> <source>Unable to alloc statement</source> - <translation type="unfinished"></translation> + <translation>Ni moč dodeliti izjave</translation> </message> <message> <location line="+15"/> @@ -3553,7 +3490,7 @@ Ali jo kljub temu želite izbrisati?</translation> <context> <name>QODBCDriver</name> <message> - <location filename="../src/sql/drivers/odbc/qsql_odbc.cpp" line="+1783"/> + <location filename="../src/sql/drivers/odbc/qsql_odbc.cpp" line="+1790"/> <source>Unable to connect</source> <translation>Ni moč vzpostaviti povezave</translation> </message> @@ -3586,7 +3523,7 @@ Ali jo kljub temu želite izbrisati?</translation> <context> <name>QODBCResult</name> <message> - <location line="-926"/> + <location line="-932"/> <location line="+346"/> <source>QODBCResult::reset: Unable to set 'SQL_CURSOR_STATIC' as statement attribute. Please check your ODBC driver configuration</source> <translation>QODBCResult::reset: ni moč nastaviti 'SQL_CURSOR_STATIC' kot lastnosti izjave. Preverite nastavitve gonilnika ODBC</translation> @@ -3638,7 +3575,7 @@ Ali jo kljub temu želite izbrisati?</translation> <context> <name>QObject</name> <message> - <location filename="../src/network/kernel/qhostinfo_unix.cpp" line="-101"/> + <location filename="../src/network/kernel/qhostinfo_unix.cpp" line="-97"/> <source>Invalid hostname</source> <translation>Neveljavno ime gostitelja</translation> </message> @@ -3668,42 +3605,6 @@ Ali jo kljub temu želite izbrisati?</translation> <source>No host name given</source> <translation>Podano ni bilo nobeno ime gostitelja</translation> </message> - <message> - <location filename="../src/3rdparty/phonon/mmf/effectfactory.cpp" line="+60"/> - <source>audio equalizer</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+2"/> - <source>Bass boost</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+2"/> - <source>Distance Attenuation</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+2"/> - <location line="+2"/> - <source>Environmental Reverb</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+2"/> - <source>Loudness</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+2"/> - <source>Source Orientation</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+2"/> - <source>Stereo Widening</source> - <translation type="unfinished"></translation> - </message> </context> <context> <name>QPPDOptionsModel</name> @@ -4050,7 +3951,7 @@ Ali jo kljub temu želite izbrisati?</translation> <translation>US Common #10 Envelope (105 x 241 mm)</translation> </message> <message> - <location filename="../src/gui/dialogs/qprintdialog_win.cpp" line="+259"/> + <location filename="../src/gui/dialogs/qprintdialog_win.cpp" line="+266"/> <source>OK</source> <translation>V redu</translation> </message> @@ -4610,7 +4511,7 @@ Izberite drugo ime datoteke.</translation> <translation>Čas za dejanje procesa je potekel</translation> </message> <message> - <location filename="../src/corelib/io/qprocess.cpp" line="+851"/> + <location filename="../src/corelib/io/qprocess.cpp" line="+855"/> <location line="+52"/> <location filename="../src/corelib/io/qprocess_win.cpp" line="-211"/> <location line="+50"/> @@ -4826,32 +4727,32 @@ Izberite drugo ime datoteke.</translation> <message> <location filename="../src/scripttools/debugging/qscriptbreakpointsmodel.cpp" line="+455"/> <source>ID</source> - <translation type="unfinished"></translation> + <translation>ID</translation> </message> <message> <location line="+2"/> <source>Location</source> - <translation type="unfinished"></translation> + <translation>Lokacija</translation> </message> <message> <location line="+2"/> <source>Condition</source> - <translation type="unfinished"></translation> + <translation>Pogoj</translation> </message> <message> <location line="+2"/> <source>Ignore-count</source> - <translation type="unfinished"></translation> + <translation>Število prezrtij</translation> </message> <message> <location line="+2"/> <source>Single-shot</source> - <translation type="unfinished"></translation> + <translation>Enojen zadetek</translation> </message> <message> <location line="+2"/> <source>Hit-count</source> - <translation type="unfinished"></translation> + <translation>Število zadetkov</translation> </message> </context> <context> @@ -4859,12 +4760,12 @@ Izberite drugo ime datoteke.</translation> <message> <location filename="../src/scripttools/debugging/qscriptbreakpointswidget.cpp" line="+298"/> <source>New</source> - <translation type="unfinished"></translation> + <translation>Nova</translation> </message> <message> <location line="+6"/> <source>Delete</source> - <translation type="unfinished">Izbriši</translation> + <translation>Izbriši</translation> </message> </context> <context> @@ -4873,17 +4774,17 @@ Izberite drugo ime datoteke.</translation> <location filename="../src/scripttools/debugging/qscriptdebugger.cpp" line="+885"/> <location line="+1013"/> <source>Go to Line</source> - <translation type="unfinished"></translation> + <translation>Pojdi v vrstico</translation> </message> <message> <location line="-1012"/> <source>Line:</source> - <translation type="unfinished"></translation> + <translation>Vrstica:</translation> </message> <message> <location line="+791"/> <source>Interrupt</source> - <translation type="unfinished"></translation> + <translation>Prekini</translation> </message> <message> <location line="+2"/> @@ -4893,7 +4794,7 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+15"/> <source>Continue</source> - <translation type="unfinished">Nadaljuj</translation> + <translation>Nadaljuj</translation> </message> <message> <location line="+2"/> @@ -4903,7 +4804,7 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+15"/> <source>Step Into</source> - <translation type="unfinished"></translation> + <translation>Vstopi</translation> </message> <message> <location line="+2"/> @@ -4913,7 +4814,7 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+15"/> <source>Step Over</source> - <translation type="unfinished"></translation> + <translation>Prestopi</translation> </message> <message> <location line="+2"/> @@ -4923,7 +4824,7 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+15"/> <source>Step Out</source> - <translation type="unfinished"></translation> + <translation>Izstopi</translation> </message> <message> <location line="+2"/> @@ -4933,7 +4834,7 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+15"/> <source>Run to Cursor</source> - <translation type="unfinished"></translation> + <translation>Zaženi do kazalca</translation> </message> <message> <location line="+2"/> @@ -4943,12 +4844,12 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+16"/> <source>Run to New Script</source> - <translation type="unfinished"></translation> + <translation>Zaženi do novega skripta</translation> </message> <message> <location line="+15"/> <source>Toggle Breakpoint</source> - <translation type="unfinished"></translation> + <translation>Preklopi prekinitveno točko</translation> </message> <message> <location line="+1"/> @@ -4958,22 +4859,22 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+14"/> <source>Clear Debug Output</source> - <translation type="unfinished"></translation> + <translation>Počisti razhroščevalni izhod</translation> </message> <message> <location line="+13"/> <source>Clear Error Log</source> - <translation type="unfinished"></translation> + <translation>Počisti dnevnik napak</translation> </message> <message> <location line="+13"/> <source>Clear Console</source> - <translation type="unfinished"></translation> + <translation>Počisti konzolo</translation> </message> <message> <location line="+14"/> <source>&Find in Script...</source> - <translation type="unfinished"></translation> + <translation>Najdi v &skriptu ...</translation> </message> <message> <location line="+1"/> @@ -4983,7 +4884,7 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+17"/> <source>Find &Next</source> - <translation type="unfinished"></translation> + <translation>Najdi &naslednje</translation> </message> <message> <location line="+2"/> @@ -4993,7 +4894,7 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+13"/> <source>Find &Previous</source> - <translation type="unfinished"></translation> + <translation>Najdi &predhodno</translation> </message> <message> <location line="+2"/> @@ -5008,7 +4909,7 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+11"/> <source>Debug</source> - <translation type="unfinished"></translation> + <translation>Razhrošči</translation> </message> </context> <context> @@ -5016,32 +4917,32 @@ Izberite drugo ime datoteke.</translation> <message> <location filename="../src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp" line="+141"/> <source>Close</source> - <translation type="unfinished">Zapri</translation> + <translation>Zapri</translation> </message> <message> <location line="+13"/> <source>Previous</source> - <translation type="unfinished"></translation> + <translation>Predhodno</translation> </message> <message> <location line="+7"/> <source>Next</source> - <translation type="unfinished"></translation> + <translation>Naslednje</translation> </message> <message> <location line="+5"/> <source>Case Sensitive</source> - <translation type="unfinished"></translation> + <translation>Občutljivo na velikost črk</translation> </message> <message> <location line="+3"/> <source>Whole words</source> - <translation type="unfinished"></translation> + <translation>Cele besede</translation> </message> <message> <location line="+9"/> <source><img src=":/qt/scripttools/debugging/images/wrap.png">&nbsp;Search wrapped</source> - <translation type="unfinished"></translation> + <translation><img src=":/qt/scripttools/debugging/images/wrap.png">&nbsp;Iskanje se nadaljuje na drugem koncu</translation> </message> </context> <context> @@ -5049,12 +4950,12 @@ Izberite drugo ime datoteke.</translation> <message> <location filename="../src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp" line="+872"/> <source>Name</source> - <translation type="unfinished">Ime</translation> + <translation>Ime</translation> </message> <message> <location line="+2"/> <source>Value</source> - <translation type="unfinished">Vrednost</translation> + <translation>Vrednost</translation> </message> </context> <context> @@ -5062,17 +4963,17 @@ Izberite drugo ime datoteke.</translation> <message> <location filename="../src/scripttools/debugging/qscriptdebuggerstackmodel.cpp" line="+161"/> <source>Level</source> - <translation type="unfinished"></translation> + <translation>Stopnja</translation> </message> <message> <location line="+2"/> <source>Name</source> - <translation type="unfinished">Ime</translation> + <translation>Ime</translation> </message> <message> <location line="+2"/> <source>Location</source> - <translation type="unfinished"></translation> + <translation>Lokacija</translation> </message> </context> <context> @@ -5080,22 +4981,22 @@ Izberite drugo ime datoteke.</translation> <message> <location filename="../src/scripttools/debugging/qscriptedit.cpp" line="+411"/> <source>Toggle Breakpoint</source> - <translation type="unfinished"></translation> + <translation>Preklopi prekinitveno točko</translation> </message> <message> <location line="+2"/> <source>Disable Breakpoint</source> - <translation type="unfinished"></translation> + <translation>Onemogoči prekinitveno točko</translation> </message> <message> <location line="+1"/> <source>Enable Breakpoint</source> - <translation type="unfinished"></translation> + <translation>Omogoči prekinitveno točko</translation> </message> <message> <location line="+4"/> <source>Breakpoint Condition:</source> - <translation type="unfinished"></translation> + <translation>Pogoj za prelomno točko:</translation> </message> </context> <context> @@ -5103,52 +5004,52 @@ Izberite drugo ime datoteke.</translation> <message> <location filename="../src/scripttools/debugging/qscriptenginedebugger.cpp" line="+523"/> <source>Loaded Scripts</source> - <translation type="unfinished"></translation> + <translation>Naloženi skripti</translation> </message> <message> <location line="+6"/> <source>Breakpoints</source> - <translation type="unfinished"></translation> + <translation>Prelomne točke</translation> </message> <message> <location line="+6"/> <source>Stack</source> - <translation type="unfinished"></translation> + <translation>Sklad</translation> </message> <message> <location line="+6"/> <source>Locals</source> - <translation type="unfinished"></translation> + <translation>Krajevno</translation> </message> <message> <location line="+6"/> <source>Console</source> - <translation type="unfinished"></translation> + <translation>Konzola</translation> </message> <message> <location line="+6"/> <source>Debug Output</source> - <translation type="unfinished"></translation> + <translation>Razhroščevalni izhod</translation> </message> <message> <location line="+6"/> <source>Error Log</source> - <translation type="unfinished"></translation> + <translation>Dnevnik napak</translation> </message> <message> <location line="+12"/> <source>Search</source> - <translation type="unfinished">Išči</translation> + <translation>Išči</translation> </message> <message> <location line="+7"/> <source>View</source> - <translation type="unfinished"></translation> + <translation>Videz</translation> </message> <message> <location line="+18"/> <source>Qt Script Debugger</source> - <translation type="unfinished"></translation> + <translation>Razhroščevalnik za Qt Script</translation> </message> </context> <context> @@ -5156,7 +5057,7 @@ Izberite drugo ime datoteke.</translation> <message> <location filename="../src/scripttools/debugging/qscriptbreakpointswidget.cpp" line="-223"/> <source>Close</source> - <translation type="unfinished">Zapri</translation> + <translation>Zapri</translation> </message> </context> <context> @@ -5521,7 +5422,7 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+1"/> <source>Bass Boost</source> - <translation type="unfinished"></translation> + <translation>Ojačanje basov</translation> </message> <message> <location line="+1"/> @@ -5536,12 +5437,12 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+1"/> <source>Treble Up</source> - <translation type="unfinished"></translation> + <translation>Več visokih tonov</translation> </message> <message> <location line="+1"/> <source>Treble Down</source> - <translation type="unfinished"></translation> + <translation>Manj visokih tonov</translation> </message> <message> <location line="+1"/> @@ -5736,7 +5637,7 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+4"/> <source>Select</source> - <translation type="unfinished">Izberi</translation> + <translation>Izberi</translation> </message> <message> <location line="+1"/> @@ -5771,17 +5672,17 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+1"/> <source>Call</source> - <translation type="unfinished">Pokliči</translation> + <translation>Pokliči</translation> </message> <message> <location line="+1"/> <source>Hangup</source> - <translation type="unfinished">Odloži</translation> + <translation>Odloži</translation> </message> <message> <location line="+1"/> <source>Flip</source> - <translation type="unfinished">Obrni</translation> + <translation>Obrni</translation> </message> <message> <location line="+561"/> @@ -5954,7 +5855,7 @@ Izberite drugo ime datoteke.</translation> <message> <location line="+151"/> <source>Exit</source> - <translation type="unfinished">Končaj</translation> + <translation>Končaj</translation> </message> </context> <context> @@ -6176,7 +6077,7 @@ Izberite drugo ime datoteke.</translation> <context> <name>QTextControl</name> <message> - <location filename="../src/gui/text/qtextcontrol.cpp" line="+2001"/> + <location filename="../src/gui/text/qtextcontrol.cpp" line="+2007"/> <source>&Undo</source> <translation>&Razveljavi</translation> </message> @@ -6219,7 +6120,7 @@ Izberite drugo ime datoteke.</translation> <context> <name>QToolButton</name> <message> - <location filename="../src/plugins/accessible/widgets/simplewidgets.cpp" line="+254"/> + <location filename="../src/plugins/accessible/widgets/simplewidgets.cpp" line="+310"/> <location line="+6"/> <source>Press</source> <translation>Pritisni</translation> @@ -6334,12 +6235,12 @@ Izberite drugo ime datoteke.</translation> <context> <name>QWebFrame</name> <message> - <location filename="../src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp" line="+706"/> + <location filename="../src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp" line="+711"/> <source>Request cancelled</source> <translation>Zahtevek je bil preklican</translation> </message> <message> - <location line="+17"/> + <location line="+19"/> <source>Request blocked</source> <translation>Zahtevek je bil blokiran</translation> </message> @@ -6367,12 +6268,12 @@ Izberite drugo ime datoteke.</translation> <context> <name>QWebPage</name> <message> - <location filename="../src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp" line="+403"/> + <location filename="../src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp" line="+406"/> <source>Bad HTTP request</source> <translation>Napačen zahtevek HTTP</translation> </message> <message> - <location filename="../src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp" line="+41"/> + <location filename="../src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp" line="+42"/> <source>Submit</source> <comment>default label for Submit buttons in forms on web pages</comment> <translation>Pošlji</translation> @@ -6390,7 +6291,7 @@ Izberite drugo ime datoteke.</translation> <translation>Ponastavi</translation> </message> <message> - <location line="+10"/> + <location line="+11"/> <source>This is a searchable index. Enter search keywords: </source> <comment>text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'</comment> <translation>To je stvarno kazalo z iskanjem. Vnesite iskane besede: </translation> @@ -6777,7 +6678,7 @@ Izberite drugo ime datoteke.</translation> <location line="+2"/> <source>Movie time scrubber</source> <comment>Media controller element</comment> - <translation type="unfinished"></translation> + <translation></translation> </message> <message> <location line="+2"/> @@ -6805,7 +6706,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <location line="+2"/> - <source>Remaining move time</source> + <source>Remaining movie time</source> <comment>Media controller element</comment> <translation>Preostali čas filma</translation> </message> @@ -6900,7 +6801,7 @@ Izberite drugo ime datoteke.</translation> <translation>%1 (%2×%3 pik)</translation> </message> <message> - <location filename="../src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp" line="+170"/> + <location filename="../src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp" line="+167"/> <source>Web Inspector - %2</source> <translation>Web Inspector - %2</translation> </message> @@ -6974,24 +6875,24 @@ Izberite drugo ime datoteke.</translation> <source>%n file(s)</source> <comment>number of chosen file</comment> <translation> - <numerusform>%n datotek</numerusform> - <numerusform>%n datotek</numerusform> - <numerusform>%n datotek</numerusform> + <numerusform>%n datoteka</numerusform> + <numerusform>%n datoteki</numerusform> + <numerusform>%n datoteke</numerusform> <numerusform>%n datotek</numerusform> </translation> </message> <message> - <location filename="../src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp" line="+1601"/> + <location filename="../src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp" line="+1708"/> <source>JavaScript Alert - %1</source> <translation>Opozorilo JavaScript - %1</translation> </message> <message> - <location line="+15"/> + <location line="+16"/> <source>JavaScript Confirm - %1</source> <translation>Potrditev JavaScript - %1</translation> </message> <message> - <location line="+17"/> + <location line="+18"/> <source>JavaScript Prompt - %1</source> <translation>Poziv JavaScript - %1</translation> </message> @@ -7006,7 +6907,7 @@ Izberite drugo ime datoteke.</translation> <translation>Kot kaže ima skript na tej strani težavo. Ali želite ustaviti skript?</translation> </message> <message> - <location line="+381"/> + <location line="+383"/> <source>Move the cursor to the next character</source> <translation>Premakni kazalec na naslednji znak</translation> </message> @@ -7215,6 +7116,12 @@ Izberite drugo ime datoteke.</translation> <source>Align Right</source> <translation>Poravnaj desno</translation> </message> + <message> + <location filename="Obsolete_PO_entries"/> + <source>Remaining move time</source> + <comment>Media controller element</comment> + <translation type="obsolete">Preostali čas filma</translation> + </message> </context> <context> <name>QWhatsThisAction</name> @@ -7227,7 +7134,7 @@ Izberite drugo ime datoteke.</translation> <context> <name>QWidget</name> <message> - <location filename="../src/gui/kernel/qwidget.cpp" line="+5655"/> + <location filename="../src/gui/kernel/qwidget.cpp" line="+5672"/> <source>*</source> <translation>*</translation> </message> @@ -7902,20 +7809,20 @@ Izberite drugo ime datoteke.</translation> <location filename="../src/xmlpatterns/functions/qabstractfunctionfactory.cpp" line="+77"/> <source>%1 takes at most %n argument(s). %2 is therefore invalid.</source> <translation> + <numerusform>%1 potrebuje največ %n argument. %2 zato ni veljavno.</numerusform> + <numerusform>%1 potrebuje največ %n argumenta. %2 zato ni veljavno.</numerusform> + <numerusform>%1 potrebuje največ %n argumente. %2 zato ni veljavno.</numerusform> <numerusform>%1 potrebuje največ %n argumentov. %2 zato ni veljavno.</numerusform> - <numerusform></numerusform> - <numerusform></numerusform> - <numerusform></numerusform> </translation> </message> <message numerus="yes"> <location line="+11"/> <source>%1 requires at least %n argument(s). %2 is therefore invalid.</source> <translation> + <numerusform>%1 potrebuje najmanj %n argument. %2 zato ni veljavno.</numerusform> + <numerusform>%1 potrebuje najmanj %n argumenta. %2 zato ni veljavno.</numerusform> + <numerusform>%1 potrebuje najmanj %n argumente. %2 zato ni veljavno.</numerusform> <numerusform>%1 potrebuje najmanj %n argumentov. %2 zato ni veljavno.</numerusform> - <numerusform></numerusform> - <numerusform></numerusform> - <numerusform></numerusform> </translation> </message> <message> @@ -8613,277 +8520,207 @@ Izberite drugo ime datoteke.</translation> <translation type="unfinished"></translation> </message> <message> - <location filename="../src/xmlpatterns/schema/qxsdparticlechecker.cpp" line="+165"/> - <source>empty particle cannot be derived from non-empty particle</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+15"/> - <source>derived particle is missing element %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>derived element %1 is missing value constraint as defined in base particle</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+5"/> - <source>derived element %1 has weaker value constraint than base particle</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>fixed value constraint of element %1 differs from value constraint in base particle</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>derived element %1 cannot be nillable as base element is not nillable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+10"/> - <source>block constraints of derived element %1 must not be more weaker than in the base element</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+11"/> - <source>simple type of derived element %1 cannot be validly derived from base element</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+5"/> - <source>complex type of derived element %1 cannot be validly derived from base element</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+24"/> - <source>element %1 is missing in derived particle</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+18"/> - <source>element %1 does not match namespace constraint of wildcard in base particle</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+11"/> - <source>wildcard in derived particle is not a valid subset of wildcard in base particle</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+5"/> - <source>processContent of wildcard in derived particle is weaker than wildcard in base particle</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+240"/> - <source>derived particle allows content that is not allowed in the base particle</source> - <translation type="unfinished"></translation> - </message> - <message> <location filename="../src/xmlpatterns/schema/qxsdschemachecker.cpp" line="+227"/> - <source>%1 has inheritance loop in its base type %2</source> + <source>%1 has inheritance loop in its base type %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <location line="+24"/> - <source>circular inheritance of base type %1</source> + <source>Circular inheritance of base type %1.</source> <translation type="unfinished"></translation> </message> <message> <location line="+11"/> - <source>circular inheritance of union %1</source> + <source>Circular inheritance of union %1.</source> <translation type="unfinished"></translation> </message> <message> <location line="+25"/> - <source>%1 is not allowed to derive from %2 by restriction as the latter defines it as final</source> + <source>%1 is not allowed to derive from %2 by restriction as the latter defines it as final.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> - <source>%1 is not allowed to derive from %2 by extension as the latter defines it as final</source> + <source>%1 is not allowed to derive from %2 by extension as the latter defines it as final.</source> <translation type="unfinished"></translation> </message> <message> <location line="+31"/> - <source>base type of simple type %1 cannot be complex type %2</source> + <source>Base type of simple type %1 cannot be complex type %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> - <source>simple type %1 cannot have direct base type %2</source> + <source>Simple type %1 cannot have direct base type %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+33"/> <location line="+9"/> - <source>simple type %1 is not allowed to have base type %2</source> + <source>Simple type %1 is not allowed to have base type %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+12"/> - <source>simple type %1 can only have simple atomic type as base type</source> + <source>Simple type %1 can only have simple atomic type as base type.</source> <translation type="unfinished"></translation> </message> <message> <location line="+6"/> - <source>simple type %1 cannot derive from %2 as the latter defines restriction as final</source> + <source>Simple type %1 cannot derive from %2 as the latter defines restriction as final.</source> <translation type="unfinished"></translation> </message> <message> <location line="+13"/> <location line="+484"/> - <source>variety of item type of %1 must be either atomic or union</source> + <source>Variety of item type of %1 must be either atomic or union.</source> <translation type="unfinished"></translation> </message> <message> <location line="-474"/> <location line="+483"/> - <source>variety of member types of %1 must be atomic</source> + <source>Variety of member types of %1 must be atomic.</source> <translation type="unfinished"></translation> </message> <message> <location line="-470"/> <location line="+451"/> - <source>%1 is not allowed to derive from %2 by list as the latter defines it as final</source> + <source>%1 is not allowed to derive from %2 by list as the latter defines it as final.</source> <translation type="unfinished"></translation> </message> <message> <location line="-431"/> - <source>simple type %1 is only allowed to have %2 facet</source> + <source>Simple type %1 is only allowed to have %2 facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+10"/> - <source>base type of simple type %1 must have variety of type list</source> + <source>Base type of simple type %1 must have variety of type list.</source> <translation type="unfinished"></translation> </message> <message> <location line="+6"/> - <source>base type of simple type %1 has defined derivation by restriction as final</source> + <source>Base type of simple type %1 has defined derivation by restriction as final.</source> <translation type="unfinished"></translation> </message> <message> <location line="+6"/> - <source>item type of base type does not match item type of %1</source> + <source>Item type of base type does not match item type of %1.</source> <translation type="unfinished"></translation> </message> <message> <location line="+26"/> <location line="+93"/> - <source>simple type %1 contains not allowed facet type %2</source> + <source>Simple type %1 contains not allowed facet type %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="-72"/> <location line="+413"/> - <source>%1 is not allowed to derive from %2 by union as the latter defines it as final</source> + <source>%1 is not allowed to derive from %2 by union as the latter defines it as final.</source> <translation type="unfinished"></translation> </message> <message> <location line="-404"/> - <source>%1 is not allowed to have any facets</source> + <source>%1 is not allowed to have any facets.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>base type %1 of simple type %2 must have variety of union</source> + <source>Base type %1 of simple type %2 must have variety of union.</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> - <source>base type %1 of simple type %2 is not allowed to have restriction in %3 attribute</source> + <source>Base type %1 of simple type %2 is not allowed to have restriction in %3 attribute.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>member type %1 cannot be derived from member type %2 of %3's base type %4</source> + <source>Member type %1 cannot be derived from member type %2 of %3's base type %4.</source> <translation type="unfinished"></translation> </message> <message> <location line="+65"/> - <source>derivation method of %1 must be extension because the base type %2 is a simple type</source> + <source>Derivation method of %1 must be extension because the base type %2 is a simple type.</source> <translation type="unfinished"></translation> </message> <message> <location line="+30"/> - <source>complex type %1 has duplicated element %2 in its content model</source> + <source>Complex type %1 has duplicated element %2 in its content model.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>complex type %1 has non-deterministic content</source> + <source>Complex type %1 has non-deterministic content.</source> <translation type="unfinished"></translation> </message> <message> <location line="+21"/> - <source>attributes of complex type %1 are not a valid extension of the attributes of base type %2: %3</source> + <source>Attributes of complex type %1 are not a valid extension of the attributes of base type %2: %3.</source> <translation type="unfinished"></translation> </message> <message> <location line="+37"/> - <source>content model of complex type %1 is not a valid extension of content model of %2</source> + <source>Content model of complex type %1 is not a valid extension of content model of %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+10"/> - <source>complex type %1 must have simple content</source> + <source>Complex type %1 must have simple content.</source> <translation type="unfinished"></translation> </message> <message> <location line="+7"/> - <source>complex type %1 must have the same simple type as its base class %2</source> + <source>Complex type %1 must have the same simple type as its base class %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+67"/> - <source>complex type %1 cannot be derived from base type %2%3</source> + <source>Complex type %1 cannot be derived from base type %2%3.</source> <translation type="unfinished"></translation> </message> <message> <location line="+14"/> - <source>attributes of complex type %1 are not a valid restriction from the attributes of base type %2: %3</source> + <source>Attributes of complex type %1 are not a valid restriction from the attributes of base type %2: %3.</source> <translation type="unfinished"></translation> </message> <message> <location line="+14"/> - <source>complex type %1 with simple content cannot be derived from complex base type %2</source> + <source>Complex type %1 with simple content cannot be derived from complex base type %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+35"/> - <source>item type of simple type %1 cannot be a complex type</source> + <source>Item type of simple type %1 cannot be a complex type.</source> <translation type="unfinished"></translation> </message> <message> <location line="+44"/> - <source>member type of simple type %1 cannot be a complex type</source> + <source>Member type of simple type %1 cannot be a complex type.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>%1 is not allowed to have a member type with the same name as itself</source> + <source>%1 is not allowed to have a member type with the same name as itself.</source> <translation type="unfinished"></translation> </message> <message> <location line="+83"/> <location line="+29"/> <location line="+34"/> - <source>%1 facet collides with %2 facet</source> + <source>%1 facet collides with %2 facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="-20"/> - <source>%1 facet must have the same value as %2 facet of base type</source> + <source>%1 facet must have the same value as %2 facet of base type.</source> <translation type="unfinished"></translation> </message> <message> <location line="+37"/> - <source>%1 facet must be equal or greater than %2 facet of base type</source> + <source>%1 facet must be equal or greater than %2 facet of base type.</source> <translation type="unfinished"></translation> </message> <message> @@ -8895,7 +8732,7 @@ Izberite drugo ime datoteke.</translation> <location line="+58"/> <location line="+34"/> <location line="+35"/> - <source>%1 facet must be less than or equal to %2 facet of base type</source> + <source>%1 facet must be less than or equal to %2 facet of base type.</source> <translation type="unfinished"></translation> </message> <message> @@ -8905,225 +8742,225 @@ Izberite drugo ime datoteke.</translation> </message> <message> <location line="+15"/> - <source>unknown notation %1 used in %2 facet</source> + <source>Unknown notation %1 used in %2 facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+20"/> - <source>%1 facet contains invalid value %2: %3</source> + <source>%1 facet contains invalid value %2: %3.</source> <translation type="unfinished"></translation> </message> <message> <location line="+22"/> - <source>%1 facet cannot be %2 or %3 if %4 facet of base type is %5</source> + <source>%1 facet cannot be %2 or %3 if %4 facet of base type is %5.</source> <translation type="unfinished"></translation> </message> <message> <location line="+11"/> - <source>%1 facet cannot be %2 if %3 facet of base type is %4</source> + <source>%1 facet cannot be %2 if %3 facet of base type is %4.</source> <translation type="unfinished"></translation> </message> <message> <location line="+20"/> <location line="+55"/> <location line="+230"/> - <source>%1 facet must be less than or equal to %2 facet</source> + <source>%1 facet must be less than or equal to %2 facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="-257"/> <location line="+134"/> <location line="+82"/> - <source>%1 facet must be less than %2 facet of base type</source> + <source>%1 facet must be less than %2 facet of base type.</source> <translation type="unfinished"></translation> </message> <message> <location line="-201"/> <location line="+79"/> - <source>%1 facet and %2 facet cannot appear together</source> + <source>%1 facet and %2 facet cannot appear together.</source> <translation type="unfinished"></translation> </message> <message> <location line="-27"/> <location line="+12"/> <location line="+113"/> - <source>%1 facet must be greater than %2 facet of base type</source> + <source>%1 facet must be greater than %2 facet of base type.</source> <translation type="unfinished"></translation> </message> <message> <location line="-86"/> <location line="+58"/> - <source>%1 facet must be less than %2 facet</source> + <source>%1 facet must be less than %2 facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="-42"/> <location line="+58"/> - <source>%1 facet must be greater than or equal to %2 facet of base type</source> + <source>%1 facet must be greater than or equal to %2 facet of base type.</source> <translation type="unfinished"></translation> </message> <message> <location line="+113"/> - <source>simple type contains not allowed facet %1</source> + <source>Simple type contains not allowed facet %1.</source> <translation type="unfinished"></translation> </message> <message> <location line="+12"/> - <source>%1, %2, %3, %4, %5 and %6 facets are not allowed when derived by list</source> + <source>%1, %2, %3, %4, %5 and %6 facets are not allowed when derived by list.</source> <translation type="unfinished"></translation> </message> <message> <location line="+16"/> - <source>only %1 and %2 facets are allowed when derived by union</source> + <source>Only %1 and %2 facets are allowed when derived by union.</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <location line="+16"/> - <source>%1 contains %2 facet with invalid data: %3</source> + <source>%1 contains %2 facet with invalid data: %3.</source> <translation type="unfinished"></translation> </message> <message> <location line="+24"/> - <source>attribute group %1 contains attribute %2 twice</source> - <translation>skupina lastnosti %1 dvakrat vsebuje lastnost %2</translation> + <source>Attribute group %1 contains attribute %2 twice.</source> + <translation>Skupina lastnosti %1 dvakrat vsebuje lastnost %2.</translation> </message> <message> <location line="+9"/> - <source>attribute group %1 contains two different attributes that both have types derived from %2</source> + <source>Attribute group %1 contains two different attributes that both have types derived from %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>attribute group %1 contains attribute %2 that has value constraint but type that inherits from %3</source> + <source>Attribute group %1 contains attribute %2 that has value constraint but type that inherits from %3.</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> - <source>complex type %1 contains attribute %2 twice</source> - <translation>kompleksna vrsta %1 dvakrat vsebuje lastnost %2</translation> + <source>Complex type %1 contains attribute %2 twice.</source> + <translation>Kompleksna vrsta %1 dvakrat vsebuje lastnost %2.</translation> </message> <message> <location line="+9"/> - <source>complex type %1 contains two different attributes that both have types derived from %2</source> + <source>Complex type %1 contains two different attributes that both have types derived from %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>complex type %1 contains attribute %2 that has value constraint but type that inherits from %3</source> + <source>Complex type %1 contains attribute %2 that has value constraint but type that inherits from %3.</source> <translation type="unfinished"></translation> </message> <message> <location line="+43"/> - <source>element %1 is not allowed to have a value constraint if its base type is complex</source> + <source>Element %1 is not allowed to have a value constraint if its base type is complex.</source> <translation type="unfinished"></translation> </message> <message> <location line="+7"/> - <source>element %1 is not allowed to have a value constraint if its type is derived from %2</source> + <source>Element %1 is not allowed to have a value constraint if its type is derived from %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+10"/> <location line="+11"/> - <source>value constraint of element %1 is not of elements type: %2</source> + <source>Value constraint of element %1 is not of elements type: %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+13"/> - <source>element %1 is not allowed to have substitution group affiliation as it is no global element</source> + <source>Element %1 is not allowed to have substitution group affiliation as it is no global element.</source> <translation type="unfinished"></translation> </message> <message> <location line="+28"/> - <source>type of element %1 cannot be derived from type of substitution group affiliation</source> + <source>Type of element %1 cannot be derived from type of substitution group affiliation.</source> <translation type="unfinished"></translation> </message> <message> <location line="+41"/> - <source>value constraint of attribute %1 is not of attributes type: %2</source> + <source>Value constraint of attribute %1 is not of attributes type: %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> - <source>attribute %1 has value constraint but has type derived from %2</source> + <source>Attribute %1 has value constraint but has type derived from %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+56"/> - <source>%1 attribute in derived complex type must be %2 like in base type</source> + <source>%1 attribute in derived complex type must be %2 like in base type.</source> <translation type="unfinished"></translation> </message> <message> <location line="+11"/> - <source>attribute %1 in derived complex type must have %2 value constraint like in base type</source> + <source>Attribute %1 in derived complex type must have %2 value constraint like in base type.</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> - <source>attribute %1 in derived complex type must have the same %2 value constraint like in base type</source> + <source>Attribute %1 in derived complex type must have the same %2 value constraint like in base type.</source> <translation type="unfinished"></translation> </message> <message> <location line="+7"/> - <source>attribute %1 in derived complex type must have %2 value constraint</source> + <source>Attribute %1 in derived complex type must have %2 value constraint.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>processContent of base wildcard must be weaker than derived wildcard</source> + <source>processContent of base wildcard must be weaker than derived wildcard.</source> <translation type="unfinished"></translation> </message> <message> <location line="+39"/> <location line="+15"/> - <source>element %1 exists twice with different types</source> - <translation>element %1 obstaja dvakrat, z različnima vrstama</translation> + <source>Element %1 exists twice with different types.</source> + <translation>Element %1 obstaja dvakrat, z različnima vrstama.</translation> </message> <message> <location line="+28"/> - <source>particle contains non-deterministic wildcards</source> + <source>Particle contains non-deterministic wildcards.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../src/xmlpatterns/schema/qxsdschemahelper.cpp" line="+691"/> <location line="+63"/> - <source>base attribute %1 is required but derived attribute is not</source> + <source>Base attribute %1 is required but derived attribute is not.</source> <translation type="unfinished"></translation> </message> <message> <location line="-57"/> - <source>type of derived attribute %1 cannot be validly derived from type of base attribute</source> + <source>Type of derived attribute %1 cannot be validly derived from type of base attribute.</source> <translation type="unfinished"></translation> </message> <message> <location line="+28"/> - <source>value constraint of derived attribute %1 does not match value constraint of base attribute</source> + <source>Value constraint of derived attribute %1 does not match value constraint of base attribute.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> - <source>derived attribute %1 does not exists in the base definition</source> + <source>Derived attribute %1 does not exists in the base definition.</source> <translation type="unfinished"></translation> </message> <message> <location line="+11"/> - <source>derived attribute %1 does not match the wildcard in the base definition</source> + <source>Derived attribute %1 does not match the wildcard in the base definition.</source> <translation type="unfinished"></translation> </message> <message> <location line="+17"/> - <source>base attribute %1 is required but missing in derived definition</source> + <source>Base attribute %1 is required but missing in derived definition.</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> - <source>derived definition contains an %1 element that does not exists in the base definition</source> + <source>Derived definition contains an %1 element that does not exists in the base definition</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> - <source>derived wildcard is not a subset of the base wildcard</source> + <source>Derived wildcard is not a subset of the base wildcard.</source> <translation type="unfinished"></translation> </message> <message> @@ -9133,905 +8970,1255 @@ Izberite drugo ime datoteke.</translation> </message> <message> <location line="+23"/> - <source>attribute %1 from base type is missing in derived type</source> + <source>Attribute %1 from base type is missing in derived type.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> - <source>type of derived attribute %1 differs from type of base attribute</source> + <source>Type of derived attribute %1 differs from type of base attribute.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>base definition contains an %1 element that is missing in the derived definition</source> + <source>Base definition contains an %1 element that is missing in the derived definition</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../src/xmlpatterns/schema/qxsdschemaparser.cpp" line="+169"/> - <source>can not process unknown element %1, expected elements are: %2</source> - <translation>ni moč obdelati neznanega elementa %1, pričakovani elementi so: %2</translation> + <location filename="../src/xmlpatterns/schema/qxsdschemaresolver.cpp" line="+354"/> + <source>%1 references unknown %2 or %3 element %4.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+13"/> - <source>element %1 is not allowed in this scope, possible elements are: %2</source> - <translation>element %1 v tem obsegu ni dovoljen, možni elementi so: %2</translation> + <location line="+10"/> + <source>%1 references identity constraint %2 that is no %3 or %4 element.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+16"/> - <source>child element is missing in that scope, possible child elements are: %1</source> - <translation>v tem obsegu manjka podelement, možni podelementi so: %1</translation> + <location line="+10"/> + <source>%1 has a different number of fields from the identity constraint %2 that it references.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+127"/> - <source>document is not a XML schema</source> - <translation>dokument ni shema XML</translation> + <location line="+23"/> + <source>Base type %1 of %2 element cannot be resolved.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+22"/> - <source>%1 attribute of %2 element contains invalid content: {%3} is not a value of type %4</source> - <translation>lastnost %1 elementa %2 vsebuje neveljavno vsebino: {%3} ni vrednost vrste %4</translation> + <location line="+84"/> + <source>Item type %1 of %2 element cannot be resolved.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+6"/> - <source>%1 attribute of %2 element contains invalid content: {%3}</source> - <translation>lastnost %1 elementa %2 vsebuje neveljavno vsebino: {%3}</translation> + <location line="+31"/> + <source>Member type %1 of %2 element cannot be resolved.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+26"/> - <source>target namespace %1 of included schema is different from the target namespace %2 as defined by the including schema</source> + <location line="+28"/> + <location line="+408"/> + <location line="+30"/> + <source>Type %1 of %2 element cannot be resolved.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+14"/> - <location line="+11"/> - <source>target namespace %1 of imported schema is different from the target namespace %2 as defined by the importing schema</source> + <location line="-416"/> + <source>Base type %1 of complex type cannot be resolved.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+237"/> - <source>%1 element is not allowed to have the same %2 attribute value as the target namespace %3</source> + <location line="+9"/> + <source>%1 cannot have complex base type that has a %2.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+8"/> - <source>%1 element without %2 attribute is not allowed inside schema without target namespace</source> + <location line="+279"/> + <source>Content model of complex type %1 contains %2 element so it cannot be derived by extension from a non-empty type.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+833"/> - <location line="+158"/> - <source>%1 element is not allowed inside %2 element if %3 attribute is present</source> - <translation>element %1 znotraj elementa %2 ni dovoljen, če je prisotna lastnost %3</translation> + <location line="+6"/> + <source>Complex type %1 cannot be derived by extension from %2 as the latter contains %3 element in its content model.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="-97"/> - <location line="+119"/> - <location line="+92"/> - <source>%1 element has neither %2 attribute nor %3 child element</source> - <translation>element %1 nima niti lastnosti %2 niti podelementa %3</translation> + <location line="+101"/> + <source>Type of %1 element must be a simple type, %2 is not.</source> + <translation>Vrsta elementa %1 mora biti preprosta, %2 to ni.</translation> </message> <message> - <location line="+835"/> - <location line="+1474"/> - <location line="+232"/> - <location line="+7"/> - <location line="+260"/> - <location line="+17"/> - <location line="+258"/> - <location line="+6"/> - <location line="+17"/> - <location line="+6"/> - <location line="+17"/> - <location line="+11"/> - <location line="+11"/> - <location line="+11"/> - <source>%1 element with %2 child element must not have a %3 attribute</source> - <translation>element %1 s podelementom %2 ne sme imeti lastnosti %3</translation> + <location line="+62"/> + <source>Substitution group %1 of %2 element cannot be resolved.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="-1325"/> - <source>%1 attribute of %2 element must be %3 or %4</source> - <translation>lastnost %1 elementa %2 mora biti %3 ali %4</translation> + <location line="+9"/> + <source>Substitution group %1 has circular definition.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+36"/> - <source>%1 attribute of %2 element must have a value of %3</source> - <translation>lastnost %1 elementa %2 mora imeti vrednost %3</translation> + <location line="+120"/> + <location line="+7"/> + <source>Duplicated element names %1 in %2 element.</source> + <translation>Podvojeni imeni elementov %1 v elementu %2.</translation> </message> <message> - <location line="+7"/> - <location line="+34"/> - <source>%1 attribute of %2 element must have a value of %3 or %4</source> - <translation>lastnost %1 elementa %2 mora imeti vrednost %3 ali %4</translation> + <location line="+29"/> + <location line="+52"/> + <location line="+71"/> + <location line="+28"/> + <source>Reference %1 of %2 element cannot be resolved.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+319"/> - <location line="+129"/> - <location line="+9"/> - <location line="+7"/> - <location line="+7"/> - <location line="+327"/> - <location line="+203"/> - <location line="+6"/> - <location line="+6"/> - <location line="+6"/> - <location line="+6"/> - <location line="+6"/> - <location line="+6"/> - <location line="+77"/> - <source>%1 element must not have %2 and %3 attribute together</source> - <translation>element %1 hkrati ne sme imeti lastnosti %2 in %3</translation> + <location line="-138"/> + <source>Circular group reference for %1.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="-768"/> - <location line="+222"/> - <source>content of %1 attribute of %2 element must not be from namespace %3</source> - <translation>vsebina lastnosti %1 elementa %2 ne sme biti iz imenskega prostora %3</translation> + <location line="+16"/> + <source>%1 element is not allowed in this scope</source> + <translation>Element %1 v tem obsegu ni dovoljen</translation> </message> <message> - <location line="-215"/> - <location line="+222"/> - <source>%1 attribute of %2 element must not be %3</source> - <translation>lastnost %1 elementa %2 ne sme biti %3</translation> + <location line="+5"/> + <source>%1 element cannot have %2 attribute with value other than %3.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="-64"/> - <source>%1 attribute of %2 element must have the value %3 because the %4 attribute is set</source> + <location line="+8"/> + <source>%1 element cannot have %2 attribute with value other than %3 or %4.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+187"/> - <source>specifying use='prohibited' inside an attribute group has no effect</source> + <location line="+91"/> + <source>%1 or %2 attribute of reference %3 does not match with the attribute declaration %4.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+353"/> - <source>%1 element must have either %2 or %3 attribute</source> - <translation>element %1 mora imeti lastnost %2 ali %3</translation> + <location line="+25"/> + <source>Attribute group %1 has circular reference.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+554"/> - <source>%1 element must have either %2 attribute or %3 or %4 as child element</source> + <location line="+131"/> + <source>%1 attribute in %2 must have %3 use like in base type %4.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+55"/> - <source>%1 element requires either %2 or %3 attribute</source> - <translation>element %1 potrebuje vsaj lastnost %2 ali %3</translation> + <location line="+52"/> + <source>Attribute wildcard of %1 is not a valid restriction of attribute wildcard of base type %2.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+19"/> - <source>text or entity references not allowed inside %1 element</source> + <location line="+7"/> + <source>%1 has attribute wildcard but its base type %2 has not.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+41"/> - <location line="+112"/> - <source>%1 attribute of %2 element must contain %3, %4 or a list of URIs</source> + <location line="+26"/> + <source>Union of attribute wildcard of type %1 and attribute wildcard of its base type %2 is not expressible.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+126"/> - <source>%1 element is not allowed in this context</source> - <translation>element %1 v tem kontekstu ni dovoljen</translation> + <location line="+48"/> + <source>Enumeration facet contains invalid content: {%1} is not a value of type %2.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+53"/> - <source>%1 attribute of %2 element has larger value than %3 attribute</source> + <location line="+10"/> + <source>Namespace prefix of qualified name %1 is not defined.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+25"/> - <source>prefix of qualified name %1 is not defined</source> + <location line="+51"/> + <location line="+18"/> + <source>%1 element %2 is not a valid restriction of the %3 element it redefines: %4.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+65"/> - <location line="+61"/> - <source>%1 attribute of %2 element must either contain %3 or the other values</source> + <location filename="../src/xmlpatterns/schema/qxsdparticlechecker.cpp" line="+165"/> + <source>Empty particle cannot be derived from non-empty particle.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+131"/> - <source>component with id %1 has been defined previously</source> - <translation>komponenta z ID-jem %1 je že bila definirana</translation> + <location line="+15"/> + <source>Derived particle is missing element %1.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+17"/> - <source>element %1 already defined</source> - <translation>element %1 je že definiran</translation> + <location line="+7"/> + <source>Derived element %1 is missing value constraint as defined in base particle.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+11"/> - <source>attribute %1 already defined</source> - <translation>lastnost %1 je že definirana</translation> + <location line="+5"/> + <source>Derived element %1 has weaker value constraint than base particle.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+15"/> - <source>type %1 already defined</source> - <translation>vrsta %1 je že definirana</translation> + <location line="+7"/> + <source>Fixed value constraint of element %1 differs from value constraint in base particle.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+23"/> - <source>attribute group %1 already defined</source> - <translation>skupina lastnosti %1 je že definirana</translation> + <location line="+7"/> + <source>Derived element %1 cannot be nillable as base element is not nillable.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+11"/> - <source>element group %1 already defined</source> - <translation>skupina elementov %1 je že definirana</translation> + <location line="+10"/> + <source>Block constraints of derived element %1 must not be more weaker than in the base element.</source> + <translation type="unfinished"></translation> </message> <message> <location line="+11"/> - <source>notation %1 already defined</source> - <translation>zapis %1 je že definiran</translation> + <source>Simple type of derived element %1 cannot be validly derived from base element.</source> + <translation type="unfinished"></translation> </message> <message> - <location line="+11"/> - <source>identity constraint %1 already defined</source> + <location line="+5"/> + <source>Complex type of derived element %1 cannot be validly derived from base element.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+11"/> - <source>duplicated facets in simple type %1</source> + <location line="+24"/> + <source>Element %1 is missing in derived particle.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../src/xmlpatterns/schema/qxsdschemaresolver.cpp" line="+354"/> - <source>%1 references unknown %2 or %3 element %4</source> + <location line="+18"/> + <source>Element %1 does not match namespace constraint of wildcard in base particle.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+10"/> - <source>%1 references identity constraint %2 that is no %3 or %4 element</source> + <location line="+11"/> + <source>Wildcard in derived particle is not a valid subset of wildcard in base particle.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+10"/> - <source>%1 has a different number of fields from the identity constraint %2 that it references</source> + <location line="+5"/> + <source>processContent of wildcard in derived particle is weaker than wildcard in base particle.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+23"/> - <source>base type %1 of %2 element cannot be resolved</source> + <location line="+240"/> + <source>Derived particle allows content that is not allowed in the base particle.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+84"/> - <source>item type %1 of %2 element cannot be resolved</source> + <location filename="../src/xmlpatterns/schema/qxsdschemaparser.cpp" line="+170"/> + <source>Can not process unknown element %1, expected elements are: %2.</source> + <translation>Ni moč obdelati neznanega elementa %1, pričakovani elementi so: %2.</translation> + </message> + <message> + <location line="+13"/> + <source>Element %1 is not allowed in this scope, possible elements are: %2.</source> + <translation>Element %1 v tem obsegu ni dovoljen, možni elementi so: %2.</translation> + </message> + <message> + <location line="+16"/> + <source>Child element is missing in that scope, possible child elements are: %1.</source> + <translation>V tem obsegu manjka podelement, možni podelementi so: %1.</translation> + </message> + <message> + <location line="+127"/> + <source>Document is not a XML schema.</source> + <translation>Dokument ni shema XML.</translation> + </message> + <message> + <location line="+22"/> + <source>%1 attribute of %2 element contains invalid content: {%3} is not a value of type %4.</source> + <translation>Lastnost %1 elementa %2 vsebuje neveljavno vsebino: {%3} ni vrednost vrste %4.</translation> + </message> + <message> + <location line="+6"/> + <source>%1 attribute of %2 element contains invalid content: {%3}.</source> + <translation>Lastnost %1 elementa %2 vsebuje neveljavno vsebino: {%3}.</translation> + </message> + <message> + <location line="+26"/> + <source>Target namespace %1 of included schema is different from the target namespace %2 as defined by the including schema.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+31"/> - <source>member type %1 of %2 element cannot be resolved</source> + <location line="+14"/> + <location line="+11"/> + <source>Target namespace %1 of imported schema is different from the target namespace %2 as defined by the importing schema.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+28"/> - <location line="+408"/> - <location line="+30"/> - <source>type %1 of %2 element cannot be resolved</source> + <location line="+237"/> + <source>%1 element is not allowed to have the same %2 attribute value as the target namespace %3.</source> <translation type="unfinished"></translation> </message> <message> - <location line="-416"/> - <source>base type %1 of complex type cannot be resolved</source> + <location line="+8"/> + <source>%1 element without %2 attribute is not allowed inside schema without target namespace.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+9"/> - <source>%1 cannot have complex base type that has a %2</source> - <translation></translation> + <location line="+833"/> + <location line="+158"/> + <source>%1 element is not allowed inside %2 element if %3 attribute is present.</source> + <translation>Element %1 znotraj elementa %2 ni dovoljen, če je prisotna lastnost %3.</translation> </message> <message> - <location line="+279"/> - <source>content model of complex type %1 contains %2 element so it cannot be derived by extension from a non-empty type</source> - <translation type="unfinished"></translation> + <location line="-97"/> + <location line="+119"/> + <location line="+92"/> + <source>%1 element has neither %2 attribute nor %3 child element.</source> + <translation>Element %1 nima niti lastnosti %2 niti podelementa %3.</translation> </message> <message> + <location line="+835"/> + <location line="+1474"/> + <location line="+232"/> + <location line="+7"/> + <location line="+260"/> + <location line="+17"/> + <location line="+258"/> <location line="+6"/> - <source>complex type %1 cannot be derived by extension from %2 as the latter contains %3 element in its content model</source> - <translation type="unfinished"></translation> + <location line="+17"/> + <location line="+6"/> + <location line="+17"/> + <location line="+11"/> + <location line="+11"/> + <location line="+11"/> + <source>%1 element with %2 child element must not have a %3 attribute.</source> + <translation>Element %1 s podelementom %2 ne sme imeti lastnosti %3.</translation> </message> <message> - <location line="+101"/> - <source>type of %1 element must be a simple type, %2 is not</source> - <translation>vrsta elementa %1 mora biti preprosta, %2 to ni</translation> + <location line="-1325"/> + <source>%1 attribute of %2 element must be %3 or %4.</source> + <translation>Lastnost %1 elementa %2 mora biti %3 ali %4.</translation> </message> <message> - <location line="+62"/> - <source>substitution group %1 of %2 element cannot be resolved</source> - <translation type="unfinished"></translation> + <location line="+36"/> + <source>%1 attribute of %2 element must have a value of %3.</source> + <translation>Lastnost %1 elementa %2 mora imeti vrednost %3.</translation> </message> <message> - <location line="+9"/> - <source>substitution group %1 has circular definition</source> - <translation type="unfinished"></translation> + <location line="+7"/> + <location line="+34"/> + <source>%1 attribute of %2 element must have a value of %3 or %4.</source> + <translation>Lastnost %1 elementa %2 mora imeti vrednost %3 ali %4.</translation> </message> <message> - <location line="+120"/> + <location line="+319"/> + <location line="+129"/> + <location line="+9"/> <location line="+7"/> - <source>duplicated element names %1 in %2 element</source> - <translation>podvojeni imeni elementov %1 v elementu %2</translation> + <location line="+7"/> + <location line="+327"/> + <location line="+203"/> + <location line="+6"/> + <location line="+6"/> + <location line="+6"/> + <location line="+6"/> + <location line="+6"/> + <location line="+6"/> + <location line="+77"/> + <source>%1 element must not have %2 and %3 attribute together.</source> + <translation>Element %1 hkrati ne sme imeti lastnosti %2 in %3.</translation> </message> <message> - <location line="+29"/> - <location line="+52"/> - <location line="+71"/> - <location line="+28"/> - <source>reference %1 of %2 element cannot be resolved</source> + <location line="-768"/> + <location line="+222"/> + <source>Content of %1 attribute of %2 element must not be from namespace %3.</source> + <translation>Vsebina lastnosti %1 elementa %2 ne sme biti iz imenskega prostora %3.</translation> + </message> + <message> + <location line="-215"/> + <location line="+222"/> + <source>%1 attribute of %2 element must not be %3.</source> + <translation>Lastnost %1 elementa %2 ne sme biti %3.</translation> + </message> + <message> + <location line="-64"/> + <source>%1 attribute of %2 element must have the value %3 because the %4 attribute is set.</source> <translation type="unfinished"></translation> </message> <message> - <location line="-138"/> - <source>circular group reference for %1</source> + <location line="+187"/> + <source>Specifying use='prohibited' inside an attribute group has no effect.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+16"/> - <source>%1 element is not allowed in this scope</source> - <translation>element %1 v tem obsegu ni dovoljen</translation> + <location line="+353"/> + <source>%1 element must have either %2 or %3 attribute.</source> + <translation>Element %1 mora imeti lastnost %2 ali %3.</translation> </message> <message> - <location line="+5"/> - <source>%1 element cannot have %2 attribute with value other than %3</source> + <location line="+554"/> + <source>%1 element must have either %2 attribute or %3 or %4 as child element.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+8"/> - <source>%1 element cannot have %2 attribute with value other than %3 or %4</source> - <translation type="unfinished"></translation> + <location line="+55"/> + <source>%1 element requires either %2 or %3 attribute.</source> + <translation>Element %1 potrebuje vsaj lastnost %2 ali %3.</translation> </message> <message> - <location line="+91"/> - <source>%1 or %2 attribute of reference %3 does not match with the attribute declaration %4</source> + <location line="+19"/> + <source>Text or entity references not allowed inside %1 element</source> <translation type="unfinished"></translation> </message> <message> - <location line="+25"/> - <source>attribute group %1 has circular reference</source> + <location line="+41"/> + <location line="+112"/> + <source>%1 attribute of %2 element must contain %3, %4 or a list of URIs.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+131"/> - <source>%1 attribute in %2 must have %3 use like in base type %4</source> - <translation type="unfinished"></translation> + <location line="+126"/> + <source>%1 element is not allowed in this context.</source> + <translation>Element %1 v tem kontekstu ni dovoljen.</translation> </message> <message> - <location line="+52"/> - <source>attribute wildcard of %1 is not a valid restriction of attribute wildcard of base type %2</source> + <location line="+53"/> + <source>%1 attribute of %2 element has larger value than %3 attribute.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+7"/> - <source>%1 has attribute wildcard but its base type %2 has not</source> + <location line="+25"/> + <source>Prefix of qualified name %1 is not defined.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+26"/> - <source>union of attribute wildcard of type %1 and attribute wildcard of its base type %2 is not expressible</source> + <location line="+65"/> + <location line="+61"/> + <source>%1 attribute of %2 element must either contain %3 or the other values.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+48"/> - <source>enumeration facet contains invalid content: {%1} is not a value of type %2</source> - <translation type="unfinished"></translation> + <location line="+131"/> + <source>Component with id %1 has been defined previously.</source> + <translation>Komponenta z ID-jem %1 je že bila definirana.</translation> </message> <message> - <location line="+10"/> - <source>namespace prefix of qualified name %1 is not defined</source> + <location line="+17"/> + <source>Element %1 already defined.</source> + <translation>Element %1 je že definiran.</translation> + </message> + <message> + <location line="+11"/> + <source>Attribute %1 already defined.</source> + <translation>Lastnost %1 je že definirana.</translation> + </message> + <message> + <location line="+15"/> + <source>Type %1 already defined.</source> + <translation>Vrsta %1 je že definirana.</translation> + </message> + <message> + <location line="+23"/> + <source>Attribute group %1 already defined.</source> + <translation>Skupina lastnosti %1 je že definirana.</translation> + </message> + <message> + <location line="+11"/> + <source>Element group %1 already defined.</source> + <translation>Skupina elementov %1 je že definirana.</translation> + </message> + <message> + <location line="+11"/> + <source>Notation %1 already defined.</source> + <translation>Zapis %1 je že definiran.</translation> + </message> + <message> + <location line="+11"/> + <source>Identity constraint %1 already defined.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+51"/> - <location line="+18"/> - <source>%1 element %2 is not a valid restriction of the %3 element it redefines: %4</source> + <location line="+11"/> + <source>Duplicated facets in simple type %1.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../src/xmlpatterns/schema/qxsdtypechecker.cpp" line="+233"/> <location line="+7"/> <location line="+21"/> - <source>%1 is not valid according to %2</source> - <translation>%1 glede na %2 ni veljaven</translation> + <source>%1 is not valid according to %2.</source> + <translation>%1 glede na %2 ni veljaven.</translation> </message> <message> <location line="+167"/> - <source>string content does not match the length facet</source> + <source>String content does not match the length facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>string content does not match the minLength facet</source> + <source>String content does not match the minLength facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>string content does not match the maxLength facet</source> + <source>String content does not match the maxLength facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>string content does not match pattern facet</source> + <source>String content does not match pattern facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>string content is not listed in the enumeration facet</source> + <source>String content is not listed in the enumeration facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+17"/> - <source>signed integer content does not match the maxInclusive facet</source> + <source>Signed integer content does not match the maxInclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>signed integer content does not match the maxExclusive facet</source> + <source>Signed integer content does not match the maxExclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>signed integer content does not match the minInclusive facet</source> + <source>Signed integer content does not match the minInclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>signed integer content does not match the minExclusive facet</source> + <source>Signed integer content does not match the minExclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>signed integer content is not listed in the enumeration facet</source> + <source>Signed integer content is not listed in the enumeration facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>signed integer content does not match pattern facet</source> + <source>Signed integer content does not match pattern facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> - <source>signed integer content does not match in the totalDigits facet</source> + <source>Signed integer content does not match in the totalDigits facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+17"/> - <source>unsigned integer content does not match the maxInclusive facet</source> + <source>Unsigned integer content does not match the maxInclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>unsigned integer content does not match the maxExclusive facet</source> + <source>Unsigned integer content does not match the maxExclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>unsigned integer content does not match the minInclusive facet</source> + <source>Unsigned integer content does not match the minInclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>unsigned integer content does not match the minExclusive facet</source> + <source>Unsigned integer content does not match the minExclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>unsigned integer content is not listed in the enumeration facet</source> + <source>Unsigned integer content is not listed in the enumeration facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>unsigned integer content does not match pattern facet</source> + <source>Unsigned integer content does not match pattern facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> - <source>unsigned integer content does not match in the totalDigits facet</source> + <source>Unsigned integer content does not match in the totalDigits facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+17"/> - <source>double content does not match the maxInclusive facet</source> + <source>Double content does not match the maxInclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>double content does not match the maxExclusive facet</source> + <source>Double content does not match the maxExclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>double content does not match the minInclusive facet</source> + <source>Double content does not match the minInclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>double content does not match the minExclusive facet</source> + <source>Double content does not match the minExclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>double content is not listed in the enumeration facet</source> + <source>Double content is not listed in the enumeration facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>double content does not match pattern facet</source> + <source>Double content does not match pattern facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>decimal content does not match in the fractionDigits facet</source> + <source>Decimal content does not match in the fractionDigits facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> - <source>decimal content does not match in the totalDigits facet</source> + <source>Decimal content does not match in the totalDigits facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+14"/> - <source>date time content does not match the maxInclusive facet</source> + <source>Date time content does not match the maxInclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>date time content does not match the maxExclusive facet</source> + <source>Date time content does not match the maxExclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>date time content does not match the minInclusive facet</source> + <source>Date time content does not match the minInclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>date time content does not match the minExclusive facet</source> + <source>Date time content does not match the minExclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>date time content is not listed in the enumeration facet</source> + <source>Date time content is not listed in the enumeration facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>date time content does not match pattern facet</source> + <source>Date time content does not match pattern facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+15"/> - <source>duration content does not match the maxInclusive facet</source> + <source>Duration content does not match the maxInclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> - <source>duration content does not match the maxExclusive facet</source> + <source>Duration content does not match the maxExclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> - <source>duration content does not match the minInclusive facet</source> + <source>Duration content does not match the minInclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> - <source>duration content does not match the minExclusive facet</source> + <source>Duration content does not match the minExclusive facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>duration content is not listed in the enumeration facet</source> + <source>Duration content is not listed in the enumeration facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>duration content does not match pattern facet</source> + <source>Duration content does not match pattern facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+27"/> - <source>boolean content does not match pattern facet</source> + <source>Boolean content does not match pattern facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+17"/> - <source>binary content does not match the length facet</source> + <source>Binary content does not match the length facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>binary content does not match the minLength facet</source> + <source>Binary content does not match the minLength facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>binary content does not match the maxLength facet</source> + <source>Binary content does not match the maxLength facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>binary content is not listed in the enumeration facet</source> + <source>Binary content is not listed in the enumeration facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+27"/> - <source>invalid QName content: %1</source> - <translation>neveljavna vsebina QName: %1</translation> + <source>Invalid QName content: %1.</source> + <translation>Neveljavna vsebina QName: %1.</translation> </message> <message> <location line="+17"/> - <source>QName content is not listed in the enumeration facet</source> + <source>QName content is not listed in the enumeration facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>QName content does not match pattern facet</source> + <source>QName content does not match pattern facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+36"/> - <source>notation content is not listed in the enumeration facet</source> + <source>Notation content is not listed in the enumeration facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+19"/> - <source>list content does not match length facet</source> + <source>List content does not match length facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+7"/> - <source>list content does not match minLength facet</source> + <source>List content does not match minLength facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+7"/> - <source>list content does not match maxLength facet</source> + <source>List content does not match maxLength facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+90"/> - <source>list content is not listed in the enumeration facet</source> + <source>List content is not listed in the enumeration facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>list content does not match pattern facet</source> + <source>List content does not match pattern facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+39"/> - <source>union content is not listed in the enumeration facet</source> + <source>Union content is not listed in the enumeration facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>union content does not match pattern facet</source> + <source>Union content does not match pattern facet.</source> <translation type="unfinished"></translation> </message> <message> <location line="+15"/> - <source>data of type %1 are not allowed to be empty</source> - <translation>podatki vrste %1 ne smejo biti prazni</translation> + <source>Data of type %1 are not allowed to be empty.</source> + <translation>Podatki vrste %1 ne smejo biti prazni.</translation> </message> <message> <location filename="../src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp" line="+160"/> - <source>element %1 is missing child element</source> - <translation>elementu %1 manjka podelement</translation> + <source>Element %1 is missing child element.</source> + <translation>Elementu %1 manjka podelement.</translation> </message> <message> <location line="+16"/> - <source>there is one IDREF value with no corresponding ID: %1</source> + <source>There is one IDREF value with no corresponding ID: %1.</source> <translation type="unfinished"></translation> </message> <message> <location line="+27"/> - <source>loaded schema file is invalid</source> + <source>Loaded schema file is invalid.</source> <translation type="unfinished"></translation> </message> <message> <location line="+16"/> - <source>%1 contains invalid data</source> - <translation>%1 vsebuje neveljavne podatke</translation> + <source>%1 contains invalid data.</source> + <translation>%1 vsebuje neveljavne podatke.</translation> </message> <message> <location line="+13"/> - <source>xsi:schemaLocation namespace %1 has already appeared earlier in the instance document</source> + <source>xsi:schemaLocation namespace %1 has already appeared earlier in the instance document.</source> <translation type="unfinished"></translation> </message> <message> <location line="+22"/> - <source>xsi:noNamespaceSchemaLocation cannot appear after the first no-namespace element or attribute</source> + <source>xsi:noNamespaceSchemaLocation cannot appear after the first no-namespace element or attribute.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>no schema defined for validation</source> + <source>No schema defined for validation.</source> <translation type="unfinished"></translation> </message> <message> <location line="+10"/> - <source>no definition for element %1 available</source> - <translation>definicija za element %1 ni na voljo</translation> + <source>No definition for element %1 available.</source> + <translation>Definicija za element %1 ni na voljo.</translation> </message> <message> <location line="+18"/> <location line="+49"/> <location line="+142"/> - <source>specified type %1 is not known to the schema</source> + <source>Specified type %1 is not known to the schema.</source> <translation type="unfinished"></translation> </message> <message> <location line="-176"/> - <source>element %1 is not defined in this scope</source> - <translation>element %1 v tem obsegu ni definiran</translation> + <source>Element %1 is not defined in this scope.</source> + <translation>Element %1 v tem obsegu ni definiran.</translation> </message> <message> <location line="+43"/> - <source>declaration for element %1 does not exist</source> - <translation>deklaracija elementa %1 ne obstaja</translation> + <source>Declaration for element %1 does not exist.</source> + <translation>Deklaracija elementa %1 ne obstaja.</translation> </message> <message> <location line="+12"/> - <source>element %1 contains invalid content</source> - <translation>element %1 vsebuje neveljavno vsebino</translation> + <source>Element %1 contains invalid content.</source> + <translation>Element %1 vsebuje neveljavno vsebino.</translation> </message> <message> <location line="+73"/> - <source>element %1 is declared as abstract</source> - <translation>element %1 je deklariran kot abstrakten</translation> + <source>Element %1 is declared as abstract.</source> + <translation>Element %1 je deklariran kot abstrakten.</translation> </message> <message> <location line="+7"/> - <source>element %1 is not nillable</source> + <source>Element %1 is not nillable.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> - <source>attribute %1 contains invalid data: %2</source> - <translation type="unfinished"></translation> + <source>Attribute %1 contains invalid data: %2</source> + <translation>Lastnost %1 vsebuje neveljavne podatke: %2</translation> </message> <message> <location line="+8"/> - <source>element contains content although it is nillable</source> + <source>Element contains content although it is nillable.</source> <translation type="unfinished"></translation> </message> <message> <location line="+6"/> - <source>fixed value constrained not allowed if element is nillable</source> + <source>Fixed value constrained not allowed if element is nillable.</source> <translation type="unfinished"></translation> </message> <message> <location line="+32"/> - <source>specified type %1 is not validly substitutable with element type %2</source> + <source>Specified type %1 is not validly substitutable with element type %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> - <source>complex type %1 is not allowed to be abstract</source> - <translation>kompleksna vrsta %1 ne sme biti abstraktna</translation> + <source>Complex type %1 is not allowed to be abstract.</source> + <translation>Kompleksna vrsta %1 ne sme biti abstraktna.</translation> </message> <message> <location line="+21"/> - <source>element %1 contains not allowed attributes</source> - <translation>element %1 vsebuje nedovoljene lastnosti</translation> + <source>Element %1 contains not allowed attributes.</source> + <translation>Element %1 vsebuje nedovoljene lastnosti.</translation> </message> <message> <location line="+6"/> <location line="+97"/> - <source>element %1 contains not allowed child element</source> - <translation>element %1 vsebuje nedovoljen podelement</translation> + <source>Element %1 contains not allowed child element.</source> + <translation>Element %1 vsebuje nedovoljen podelement.</translation> </message> <message> <location line="-76"/> <location line="+93"/> - <source>content of element %1 does not match its type definition: %2</source> - <translation>vsebina elementa %1 ne ustreza zanj določeni vrsti: %2</translation> + <source>Content of element %1 does not match its type definition: %2.</source> + <translation>Vsebina elementa %1 ne ustreza zanj določeni vrsti: %2.</translation> </message> <message> <location line="-85"/> <location line="+92"/> <location line="+41"/> - <source>content of element %1 does not match defined value constraint</source> + <source>Content of element %1 does not match defined value constraint.</source> <translation type="unfinished"></translation> </message> <message> <location line="-73"/> - <source>element %1 contains not allowed child content</source> - <translation>element %1 vsebuje nedovoljeno vsebino v podelementih</translation> + <source>Element %1 contains not allowed child content.</source> + <translation>Element %1 vsebuje nedovoljeno vsebino v podelementih.</translation> </message> <message> <location line="+41"/> - <source>element %1 contains not allowed text content</source> - <translation>element %1 vsebuje nedovoljeno besedilno vsebino</translation> + <source>Element %1 contains not allowed text content.</source> + <translation>Element %1 vsebuje nedovoljeno besedilno vsebino.</translation> </message> <message> <location line="+18"/> - <source>element %1 can not contain other elements, as it has a fixed content</source> - <translation>element %1 ne more vsebovati drugih elementov, ker ima fiksno vsebino</translation> + <source>Element %1 can not contain other elements, as it has a fixed content.</source> + <translation>Element %1 ne more vsebovati drugih elementov, ker ima fiksno vsebino.</translation> </message> <message> <location line="+43"/> - <source>element %1 is missing required attribute %2</source> - <translation>elementu %1 manjka obvezna lastnost %2</translation> + <source>Element %1 is missing required attribute %2.</source> + <translation>Elementu %1 manjka obvezna lastnost %2.</translation> </message> <message> <location line="+29"/> - <source>attribute %1 does not match the attribute wildcard</source> + <source>Attribute %1 does not match the attribute wildcard.</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> - <source>declaration for attribute %1 does not exist</source> - <translation>deklaracija lastnosti %1 ne obstaja</translation> + <source>Declaration for attribute %1 does not exist.</source> + <translation>Deklaracija lastnosti %1 ne obstaja.</translation> </message> <message> <location line="+6"/> - <source>element %1 contains two attributes of type %2</source> - <translation>element %1 vsebuje dve lastnosti vrste %2</translation> + <source>Element %1 contains two attributes of type %2.</source> + <translation>Element %1 vsebuje dve lastnosti vrste %2.</translation> </message> <message> <location line="+11"/> - <source>attribute %1 contains invalid content</source> - <translation>lastnost %1 vsebuje neveljavno vsebino</translation> + <source>Attribute %1 contains invalid content.</source> + <translation>Lastnost %1 vsebuje neveljavno vsebino.</translation> </message> <message> <location line="+7"/> - <source>element %1 contains unknown attribute %2</source> - <translation>element %1 vsebuje neznano lastnost %2</translation> + <source>Element %1 contains unknown attribute %2.</source> + <translation>Element %1 vsebuje neznano lastnost %2.</translation> </message> <message> <location line="+40"/> <location line="+46"/> - <source>content of attribute %1 does not match its type definition: %2</source> + <source>Content of attribute %1 does not match its type definition: %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="-38"/> <location line="+46"/> - <source>content of attribute %1 does not match defined value constraint</source> + <source>Content of attribute %1 does not match defined value constraint.</source> <translation type="unfinished"></translation> </message> <message> <location line="+88"/> - <source>non-unique value found for constraint %1</source> + <source>Non-unique value found for constraint %1.</source> <translation type="unfinished"></translation> </message> <message> <location line="+20"/> - <source>key constraint %1 contains absent fields</source> + <source>Key constraint %1 contains absent fields.</source> <translation type="unfinished"></translation> </message> <message> <location line="+18"/> - <source>key constraint %1 contains references nillable element %2</source> + <source>Key constraint %1 contains references nillable element %2.</source> <translation type="unfinished"></translation> </message> <message> <location line="+40"/> - <source>no referenced value found for key reference %1</source> + <source>No referenced value found for key reference %1.</source> <translation type="unfinished"></translation> </message> <message> <location line="+64"/> - <source>more than one value found for field %1</source> - <translation>za polje %1 je bila najdena več kot ena vrednost</translation> + <source>More than one value found for field %1.</source> + <translation>Za polje %1 je bila najdena več kot ena vrednost.</translation> </message> <message> <location line="+20"/> - <source>field %1 has no simple type</source> - <translation>polje %1 nima preproste vrste</translation> + <source>Field %1 has no simple type.</source> + <translation>Polje %1 nima preproste vrste.</translation> </message> <message> <location line="+73"/> - <source>ID value '%1' is not unique</source> - <translation>Vrednost ID »%1« ni edinstvena</translation> + <source>ID value '%1' is not unique.</source> + <translation>Vrednost ID »%1« ni edinstvena.</translation> </message> <message> <location line="+11"/> + <source>'%1' attribute contains invalid QName content: %2.</source> + <translation>Lastnost »%1« vsebuje neveljavno vsebino QName: %2.</translation> + </message> + <message> + <location filename="Obsolete_PO_entries"/> + <source>attribute group %1 contains attribute %2 twice</source> + <translation type="obsolete">skupina lastnosti %1 dvakrat vsebuje lastnost %2</translation> + </message> + <message> + <location/> + <source>complex type %1 contains attribute %2 twice</source> + <translation type="obsolete">kompleksna vrsta %1 dvakrat vsebuje lastnost %2</translation> + </message> + <message> + <location/> + <source>element %1 exists twice with different types</source> + <translation type="obsolete">element %1 obstaja dvakrat, z različnima vrstama</translation> + </message> + <message> + <location/> + <source>can not process unknown element %1, expected elements are: %2</source> + <translation type="obsolete">ni moč obdelati neznanega elementa %1, pričakovani elementi so: %2</translation> + </message> + <message> + <location/> + <source>element %1 is not allowed in this scope, possible elements are: %2</source> + <translation type="obsolete">element %1 v tem obsegu ni dovoljen, možni elementi so: %2</translation> + </message> + <message> + <location/> + <source>child element is missing in that scope, possible child elements are: %1</source> + <translation type="obsolete">v tem obsegu manjka podelement, možni podelementi so: %1</translation> + </message> + <message> + <location/> + <source>document is not a XML schema</source> + <translation type="obsolete">dokument ni shema XML</translation> + </message> + <message> + <location/> + <source>%1 attribute of %2 element contains invalid content: {%3} is not a value of type %4</source> + <translation type="obsolete">lastnost %1 elementa %2 vsebuje neveljavno vsebino: {%3} ni vrednost vrste %4</translation> + </message> + <message> + <location/> + <source>%1 attribute of %2 element contains invalid content: {%3}</source> + <translation type="obsolete">lastnost %1 elementa %2 vsebuje neveljavno vsebino: {%3}</translation> + </message> + <message> + <location/> + <source>%1 element is not allowed inside %2 element if %3 attribute is present</source> + <translation type="obsolete">element %1 znotraj elementa %2 ni dovoljen, če je prisotna lastnost %3</translation> + </message> + <message> + <location/> + <source>%1 element has neither %2 attribute nor %3 child element</source> + <translation type="obsolete">element %1 nima niti lastnosti %2 niti podelementa %3</translation> + </message> + <message> + <location/> + <source>%1 element with %2 child element must not have a %3 attribute</source> + <translation type="obsolete">element %1 s podelementom %2 ne sme imeti lastnosti %3</translation> + </message> + <message> + <location/> + <source>%1 attribute of %2 element must be %3 or %4</source> + <translation type="obsolete">lastnost %1 elementa %2 mora biti %3 ali %4</translation> + </message> + <message> + <location/> + <source>%1 attribute of %2 element must have a value of %3</source> + <translation type="obsolete">lastnost %1 elementa %2 mora imeti vrednost %3</translation> + </message> + <message> + <location/> + <source>%1 attribute of %2 element must have a value of %3 or %4</source> + <translation type="obsolete">lastnost %1 elementa %2 mora imeti vrednost %3 ali %4</translation> + </message> + <message> + <location/> + <source>%1 element must not have %2 and %3 attribute together</source> + <translation type="obsolete">element %1 hkrati ne sme imeti lastnosti %2 in %3</translation> + </message> + <message> + <location/> + <source>content of %1 attribute of %2 element must not be from namespace %3</source> + <translation type="obsolete">vsebina lastnosti %1 elementa %2 ne sme biti iz imenskega prostora %3</translation> + </message> + <message> + <location/> + <source>%1 attribute of %2 element must not be %3</source> + <translation type="obsolete">lastnost %1 elementa %2 ne sme biti %3</translation> + </message> + <message> + <location/> + <source>%1 element must have either %2 or %3 attribute</source> + <translation type="obsolete">element %1 mora imeti lastnost %2 ali %3</translation> + </message> + <message> + <location/> + <source>%1 element requires either %2 or %3 attribute</source> + <translation type="obsolete">element %1 potrebuje vsaj lastnost %2 ali %3</translation> + </message> + <message> + <location/> + <source>%1 element is not allowed in this context</source> + <translation type="obsolete">element %1 v tem kontekstu ni dovoljen</translation> + </message> + <message> + <location/> + <source>component with id %1 has been defined previously</source> + <translation type="obsolete">komponenta z ID-jem %1 je že bila definirana</translation> + </message> + <message> + <location/> + <source>element %1 already defined</source> + <translation type="obsolete">element %1 je že definiran</translation> + </message> + <message> + <location/> + <source>attribute %1 already defined</source> + <translation type="obsolete">lastnost %1 je že definirana</translation> + </message> + <message> + <location/> + <source>type %1 already defined</source> + <translation type="obsolete">vrsta %1 je že definirana</translation> + </message> + <message> + <location/> + <source>attribute group %1 already defined</source> + <translation type="obsolete">skupina lastnosti %1 je že definirana</translation> + </message> + <message> + <location/> + <source>element group %1 already defined</source> + <translation type="obsolete">skupina elementov %1 je že definirana</translation> + </message> + <message> + <location/> + <source>notation %1 already defined</source> + <translation type="obsolete">zapis %1 je že definiran</translation> + </message> + <message> + <location/> + <source>type of %1 element must be a simple type, %2 is not</source> + <translation type="obsolete">vrsta elementa %1 mora biti preprosta, %2 to ni</translation> + </message> + <message> + <location/> + <source>duplicated element names %1 in %2 element</source> + <translation type="obsolete">podvojeni imeni elementov %1 v elementu %2</translation> + </message> + <message> + <location/> + <source>%1 is not valid according to %2</source> + <translation type="obsolete">%1 glede na %2 ni veljaven</translation> + </message> + <message> + <location/> + <source>invalid QName content: %1</source> + <translation type="obsolete">neveljavna vsebina QName: %1</translation> + </message> + <message> + <location/> + <source>data of type %1 are not allowed to be empty</source> + <translation type="obsolete">podatki vrste %1 ne smejo biti prazni</translation> + </message> + <message> + <location/> + <source>element %1 is missing child element</source> + <translation type="obsolete">elementu %1 manjka podelement</translation> + </message> + <message> + <location/> + <source>%1 contains invalid data</source> + <translation type="obsolete">%1 vsebuje neveljavne podatke</translation> + </message> + <message> + <location/> + <source>no definition for element %1 available</source> + <translation type="obsolete">definicija za element %1 ni na voljo</translation> + </message> + <message> + <location/> + <source>element %1 is not defined in this scope</source> + <translation type="obsolete">element %1 v tem obsegu ni definiran</translation> + </message> + <message> + <location/> + <source>declaration for element %1 does not exist</source> + <translation type="obsolete">deklaracija elementa %1 ne obstaja</translation> + </message> + <message> + <location/> + <source>element %1 contains invalid content</source> + <translation type="obsolete">element %1 vsebuje neveljavno vsebino</translation> + </message> + <message> + <location/> + <source>element %1 is declared as abstract</source> + <translation type="obsolete">element %1 je deklariran kot abstrakten</translation> + </message> + <message> + <location/> + <source>complex type %1 is not allowed to be abstract</source> + <translation type="obsolete">kompleksna vrsta %1 ne sme biti abstraktna</translation> + </message> + <message> + <location/> + <source>element %1 contains not allowed attributes</source> + <translation type="obsolete">element %1 vsebuje nedovoljene lastnosti</translation> + </message> + <message> + <location/> + <source>element %1 contains not allowed child element</source> + <translation type="obsolete">element %1 vsebuje nedovoljen podelement</translation> + </message> + <message> + <location/> + <source>content of element %1 does not match its type definition: %2</source> + <translation type="obsolete">vsebina elementa %1 ne ustreza zanj določeni vrsti: %2</translation> + </message> + <message> + <location/> + <source>element %1 contains not allowed child content</source> + <translation type="obsolete">element %1 vsebuje nedovoljeno vsebino v podelementih</translation> + </message> + <message> + <location/> + <source>element %1 contains not allowed text content</source> + <translation type="obsolete">element %1 vsebuje nedovoljeno besedilno vsebino</translation> + </message> + <message> + <location/> + <source>element %1 can not contain other elements, as it has a fixed content</source> + <translation type="obsolete">element %1 ne more vsebovati drugih elementov, ker ima fiksno vsebino</translation> + </message> + <message> + <location/> + <source>element %1 is missing required attribute %2</source> + <translation type="obsolete">elementu %1 manjka obvezna lastnost %2</translation> + </message> + <message> + <location/> + <source>declaration for attribute %1 does not exist</source> + <translation type="obsolete">deklaracija lastnosti %1 ne obstaja</translation> + </message> + <message> + <location/> + <source>element %1 contains two attributes of type %2</source> + <translation type="obsolete">element %1 vsebuje dve lastnosti vrste %2</translation> + </message> + <message> + <location/> + <source>attribute %1 contains invalid content</source> + <translation type="obsolete">lastnost %1 vsebuje neveljavno vsebino</translation> + </message> + <message> + <location/> + <source>element %1 contains unknown attribute %2</source> + <translation type="obsolete">element %1 vsebuje neznano lastnost %2</translation> + </message> + <message> + <location/> + <source>more than one value found for field %1</source> + <translation type="obsolete">za polje %1 je bila najdena več kot ena vrednost</translation> + </message> + <message> + <location/> + <source>field %1 has no simple type</source> + <translation type="obsolete">polje %1 nima preproste vrste</translation> + </message> + <message> + <location/> + <source>ID value '%1' is not unique</source> + <translation type="obsolete">Vrednost ID »%1« ni edinstvena</translation> + </message> + <message> + <location/> <source>'%1' attribute contains invalid QName content: %2</source> - <translation>Lastnost »%1« vsebuje neveljavno vsebino QName: %2</translation> + <translation type="obsolete">Lastnost »%1« vsebuje neveljavno vsebino QName: %2</translation> </message> </context> </TS> diff --git a/util/scripts/make_qfeatures_dot_h b/util/scripts/make_qfeatures_dot_h index bdd68a3..23d88a3 100755 --- a/util/scripts/make_qfeatures_dot_h +++ b/util/scripts/make_qfeatures_dot_h @@ -175,6 +175,7 @@ print OUT * All features and their dependencies. * * This list is generated from $QTDIR/src/corelib/global/qfeatures.txt + * by $QTSRCDIR/util/scripts/make_qfeatures_dot_h */ '; diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index f88f10e..ddf74bb 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -5,7 +5,7 @@ die() { exit 1 } -default_tag="qtwebkit-4.6-snapshot-22102009" +default_tag="qtwebkit-4.6-snapshot-20091003" if [ $# -eq 0 ]; then tag="$default_tag" @@ -155,7 +155,7 @@ excluded_directories="$excluded_directories WebKit/chromium" excluded_directories="$excluded_directories WebKit/English.lproj WebKit/WebKit.xcodeproj" excluded_directories="$excluded_directories WebCore/English.lproj" -exclude_with_exceptions_list="WebCore/platform/win/:WebCore/platform/win/SystemTimeWin.cpp" +exclude_with_exceptions_list="WebCore/platform/win/:WebCore/platform/win/SystemTimeWin.cpp\\|WebCore/platform/win/BitmapInfo.*" excluded_directories="$excluded_directories WebKit/mac/Carbon" excluded_directories="$excluded_directories WebKit/mac/ChangeLog" |