Visit Mozilla.org

Mac:Cocoa Widgets

From MozillaWiki

Contents

What are Cocoa widgets? [edit]

Cocoa widgets are the basis for Gecko's Mac OS X support in Gecko 1.9+. The code can be found in the mozilla source tree at "mozilla/widget/src/cocoa". As you might suspect from the name, this widget implementation uses a Apple's Cocoa runtime and Cocoa API as the basis for much of its functionality. This is in contrast to our old widget implementation which was based on Apple's Carbon API. Cocoa widgets do not use actual Cocoa objects like NSButton for form controls, a common misconception. In this context, the word "widgets" refers to basic platform support, not user input UI elements in particular. Cocoa widgets use NSWindow and NSView to produce top-level windows and views to draw into.

Why move to Cocoa and Objective-C? [edit]

  • Apple is deprecating all of Carbon and it will not exist in 64-bit Mac OS X.
  • Cocoa way of doing things better matches up with Gecko's way of doing things. This results in code simplicity wins.

When will Gecko ship with Cocoa widgets? [edit]

Gecko 1.9 will be based on our Cocoa widget implementation. While Gecko 1.8.x did have a Cocoa widget implementation for embedding, it was only used for Camino.

What happened to the Carbon widget implementation? [edit]

Carbon widgets (used by Gecko 1.8.x) have been removed from Mozilla as of Gecko 1.9.0. We will not be maintaining any sort of parallel widget implementations. If you want to see the Carbon widget code, you can pull the Gecko 1.8.1 branch.