Closed Bug 787378 Opened 11 years ago Closed 11 years ago

Dispatch a "firstpaint" event for mozbrowsers

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: cjones, Assigned: justin.lebar+bug)

References

Details

(Keywords: dev-doc-needed)

Attachments

(2 files)

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)
Assignee: nobody → justin.lebar+bug
Hm ... need to be careful about about:blank here.
(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.
> 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.
If that were true, I think that many things other than this would be broken.
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.
No random oranges; just permaorange on opt builds on all platforms.  :)
Attachment #657434 - Flags: review? → review?(dale)
Attachment #657435 - Flags: review? → review?(dale)
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
Attachment #657434 - Flags: review?(dale) → review+
Attachment #657435 - Flags: review?(dale) → review+
10 demerits.  10 more and we bust you down to L2 ;).
https://hg.mozilla.org/mozilla-central/rev/0d060c3e7d65
https://hg.mozilla.org/mozilla-central/rev/50e752beca26
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
Blocks: 796254
No longer blocks: 796254
Keywords: dev-doc-needed
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.