Bug 33857 - [Qt] Need a public API for suspending/resuming DOM Objects on a page
Summary: [Qt] Need a public API for suspending/resuming DOM Objects on a page
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2010-01-19 12:43 PST by Jesus Sanchez-Palencia
Modified: 2011-10-31 09:59 PDT (History)
5 users (show)

See Also:


Attachments
Proposed API for QWebFrame and QWebPage, and manual-tests (20.85 KB, patch)
2010-01-19 13:20 PST, Jesus Sanchez-Palencia
kenneth: review-
Details | Formatted Diff | Diff
Add an option to QtLauncher to be easy to suspend/resume DOM Objects on the current page (3.57 KB, patch)
2010-01-19 13:22 PST, Jesus Sanchez-Palencia
kenneth: review-
Details | Formatted Diff | Diff
[v2] Proposed API and manual-tests (16.34 KB, patch)
2010-01-20 07:20 PST, Jesus Sanchez-Palencia
no flags Details | Formatted Diff | Diff
[v2] Add a suspend/resume option to QtLauncher (3.48 KB, patch)
2010-01-20 07:21 PST, Jesus Sanchez-Palencia
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesus Sanchez-Palencia 2010-01-19 12:43:09 PST
Qt need an API for suspending/resuming DOM Objects on a QWebPage.
We are defining DOM Objects as JS timers, animated GIFs, SVG animations, CSS animations and plugins.

One example of use-case is when we want to save battery consumption if a mobile browser is running on background, but other use-cases were raised during previous discussion.

This is an extension of https://bugs.webkit.org/show_bug.cgi?id=31673 , and is related to http://bugreports.qt.nokia.com/browse/QTWEBKIT-6 and http://bugreports.qt.nokia.com/browse/QTWEBKIT-5 .
Comment 1 Jesus Sanchez-Palencia 2010-01-19 13:20:21 PST
Created attachment 46941 [details]
Proposed API for QWebFrame and QWebPage, and manual-tests
Comment 2 Jesus Sanchez-Palencia 2010-01-19 13:22:05 PST
Created attachment 46942 [details]
Add an option to QtLauncher to be easy to suspend/resume DOM Objects on the current page
Comment 3 Eric Seidel (no email) 2010-01-19 14:17:55 PST
Comment on attachment 46941 [details]
Proposed API for QWebFrame and QWebPage, and manual-tests

Do we have license to distribute Elvis_with_parachute?
Comment 4 WebKit Review Bot 2010-01-19 17:19:11 PST
Attachment 46942 [details] did not build on qt:
Build output: http://webkit-commit-queue.appspot.com/results/198987
Comment 5 Jesus Sanchez-Palencia 2010-01-19 19:20:03 PST
(In reply to comment #3)
>Do we have license to distribute Elvis_with_parachute?

The place I took it said that it was "free for using" and that you should contact the author for any specific questions about license. I just can't find the author, so it's probably better to use another GIF from our resources. I'll fix this.


(In reply to comment #4)
> Attachment 46942 [details] did not build on qt:
> Build output: http://webkit-commit-queue.appspot.com/results/198987

Attachment 46942 [details] depends on attachment 46941 [details].
Comment 6 Kenneth Rohde Christiansen 2010-01-20 04:20:28 PST
First of all it is called Qt and not QT. QT == QuickTime
Comment 7 Kenneth Rohde Christiansen 2010-01-20 04:30:05 PST
Comment on attachment 46941 [details]
Proposed API for QWebFrame and QWebPage, and manual-tests


> 
> The API from QWebPage will call suspend/resume DOM Objects of the main frame
> and of all its children.


Add API to QWebPage so that it is possible to suspend/resume...


> * manual-tests/frames-multiple-active-dom-objects.html: Added.
> * manual-tests/resources/Elvis_with_parachute.gif: Added.

What is the license of this file?


> +// FIXME: add support to suspending/resuming of animated GIFs and plugins.
> +// Suspend DOM objects (JS timers, CSS animation, SVG animation) in this frame.
> +bool QWebFramePrivate::suspendDOMObjects()
> +{
> +    if (!frame)
> +        return false;
> +
> +    AnimationController* controller = frame->animation();
> +    if (!controller)
> +        return false;

This seems wrong... what if you dont have a controller, can't you still suspend the active DOM objects included by
doc->suspendActiveDOMObjects(); ?

> +
> +    Document* doc = frame->document();
> +    if (!doc)
> +        return false;
> +
> +    // JavaScript
> +    doc->suspendActiveDOMObjects();

> +bool QWebFramePrivate::resumeDOMObjects()

same thing here

> +    QList<QWebFrame *> subFrames = frame->childFrames();

Should be  QList<QWebFrame*>. childFrames is probably a better name than subFrames :-) and it is already used

> +    QList<QWebFrame *>::const_iterator i;
> +    for (i = subFrames.constBegin(); i != subFrames.constEnd() ; ++i) {
> +        b = (b && suspendChildFrames((*i)));
> +    }
> +

Don't use b, use a descriptive name.

> +bool QWebPagePrivate::resumeChildFrames(QWebFrame *frame)

Wrong coding style, QWebFrame* frame

> +{
> +    if (!frame)
> +        return false;
> +
> +    bool b = frame->resumeDOMObjects();
> +

Don't use b

> +    QList<QWebFrame *> subFrames = frame->childFrames();
> +    QList<QWebFrame *>::const_iterator i;

Coding style

> +/*!
> +    Resume all frames, starting at the main frame.
> +    DOM Objects (JS timers, CSS and SVG animation) will be resumed.

DOM objects that were suspended, will be resumed.

> +    bool suspendChildFrames(QWebFrame *frame);
> +    bool resumeChildFrames(QWebFrame *frame);

Coding style
Comment 8 Kenneth Rohde Christiansen 2010-01-20 04:32:20 PST
Comment on attachment 46942 [details]
Add an option to QtLauncher to be easy to suspend/resume DOM Objects on the current page

> From debee88b204b8faf48edca5bca37b6b25e5a26cc Mon Sep 17 00:00:00 2001
> From: Jesus Sanchez-Palencia <jesferna@darjeeling.(none)>
> Date: Tue, 19 Jan 2010 17:17:45 -0300
> Subject: [PATCH 2/2] Add suspend/resume page option to QtLauncher
> 
> Reviewed by NOBODY (OOPS!).
> 
> [QT] Need a public API for suspending/resuming DOM Objects on a page
> https://bugs.webkit.org/show_bug.cgi?id=33857

It is called Qt


> +        suspendDOMObjects = false;

Doesn't the launcher uses m_ for member fields?

> +            QWebPage* page = view->page();
> +            page->suspend();

Why not call it directly?

> +    void toggleSuspendResumeObjects(bool on)

That doesnt seem much like a toggle if it takes a bool argument.
Comment 9 Jesus Sanchez-Palencia 2010-01-20 07:20:05 PST
Created attachment 47026 [details]
[v2] Proposed API and manual-tests
Comment 10 Jesus Sanchez-Palencia 2010-01-20 07:21:38 PST
Created attachment 47027 [details]
[v2] Add a suspend/resume option to QtLauncher

This patch depends on the other attachment (47026).
Comment 11 WebKit Review Bot 2010-01-21 18:25:47 PST
Attachment 47027 [details] did not build on qt:
Build output: http://webkit-commit-queue.appspot.com/results/204430
Comment 12 Simon Hausmann 2010-01-27 08:30:40 PST
Comment on attachment 47026 [details]
[v2] Proposed API and manual-tests

Clearing review for the time being, given that we're waiting for more feedback on the requirement at http://bugreports.qt.nokia.com/browse/QTWEBKIT-5
Comment 13 Simon Hausmann 2010-01-27 08:31:17 PST
Comment on attachment 47027 [details]
[v2] Add a suspend/resume option to QtLauncher

Clearning review here, too
Comment 14 Tor Arne Vestbø 2010-03-10 06:29:16 PST
Please follow the QtWebKit bug reporting guidelines when reporting bugs.

See http://trac.webkit.org/wiki/QtWebKitBugs

Specifically:

  - The 'QtWebKit' component should only be used for bugs/features in the
    public QtWebKit API layer, not to signify that the bug is specific to
    the Qt port of WebKit

      http://trac.webkit.org/wiki/QtWebKitBugs#Component

  - Add the keyword 'Qt' to signal that it's a Qt-related bug

      http://trac.webkit.org/wiki/QtWebKitBugs#Keywords
Comment 15 Kent Hansen 2010-03-12 03:30:39 PST
I think Jesus needs a reply at http://bugreports.qt.nokia.com/browse/QTWEBKIT-5 in order for this to proceed.
Comment 16 Jesus Sanchez-Palencia 2011-10-31 09:59:53 PDT
Closing this bug as a long time ago it was decided this API wasn't needed.