Last Comment Bug 787378 - Dispatch a "firstpaint" event for mozbrowsers
: Dispatch a "firstpaint" event for mozbrowsers
Status: RESOLVED FIXED
: dev-doc-needed
Product: Core
Classification: Components
Component: DOM (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla18
Assigned To: Justin Lebar (not reading bugmail)
:
: Andrew Overholt [:overholt]
Mentors:
Depends on:
Blocks: browser-api
  Show dependency treegraph
 
Reported: 2012-08-31 05:36 PDT by Chris Jones [:cjones] inactive; ni?/f?/r? if you need me
Modified: 2013-03-18 14:41 PDT (History)
8 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Part 1: Fire a "firstpaint" event in iframe mozbrowser. (4.19 KB, patch)
2012-08-31 13:53 PDT, Justin Lebar (not reading bugmail)
cjones.bugs: review+
Details | Diff | Splinter Review
Bug 787378 - Part 2: Tests for mozbrowserfirstpaint event. (5.05 KB, patch)
2012-08-31 13:54 PDT, Justin Lebar (not reading bugmail)
cjones.bugs: review+
Details | Diff | Splinter Review

Description Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-08-31 05:36:28 PDT
This lets the embedder know when the iframe has valid pixels available.  This is useful for things like https://github.com/mozilla-b2g/gaia/issues/4213 .

To implement this, I think we'd want to
 - register a MozAfterPaint listener from BrowserElementChild when it's initialized
 - when the first MozAfterPaint event is dispatched, fire the "firstpaint" notification to the embedder
 - unhook the MozAfterPaint listener (they can cause some perf issues)
Comment 1 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-08-31 06:34:31 PDT
Hm ... need to be careful about about:blank here.
Comment 2 Justin Lebar (not reading bugmail) 2012-08-31 06:35:28 PDT
(In reply to Chris Jones [:cjones] [:warhammer] from comment #1)
> Hm ... need to be careful about about:blank here.

Yeah, I was just about to comment on that.  :)  But I think we can just check the location of the docshell/document.
Comment 3 Justin Lebar (not reading bugmail) 2012-08-31 06:46:16 PDT
> But I think we can just check the location of the docshell/document.

...unless http://foo.com can be painted before the docshell's location changes away from about:blank.  I hope not, but I'm not sure.
Comment 4 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-08-31 07:10:25 PDT
If that were true, I think that many things other than this would be broken.
Comment 5 Justin Lebar (not reading bugmail) 2012-08-31 07:24:15 PDT
One way to find out, I guess.

https://tbpl.mozilla.org/?tree=Try&rev=0f81ae103909

Anyone want to take bets on which platform will go randomorange?  My money is on OSX.
Comment 6 Justin Lebar (not reading bugmail) 2012-08-31 10:46:18 PDT
No random oranges; just permaorange on opt builds on all platforms.  :)
Comment 7 Justin Lebar (not reading bugmail) 2012-08-31 10:57:03 PDT
Second time's a charm? https://tbpl.mozilla.org/?tree=Try&rev=3ec505fdd543
Comment 8 Justin Lebar (not reading bugmail) 2012-08-31 13:53:48 PDT
Created attachment 657434 [details] [diff] [review]
Part 1: Fire a "firstpaint" event in iframe mozbrowser.
Comment 9 Justin Lebar (not reading bugmail) 2012-08-31 13:54:00 PDT
Created attachment 657435 [details] [diff] [review]
Bug 787378 - Part 2: Tests for mozbrowserfirstpaint event.
Comment 10 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-09-04 21:53:21 PDT
Comment on attachment 657434 [details] [diff] [review]
Part 1: Fire a "firstpaint" event in iframe mozbrowser.

Stealing.

>diff --git a/dom/browser-element/BrowserElementChild.js b/dom/browser-element/BrowserElementChild.js

> function debug(msg) {
>-  //dump("BrowserElementChild - " + msg + "\n");
>+  // dump("BrowserElementChild - " + msg + "\n");

This is distracting, please remove.

Looks good!  r=me with nitfix
Comment 11 Justin Lebar (not reading bugmail) 2012-09-05 07:35:22 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/0d060c3e7d65
https://hg.mozilla.org/integration/mozilla-inbound/rev/50e752beca26

I, um, forgot to put "r=cjones" in the commit messages.  Oops.
Comment 12 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-09-05 09:40:29 PDT
10 demerits.  10 more and we bust you down to L2 ;).

Note You need to log in before you can comment on or make changes to this bug.