Bug 36034 - [Qt] GraphicsLayer: Opacity change from zero to non-zero doesn't always have effect with AC
Summary: [Qt] GraphicsLayer: Opacity change from zero to non-zero doesn't always have ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-11 14:33 PST by Kim Grönholm
Modified: 2010-03-22 08:47 PDT (History)
4 users (show)

See Also:


Attachments
Opacity transition from 0 to 1 in 5s (533 bytes, text/html)
2010-03-11 14:33 PST, Kim Grönholm
no flags Details
patch for the bug #36034 (1.56 KB, patch)
2010-03-11 14:44 PST, Kim Grönholm
no flags Details | Formatted Diff | Diff
ifdef the QTBUG-7714 workaround for qt versions lower than 4.6.2 (1.68 KB, patch)
2010-03-22 07:32 PDT, Kim Grönholm
kenneth: review+
kenneth: commit-queue+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kim Grönholm 2010-03-11 14:33:57 PST
Created attachment 50541 [details]
Opacity transition from 0 to 1 in 5s

When a web page has only an element which opacity is zero and the opacity is changed to non-zero, the element doesn't become visible. If the mouse cursor is moved outside the window area and back in, the element redraws with correct opacity. After the element has been drawn once with non-zero opacity, the subsequent opacity changes affect immediately. The bug doesn't occur without AC.

Attached a test case to demonstrate the issue.
Comment 1 Kim Grönholm 2010-03-11 14:44:06 PST
Created attachment 50544 [details]
patch for the bug #36034

The issue seems to be a bug in QGraphicsScene/QGraphicsItem. Attached a patch which introduces a workaround for it.
Comment 2 Kenneth Rohde Christiansen 2010-03-13 10:10:42 PST
Comment on attachment 50544 [details]
patch for the bug #36034

Seems sensible. Have you reported the bug to Qt DF?
Comment 3 WebKit Commit Bot 2010-03-13 11:28:51 PST
Comment on attachment 50544 [details]
patch for the bug #36034

Clearing flags on attachment: 50544

Committed r55967: <http://trac.webkit.org/changeset/55967>
Comment 4 WebKit Commit Bot 2010-03-13 11:28:55 PST
All reviewed patches have been landed.  Closing bug.
Comment 5 Simon Hausmann 2010-03-13 15:49:24 PST
Comment on attachment 50544 [details]
patch for the bug #36034


> -        m_layer.data()->setOpacity(qMin<qreal>(qMax<qreal>(fromValue + (toValue-fromValue)*progress, 0), 1));
> +        qreal opacity = qBound(qreal(0), fromValue + (toValue-fromValue)*progress, qreal(1));
> +
> +        // FIXME: this is a hack, due to a probable QGraphicsScene bug.
> +        // Without this the opacity change doesn't always have immediate effect.
> +        if (!m_layer.data()->opacity() && opacity)
> +            m_layer.data()->scene()->update();
> +
> +        m_layer.data()->setOpacity(opacity);

It would be good to get a sign-off from Noam on this one and also add a comment here with a link to the bugreport at http://bugreports.qt.nokia.com/ . Updating the entire scene is obviously a very expensive operation, so it would be good to know when we can remove this workaround in the future.
Comment 6 Noam Rosenthal 2010-03-13 17:43:47 PST
I did a smoke test to this - signed off!
Comment 7 Noam Rosenthal 2010-03-13 17:47:23 PST
I intend to collect Qt bugs that we needed to work-around to try to look at them deeply with Qt R&D.
Comment 8 Simon Hausmann 2010-03-14 00:56:35 PST
(In reply to comment #7)
> I intend to collect Qt bugs that we needed to work-around to try to look at
> them deeply with Qt R&D.

Excellent, thanks!
Comment 9 Noam Rosenthal 2010-03-16 09:05:00 PDT
Apparently http://bugreports.qt.nokia.com/browse/QTBUG-7714 was already reported and being worked on.
Comment 10 Simon Hausmann 2010-03-19 09:01:48 PDT
(In reply to comment #9)
> Apparently http://bugreports.qt.nokia.com/browse/QTBUG-7714 was already
> reported and being worked on.

Excellent, looks like the fix is in Qt 4.6.2, which is released. I think we should place an #ifdef around the update at least, to take the faster code path without the expensive update for Qt versions >= 4.6.2.
Comment 11 Kim Grönholm 2010-03-22 07:32:50 PDT
Created attachment 51282 [details]
ifdef the QTBUG-7714 workaround for qt versions lower than 4.6.2

Added the Qt version check as Simon suggested.
Comment 12 Simon Hausmann 2010-03-22 08:47:09 PDT
Thanks Kim and Kenneth :)