Text field lazy initialization

I just landed a set of patches on mozilla-central which makes the initialization of the editor for text fields (input type="text" and input type="password" in HTML terms) lazy.  What we used to do was to initialize the editor component for text fields as soon as we created frames for those elements.  This was not ideal, because users don’t usually use all of those fields on web pages (think about the "search" text fields you see on every website nowadays, for example.)  It also made Gecko significantly slow for pages which included a lot of those elements.

What these patches do is that they defer the initialization of the editor component (which actually allows you to type into the fields, copy and paste stuff, undo/redo your edits, etc.) until when the user is most likely to use it (for example, when the control is focused, or receives keyboard input.)

The work to make this happen was a lot more than I originally anticipated.  It uncovered a number of other problems, which I’ve already fixed or I’m going to.  It also proved to be a long journey as I saw different changes in the tree break my work a lot.  Overall, those problems should have made the patches more robust, but I thought I’d post this change here so that nightly testers can have it in their minds in order to track any possible regressions.  These changes will be in tomorrow’s nightly build.

Update: Actually, I spoke too soon.  The changes caused a problem and I had to back them out.  Hopefully the problem is resolved soon and I’ll re-land the patches.

Update 2: The code has landed and  has been stabilized on trunk now.

Posted in Blog Tagged with: , ,