[webkit-dev] Some thoughts about platform flags

Darin Adler darin at apple.com
Wed Sep 24 14:53:16 PDT 2008

On Sep 24, 2008, at 1:11 PM, Amanda Walker wrote:

> ScrollView, where we will want to not define or call  
> ScrollView::getDocumentView() even though PLATFORM(MAC) is defined.  
> Our initial approach is to change the #if in ScrollView.h to add "&&
> !PLATFORM(CHROMIUM)" (and then have a different ScrollView  
> implentation file), with other tests at call sites if needed (though  
> we're trying to avoid sprinkling around yet more platform #ifs)
> Does that help describe the issue?


I agree with the objection that came up in the bug.

I think that despite its short pithy name that seems to refer to only  
a type of computer, the Mac suffix and PLATFORM(MAC) doesn't mean  
"code that runs on Mac OS X". In my opinion it doesn't mean "Apple's  
Mac port" either. It does mean, at least in part, "built on top of the  
Mac frameworks, Cocoa in particular". Just as PLATFORM(WIN) means  
"built on the HWND and event model on Windows" among other things.

So I agree that Chromium should not turn on PLATFORM(MAC) since  
Chromium does not use Mac frameworks in this way.

We should look for test cases in the other direction now. Places where  
Chromium wants to have code turned on when it's running on Mac OS X  
and the code is currently inside PLATFORM(MAC). We might find we need  
something other than PLATFORM(DARWIN) for these cases. Lets look at  
specific cases and see how it falls out.

     -- Darin

PS: We could also consider coming up with a new name for PLATFORM(MAC)  
or PLATFORM(WIN) that expresses this more clearly. That's a challenge,  
but I wouldn't rule out changing the name for clarity if we can come  
up with something that says the right thing.

More information about the webkit-dev mailing list