Fix crash with foreach on arguments object

We call fullyCreate() on the arguments object when it's initialized
on an foreach iterator. That itself however might trigger an allocation,
which in turn might collect the ForEachIteratorObject, which is missing
a "ProtectThis" in its constructor.

Change-Id: Ib8f7e39201e727cde91cbbe8a82cba78aa980f0d
Task-number: QTBUG-40844
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Move syncTimer measurment to the correct place.

syncTimer was including the time spent waiting for VSYNC on unchanged
frames. This was causing the reported value to be much higher than expected.

Task-number: QTBUG-40556
Change-Id: Ife759b4e27faf2124ab330be8d1f42d15c4d2d33
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
QQuickWindow autotest: focus transferred to parent on window close

These bugs were fixed so XFAIL is no longer necessary in the autotest
(change da0c74550f0e8a21239896d6aead6e05f85eb695 in qtbase).

Task-number: QTBUG-33423
Task-number: QTBUG-39809
Change-Id: Ia89554b9f54aca7ef6c6ac6b474ca2bb9c0f5629
Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Temporarily skip tst_qquickframebufferobject when using ANGLE.

Task-number: QTBUG-41815
Change-Id: I5c6ec36a4f8830d95e1d4904d1be41d752757339
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Fix missing glyphs in selection

Change 198009db79a85d3cab7fe3a6432635d36123a2d6 revealed a bug in the
new selection algorithm which would occur sometimes
when a given run of text spanned several script items. Since we
are checking the glyph runs for overlaps in the actual text, we
need to report the exact characters spanned by the glyph run. We
use the new enabler for this in QGlyphRunPrivate.

Added a new test case which is an error case we did not yet cover,
which is when there is only a single script item, but several
font engines are used to produce it (fallback fonts).

Change-Id: Ie4c3e79ad98a033d5c75fd67ada4ae83df33435b
Task-number: QTBUG-41808
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Relax ShaderEffectSource's sourceItem vs window handling.

For dynamically loaded items, the window may not be set
on either the source or the item, so we need to be a bit
more relaxed in our checking.

This fixes a regression for dynamically loaded GaussianBlur.

Change-Id: I3e888405a95058ca79ecd2dff42c0ed4c8fff065
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Compare doesn't work for colors, so compare the channels explcitily.

Change-Id: I7a21328700c85b5b79dbb4342817e28833dece70
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Remove alpha channel from images that doesn't actually have alpha.

We did this for QPixmap since forever, and it has a huge impact
on rendering performance, so there is no reason why we shouldn't
spend that extra bit of time.

Change-Id: Ibd2e6d585525a5b5a975b8d7498c21dec00647c5
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Fix memory leak and crash with transform animators.

Every time initialize() was called, we would increment the ref on
an item. However, initialize is called every time the job is started,
so the ref would increase and only decrease once, leading to a leaked
helper. Change it to only increment the first time.

A different problem was that when an item was destroyed, we could run
the risk of the QQuickTransformAnimatorJob destructor being called
with the helper's item being null. This would lead to the helper not
being removed from the cache and a dangling helper would remain in the
transforms cache. Now change it so that when a target is destroyed, we
explicitly destroy the helper as well (as no animation can happen then
anyway) and reset all pointers in the job.

Change-Id: I1ce76db134bbc1871d32f1224ba5b68a4a4eeafa
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Doc: Updated the \brief and detailed description

Just to give a hint to the reader about what the
example does.

Task-number: QTBUG-37203
Change-Id: Ibb377e4adfb25ed4e4da0a41280e4157fae638ba
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Doc: Updated the QML State Machine docs

- Excluded the src/imports/statemachine directory from
qtquick.qdocconf to avoid unnecessary qdoc warnings.
- corrected a broken link to an external source
- changed the group name to avoid collision
- added a \qmlmodule page for QtQml.StateMachine
- Reduced the amount of duplication between the
C++ and QML state machine overviews.

Task-number: QTBUG-41561
Change-Id: I87c815fada7006f0609331e315bb338f062bb4db
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Make QQuickKeyNavigationAttached respect user set values

Before this change, when user tried to set KeyNavigation property
to the value which was previously automatically assigned, user set
flag wasn't raised. Such behavior led to situations, when explicitly
set values later were not respected by automatic mutual changes.

Change-Id: Id5ba5061c03a61f4d7835a638dc746b1485b9a56
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Export QQuickKeyNavigationAttached as a part of the private API

This change fixes linking problems when QQuickKeyNavigationAttached
is used through private headers.

Change-Id: I176a9551718d9ba25c160a3b1caa8872c88d39f3
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Return the content position rounded on the right side

QQuickFlickable::contentX/Y() returns the negative of the value
stored in the QQuickTimeLineValue used by QQuickFlickable.
So we must be careful when using things like qRound, and call it
with the negative of the value ine the QQuickTimeLineValue, else
code like this would fail:

QQuickFlickable *f = ...
f->setPixelAligned(true)
f->setContentY(-10.5)
assert(f->contentY() == qRound(-10.5)) // fail

The assert expression indeed turns into -11 == -10, which is false
but which is not what the user would expect.

Change-Id: Ib92ee2fa613b751462237349d9e4e2f2b4652f82
Reviewed-by: Martin Jones <martin.jones@qinetic.com.au>
Fix QQmlExpression/QQmlScriptString/QQmlBinding crashes

In the QQmlScriptString we store the binding id and it is an index into the
runtimeFunctions array of the compilation unit. However we don't store the
compilation unit and instead in QQmlBinding and QQmlExpression try to retrieve
it from the cache via the context url (we have the context after all). That
turns out to be not a reliable way, as sometimes the URL might slightly differ
from the originally compiled cache (qrc:/// turning to qrc:/ maybe).
Consequently the type is (unnecessarily) compiled again and unfortunately not
_linked_, therefore the runtime functions array is empty. Another option is
that when the component was created from a QByteArray, then no entry exists in
the cache in the first place.

This patch addresses the problem by storing a reference to the compilation unit
in the QQmlContextData. That we can safely retrieve and it'll make sure the
compilation unit also stays alive.

In the process of that the manual reference counting was switched over to
QQmlRefCount and QQmlRefPointer for QV4::CompilationUnit.

Task-number: QTBUG-41193
Change-Id: I9111f9a3b65618e453954abcd789c039e65a94f7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
PathView: Fix QML engine thinking currentItem is null when it's not

QML didn't re-evaluate any bindings using currentItem because a
notification was missing.

Change-Id: Icdaa3022e0b01644a060e577d87f011b4ea9fabb
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Stabilize and fix comparisons in animator tests.

compare() will compare properties of objects and neither Qt.rgba nor
image.pixel created objects has enumeratable properties so compare
is pretty much useless. Use verify + == which will rely on toString()
which is ok.

A few of the tests relied on execution order of signals emitted on
animation.running being changed and would occasionally fail.

Change-Id: I531c7f21b58a922a6be9ca2b6de120a68209a6d6
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Fix issues with Keyboard Focus documentation.

Change-Id: I0dcc364456404a761a555da065452a59d1249a2f
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Improve performance of animators.

The use of one QCoreApp::postEvent() per completed animation added up
to a very large overhead when 1000+ animators were used at the same
time. This is very relevant for sprite games and similar and deserves
to work at least as good as normal animations.

Instead, store the animations to stop and stop then on the gui thread
later as a result of frameSwapped. For the benchmark in question this
allows for roughly double the amount of animators being started and
stopped.

Change-Id: Iae3d1ec1502ee1908fdbba708fa9f976aa230064
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Correct KeyEvent::key documentation.

"text" is a property, not a function.

Change-Id: I02158d550ff174076396810dca007df1d734bda5
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>