Why Cocoa Widgets?

I have been asked quite a few times why we’re going to move all Mozilla Mac OS X projects to Cocoa widgets. I explained why in a talk I gave recently at the Mozilla Summit, but I haven’t really written it down anywhere. So here goes.

We need to settle on a single set of widgets. Right now we maintain both Carbon and Cocoa widget implementations for Mac OS X, which is a serious strain on our resources. Moving towards a single widget implementation on Mac OS X is definitely the right way to go as it means we have less code to maintain and improve. Also, Cocoa widgets are probably a better road to go down for all projects, so we should be using them regardless of efficiency concerns. We intend to move all Mozilla Mac OS X products to Cocoa widgets.

First, Cocoa widgets can use both the Cocoa API and the Carbon API. Carbon widgets cannot easily use the Cocoa API. Since both APIs have their strengths, being able to use either is really helpful. The more tools in our toolbox the better.

Second, Cocoa widgets are going to make our Quartz drawing transition much easier. Drawing into a Cocoa NSView with Quartz is fairly straightforward the way we have things set up.

Third, Camino is highly dependent upon Cocoa widgets, whereas Firefox is not highly dependent upon Carbon widgets. Cocoa widgets have been designed with embedders in mind since the start, and moving Camino away from that to Carbon widgets would be *extremely* painful. Firefox already runs (albeit buggily) under Cocoa widgets.

Fourth, Cocoa is a more popular and accessible API. Since we need to attract developers, this is important. New developers tend to feel more comfortable with and less intimidated by the Cocoa API.

Fifth, Cocoa is simply a better API for object-oriented software development. Carbon is a pretty good API if you have to use C or you can’t use Objective-C in your project, but since Mozilla’s widgets are object-oriented and we can use Objective-C, Cocoa is the better choice.

6 thoughts on “Why Cocoa Widgets?

  1. You can see it on the trunk now – Firefox with Cocoa widgets builds right from CVS. You need to specify that it should build with Cocoa widgets in your mozconfig file – they are not turned on by default. I hope to make them default around the end of January.

  2. sure would be nice if the move to cocoa widgets corresponded with a move away from nsquickdrawview and to nsview . . . or is that the plan with cairo?

  3. Josh, what flag do we need to add to our mozconfig to build Firefox with cocoa widgets? I did some searching but I couldn’t find this information…

  4. It seems to be the final reversal of how Netscape went about things.

    They started developing the mozilla > firefox line with the aim of getting rid of the separate UIs for diferent platforms.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s