El mar, 28-01-2014 a las 14:32 -0800, Anders Carlsson escribió: > Hi floks! > > I noticed that both the EFL port and GTK+ port use a > COMPILE_ASSERT_MATCHING_ENUM macro to make sure that WebCore enum values map > to API enum values correctly, for example: > > COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED, > NavigationTypeLinkClicked);
Yes, we preferred that way to keep the code simpler and avoid long switches. > This means that we can’t add new enums declarations (unless they’re added at > the end) without breaking the build. That's right, it's also true that most of the times enums are extended adding new entries at the end. > Instead of doing this (and then just blindly casting between the API layer > and WebCore enum types), use conversion functions, like this (taken from > WebKit2): > > > inline WebCore::PageVisibilityState > > toPageVisibilityState(WKPageVisibilityState wkPageVisibilityState) > > { > > switch (wkPageVisibilityState) { > > case kWKPageVisibilityStateVisible: > > return WebCore::PageVisibilityStateVisible; > > case kWKPageVisibilityStateHidden: > > return WebCore::PageVisibilityStateHidden; > > case kWKPageVisibilityStatePrerender: > > return WebCore::PageVisibilityStatePrerender; > > } > > > > ASSERT_NOT_REACHED(); > > return WebCore::PageVisibilityStateVisible; > > } > > I plan to audit the Mac and Windows ports and look for places where we cast > between API enum types and WebCore enum types, and I filed > > https://bugs.webkit.org/show_bug.cgi?id=127800 WebKitGTK+ should stop using > COMPILE_ASSERT_MATCHING_ENUM macros > https://bugs.webkit.org/show_bug.cgi?id=127801 EFL port should stop using > COMPILE_ASSERT_MATCHING_ENUM macros > > for the Mac and EFL ports respectively. I’m happy to answer any questions > about this. Ok, let's fix this sooner rather than later, then. > - Anders > > _______________________________________________ > webkit-dev mailing list > webkit-dev@lists.webkit.org > https://lists.webkit.org/mailman/listinfo/webkit-dev > -- Carlos Garcia Campos http://pgp.rediris.es:11371/pks/lookup?op=get&search=0xF3D322D0EC4582C3 _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev