July 26th, 2007
The Menu and Popups Guide is now available which provides detailed documentation on the XUL menu, context menu, panel and tooltip features as well as how to use them from script. Additional improvements are much appreciated, for instance more examples or images.
In other XUL popup news, I’ve been fixing a few regressions lately, as well as fixing some other long standing popup bugs. For Mozilla 1.9, we can look forward to being able to put decks and trees in a popup panel and have them actually work. I’ve also got a fix in hand for focus navigation in popups, so one can press Tab and cycle between elements without navigating outside the popup unexpectedly. Also, focus doesn’t get confused when a popup opens or closes.
Posted in Uncategorized | No Comments »
July 5th, 2007
The popup reworking patch finally made it in yesterday without any performance regressions. This features a number of improvements to the popup code.
- Popups now open as well as fire events and change attributes asynchronously in some cases, making popups less crash prone.
- Popups are kept track of better, avoiding the popups that hang on the screen and cannot be closed issue.
- Some reflow improvements which make popups not jump about on the screen. Also, hopefully, the size of a popup or tooltip is determined properly, or at least more likely to be accurate.
- Some decomtamination and removal of much duplicated code.
- An openPopup and openPopupAtScreen method to use instead of the confusing showPopup. (showPopup is still supported though). The former opens a popup relative to another node while the latter opens a popup at a specific screen position.
- A <panel> element is added which is designed for popups that are not menus. XUL didn’t offically support this before. <menupopup> should be used for menus and <tooltip> for tooltips. The <popup> element is deprecated (as has always been the case) and is equivalent to <menupopup>.
There’s still some work to be done with popups. For instance, focus navigation in popups is a bit broken. This could be a tricky fix as it requires fixing some focus code while avoiding becoming the focus module owner.
Testing of popups is much appreciated. I know about the tooltips in html being the wrong size issue. The fix for this is to remove a workaround so that’s a good thing.
Posted in Mozilla | 2 Comments »
May 29th, 2007
There’s lots of changes to XUL in Mozilla 1.9. Some of these are documented already in the XUL element reference, but expect some more documentation in the future. But there’s still some things I want to get done for Mozilla 1.9:
- The XUL Popup reworking fixes a pile of bugs, makes popups less crash prone, and avoids the issue of popups that seem to hang around on the screen. It adds a <panel> element which is a type of popup designed for non-menu content so the keyboard works properly within it. Also, the API for opening popups is modified to be more useful and well defined. Much XPCOM overhead is removed too.
- Template with XML Sources support is almost ready. After that, a couple of fairly simple improvements to support reading other types of data (currently being worked on by Laurent Jouanneau), and logging so that debugging a template is possible. However, the last feature I have in mind, nested templates, will likely have to wait.
- Robert O’Callahan is almost finished up his patch for supporting getBoundingClientRect and getClientRects. These two functions allow one to get the area of an element as well as the rectangles used for text. I’d also like to support the offset and scroll properties in XUL. This allows us to move away from using the underspecified Mozilla specific box object APIs and move towards the er, um, underspecified Microsoft APIs. But the latter is at least being working on as a specification.
- I have a working WHAT-WG drag and drop implementation in bug 356295 with a few extra features needed for XUL use. However, this probably won’t be able to be in 1.9.
- After adding support for optional arguments in IDL to make things easier, the Scriptable IO support will be almost finished. This will make it easier to handle files and other streams from extensions. Unfortunately, the existing APIs were really designed for asynchronous network usage, so I may end up needing to reimplement some of the text reading and writing code so that things make more sense.
- No additional XUL elements are planned besides the ones aready checked in, but there is some polish still to go, along with lots of XUL tests.
Posted in Mozilla | 1 Comment »
May 9th, 2007
So one thing that is hard to do in Mozilla is read and write to files. This invoves a lot of creating of XPCOM components, initializing them and wrapping them in various other streams components. Or, you could use a library like jslib or similar. But it doesn’t have to be that way. What if an easier method was built-in:
// write a string to the file stuff.txt from the Home directory.
var file = IO.newFile("Home", "stuff.txt");
var stream = IO.newOutputStream(file, "text");
stream.writeString("This is a file\n");
stream.close();
And what if a similar technique could be used for reading and writing from files, sockets or other streams? What if this was reality?
See Scriptable IO for more details. Comments very welcome, especially on the API.
Posted in Mozilla | 15 Comments »