RESOLVED FIXED 108798
[EFL][WK2] Port EwkPopupMenuItem to the C API
https://bugs.webkit.org/show_bug.cgi?id=108798
Summary [EFL][WK2] Port EwkPopupMenuItem to the C API
Chris Dumez
Reported 2013-02-04 00:01:06 PST
As per Bug 107657, we should stop using internal C++ API in ewk_popup_menu and start using the C API instead of avoid violating API layering.
Attachments
Patch (29.47 KB, patch)
2013-02-04 03:38 PST, Chris Dumez
no flags
Patch (29.46 KB, patch)
2013-02-04 03:48 PST, Chris Dumez
buildbot: commit-queue-
Patch (29.64 KB, patch)
2013-02-04 04:10 PST, Chris Dumez
no flags
Patch (27.87 KB, patch)
2013-02-04 04:58 PST, Chris Dumez
no flags
Patch (23.74 KB, patch)
2013-02-05 04:44 PST, Chris Dumez
no flags
Patch (7.32 KB, patch)
2013-02-19 01:04 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2013-02-04 03:38:48 PST
Kenneth Rohde Christiansen
Comment 2 2013-02-04 03:41:37 PST
Comment on attachment 186337 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=186337&action=review > Source/WebKit2/UIProcess/API/C/efl/WKPopupMenuEfl.cpp:34 > +void WKPopupMenuEflSetSelectedIndex(WKPopupMenuRef menuRef, int selectedIndex) Efl would be wrong style. Please use EFL. Maybe we don't even need it, it is just an extension for our platform. What about multi select?
Chris Dumez
Comment 3 2013-02-04 03:48:46 PST
Created attachment 186339 [details] Patch Take Kenneth's feedback into consideration.
Build Bot
Comment 4 2013-02-04 03:57:15 PST
Comment on attachment 186339 [details] Patch Attachment 186339 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://queues.webkit.org/results/16371168
Chris Dumez
Comment 5 2013-02-04 04:10:56 PST
Created attachment 186344 [details] Patch Attempt to fix mac-wk2 ews.
Chris Dumez
Comment 6 2013-02-04 04:58:02 PST
Created attachment 186355 [details] Patch Rebase on master as the XCode project change started conflicting.
Kenneth Rohde Christiansen
Comment 7 2013-02-04 07:31:52 PST
Comment on attachment 186355 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=186355&action=review > Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp:55 > + // requestPopupMenu() takes ownership of the menu items. > + m_view->requestPopupMenu(toAPI(static_cast<WebPopupMenuProxy*>(this)), rect, textDirection, pageScaleFactor, popupMenuItems, selectedIndex); So still this class knows about our view implementation (actually depends on it). I guess it could depend on our WebView (WKView) in the near future
Chris Dumez
Comment 8 2013-02-04 07:36:33 PST
(In reply to comment #7) > (From update of attachment 186355 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=186355&action=review > > > Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp:55 > > + // requestPopupMenu() takes ownership of the menu items. > > + m_view->requestPopupMenu(toAPI(static_cast<WebPopupMenuProxy*>(this)), rect, textDirection, pageScaleFactor, popupMenuItems, selectedIndex); > > So still this class knows about our view implementation (actually depends on it). I guess it could depend on our WebView (WKView) in the near future Yes. Likely, we'll need to use the new WebView class once it is introduced (that patch has not landed yet). Until then, this will do fine :)
Chris Dumez
Comment 9 2013-02-05 04:44:02 PST
Created attachment 186599 [details] Patch Refactor the implementation so that we do not require any C API anymore.
Kenneth Rohde Christiansen
Comment 10 2013-02-05 05:13:38 PST
Comment on attachment 186599 [details] Patch Great changelog, looks good
Mikhail Pozdnyakov
Comment 11 2013-02-05 05:20:16 PST
Comment on attachment 186599 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=186599&action=review looks good. > Source/WebKit2/UIProcess/efl/WebPopupMenuProxyEfl.cpp:78 > + const size_t size = items.size(); const local variables are not due to coding style.
Chris Dumez
Comment 12 2013-02-19 01:04:31 PST
Kenneth Rohde Christiansen
Comment 13 2013-02-19 01:29:39 PST
Comment on attachment 189016 [details] Patch LGTM
Benjamin Poulain
Comment 14 2013-02-19 13:47:11 PST
Comment on attachment 189016 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=189016&action=review Looks great. I sign off on this. > Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.cpp:38 > +COMPILE_ASSERT_MATCHING_ENUM(EWK_POPUP_MENU_SEPARATOR, kWKPopupItemTypeSeparator); > +COMPILE_ASSERT_MATCHING_ENUM(EWK_POPUP_MENU_ITEM, kWKPopupItemTypeItem); Just a comment. I know this style is spread in EFL already, but you can write conversion function from one enum type to an other to have the same flexibility without using tricks. With a switch()-case() and a good compiler, there should be no additional cost. > Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.cpp:70 > + if (!m_text) > + m_text = WKEinaSharedString(AdoptWK, WKPopupItemCopyText(m_wkItem.get())); > + > return m_text; > } > > const char* EwkPopupMenuItem::tooltipText() const > { > + if (!m_tooltipText) > + m_tooltipText = WKEinaSharedString(AdoptWK, WKPopupItemCopyToolTipText(m_wkItem.get())); > + > return m_tooltipText; > } > > const char* EwkPopupMenuItem::accessibilityText() const > { > + if (!m_accessibilityText) > + m_accessibilityText = WKEinaSharedString(AdoptWK, WKPopupItemCopyAccessibilityText(m_wkItem.get())); > + m_test, m_tooltipText and m_accessibilityText should be initialized to 0 in the constructor.
Chris Dumez
Comment 15 2013-02-19 16:15:01 PST
(In reply to comment #14) > (From update of attachment 189016 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=189016&action=review > > Looks great. I sign off on this. > > > Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.cpp:38 > > +COMPILE_ASSERT_MATCHING_ENUM(EWK_POPUP_MENU_SEPARATOR, kWKPopupItemTypeSeparator); > > +COMPILE_ASSERT_MATCHING_ENUM(EWK_POPUP_MENU_ITEM, kWKPopupItemTypeItem); > > Just a comment. > > I know this style is spread in EFL already, but you can write conversion function from one enum type to an other to have the same flexibility without using tricks. > With a switch()-case() and a good compiler, there should be no additional cost. > > > Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.cpp:70 > > + if (!m_text) > > + m_text = WKEinaSharedString(AdoptWK, WKPopupItemCopyText(m_wkItem.get())); > > + > > return m_text; > > } > > > > const char* EwkPopupMenuItem::tooltipText() const > > { > > + if (!m_tooltipText) > > + m_tooltipText = WKEinaSharedString(AdoptWK, WKPopupItemCopyToolTipText(m_wkItem.get())); > > + > > return m_tooltipText; > > } > > > > const char* EwkPopupMenuItem::accessibilityText() const > > { > > + if (!m_accessibilityText) > > + m_accessibilityText = WKEinaSharedString(AdoptWK, WKPopupItemCopyAccessibilityText(m_wkItem.get())); > > + > > m_test, m_tooltipText and m_accessibilityText should be initialized to 0 in the constructor. Those are WKEinaSharedString objects so there is no need for initializing to 0. The default constructor takes care of initializing the internal const char* to 0.
Kenneth Rohde Christiansen
Comment 16 2013-02-20 02:50:29 PST
Comment on attachment 189016 [details] Patch r=me as signed of by ben
WebKit Review Bot
Comment 17 2013-02-20 03:10:11 PST
Comment on attachment 189016 [details] Patch Clearing flags on attachment: 189016 Committed r143444: <http://trac.webkit.org/changeset/143444>
WebKit Review Bot
Comment 18 2013-02-20 03:10:18 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.