Automated Layout Testing in Mozilla

Robert O’Callahan came up with a handy idea for Mozilla QCautomated layout regression testing. Based on an idea implemented by Ian “Hixie” Hickson for Opera, this would automatically test the daily Mozilla builds for new layout bugs.

At first, I couldn’t figure out how such a task could be automated. After reading over the planned outline, I realized that it was a rather elegant approach. In short, the script (Perl, in this case) would keep a set of known-good screenshots of various layout tests. Then, on each day, the script would the build through the series of tests, taking screenshots along the way. At that point, it would just be a matter of doing file comparisons between the known-good screenshots and those from that day.

The code isn’t yet complete, but it’s moving forward. The trickly parts are in dealing with unruly builds (as you may have guessed). For instance, if that day’s build crashes on one of the tests, then the script would need to detect that, kill the process and then restart Mozilla for the next test sequence. In all, I have a good feeling about this development.

A Better Shoelace Knot?

Reading over the ensuing comments on a shoe-fastening poll on Slashdot, the discussion turned to knot-tying techniques. Quitcherbitchen put it this way:

When you tie your laces, just do one extra loop around and then pull the second loop through. In other words, “the rabbit goes around the tree twice, then through the hole.”

Your laces will stayed tied all day, even throughout a run, but still come undone with a simple pull. Try it. […]

He then chimed in with an URL for an illustrated example where they call it The Better Bow. I read over it and tried to make sense of it in my head, but I’m not always so good at virualizations such as this.

I even tried untying one of my shoes and following along that way, but I got lost at the “Wrap the loop around your finger” bit. If you figure this out, please fill me in — perhaps demonstrating it to me on a shoe sometime IRL would clear things up.

Andy Budd on CSS Margin Collapsing

Margin-collapsing can sometimes be tricky to CSS beginners; especially as modern browsers support CSS better, collapsing margins is something that you could easily run into. However, Andy Budd has written an extended blog entry on the workings behind collapsing margins.

For the most part, margin collapsing has few rules:

At its core, margin collapsing is very easy to understand. Basically when two vertical margins meet up, instead of adding together, the largest margin takes precedent and the other one “collapses” to nothing. […]

For example, if you have two adjacent paragraphs, the first with a 20px bottom margin and the second with a 15px top margin, the space between them will only be 20px — since the smaller of the two margins (15px) collapses into the larger one (20px).

It can get a bit tricky when borders come into play. In the case of borders, the two elements’ margins are no longer directly touching and so the margins don’t collapse. I’ve run into that one a few times when I’ve turned on borders on an element (for debugging) and then found the layout to be wildly different after I finished debugging and turned off the borders.

The article also goes on to talk about how margins collapse around floated elements. But, most beginners who would run into collapsing margins may not be using floats as a layout technique anyhow. In all, I found the article informative and I won’t hesitate to refer to it if I run into some weird collapsing issues.

Camino — Almost Had It

When computing, I like a consistent user interface. When on Windows, I want Windows-widgets and when on Mac I want Mac-widgets :). And, for the most part, I haven’t had problems of that nature. But, Mozilla Firebird on Mac OS has always bugged me a little bit. It’s a great browser, of course, but it has its own widget set. For example, select pulldowns (as you might find for a State on a form) have a pull-down arrow and scrollbars — just as you’d find on Windows.

So, at a New Years get-together last night, Ru whipped out his 12" PowerBook to show us one of his favorite Flash movies (Cow Bondage, FWIW) and I noticed that his browser had all the native Mac widgets! After a quick glance to the menubar, I noticed that he was running Camino. I had heard of Camino before — a browser with the Gecko rendering engine along with a Mac-tastic interface — but I had assumed that development dwindled once Firebird came about.

As it turns out, the Camino project is alive and well. So, I downloaded the latest Camino nightly and gave it a try just now. I loaded it up and it was like putting on an old pair of shoes that fit in all the right places. I had all my familiar widgets and I was ready to make the browser transition from Firebird. But, trouble soon began to seep in…

I first checked the Windows menu for the DOM Inspector but I couldn’t find it. Not that regular web surfers have much need for such a tool, but I find it an indespensible resource for web development. So, I can perhaps understand why the Camino team omitted it from their project, but I was still a bit bummed about that.

I checked for tabbed-browsing and, sure enough, it has there (Apple-T opened a new tab, just like Firebird). And, all the familiar keyboard shortcuts worked as well (such as Apple-L to load the URL bar). But, Camino didn’t react to the right mouse button as I expected. I right-cliked on the Back button and only got a context menu for configuring the toolbar (not a list of sites that I could go back to).

I really wanted to like Camino, but it just didn’t feel right to me. Sure, maybe I could find some work-around to the Back-button right-click bit, but there’d still be the DOM Inspector issue. And, now that Firebird has DOM Inspector built-in, there’s not much of an incentive for anyone to create a DOM Inspector browser extension either.

My best bet may be a matter of getting native widgets into Firebird instead of trying to get all of Firebird’s functionality into Camino :-/. But, I don’t have my hopes up about that either; a quick search of Bugzilla for “widget” bugs on Mac OS didn't come up with anything useful. Perhaps there’re no plans to make use of native Mac widgets on Firebird — maybe the Firebird developers perceive that Camino has filled that role.

Spellchecker Wonky in Mozilla

If you keep up with the Mozilla nightly builds, you may find that the spellchecker has gone a bit wonky. Since approximately from the 22nd, the spellchecker no longer recognizes capitalized versions of words already in its dictionary. For instance, if you start a sentence with “The”, “This” or “So”, it'll think you've misspelled the word.

You can still add the word to its dictionary and it won't bother you about that one again, but this is enough of an annoyance to me that I don’t think I’ll be downloading the nightlies for the next couples days until this one is fixed. And, it looks like it should be fixed soon — there’s already a patch awaiting approval :).