Adam Roben aroben at webkit.org
Mon Feb 25 05:53:16 PST 2013

> I was having a look at our Context Menu design when this USE flag got
> my attention. Can someone help me clarify the motivation for it?

The motivation is explained pretty well in the ChangeLog for r73802,
which introduced this flag. I'll try to give a little explanation here

CROSS_PLATFORM_CONTEXT_MENUS changes WebCore::ContextMenu and
WebCore::ContextMenuItem from being thin wrappers around a
platform-specific context menu and context menu item, to being full
cross-platform representations of a menu and menu item. In this new
model, most code will only ever deal with the cross-platform types;
platform-specific menus and menu items should only be created as
needed (e.g., when actually showing the menu on screen, or when
passing a native menu up to the embedding application, as happens in
the Apple WebKit[2] APIs). Providing a true cross-platform
representation of menus and menu items makes many things simpler,
including being able to serialize menus and send them across process

This last point was the immediate motivation for
CROSS_PLATFORM_CONTEXT_MENUS: we needed to send context menus from the
web process to the UI process to support context menus in WebKit2 on
Windows. But the hope was that all ports would switch over to this
model eventually.

> It seems that only PLATFORM(WIN) is using it, but I'm not sure if for
> both WK1 and WK2...

WIN uses it for both WK1 and WK2.

> Also, is there any other port using it?

I don't believe so. But if you look at ContextMenu[Item].h, it looks
like CHROMIUM and EFL could very easily switch over to it; they've
already implemented something very similar by abusing the
PlatformMenuItemDescription typedef.


More information about the webkit-dev mailing list