web_view_->ShowContentsDetectedPopup(content_url.spec().c_str());
}
+ void OnRequestSelectCollectionInformationUpdateACK(
+ int formElementCount, int currentNodeIndex,
+ bool prevState, bool nextState) {
+ if (web_view_)
+ web_view_->UpdateFormNavigation(formElementCount,
+ currentNodeIndex, prevState, nextState);
+ }
+
void Observe(int type, const content::NotificationSource& source,
const content::NotificationDetails& details) override {
DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type);
WebViewBrowserMessageFilterPrivate::OnFormSubmit)
IPC_MESSAGE_FORWARD(ViewHostMsg_StartContentIntent, private_,
WebViewBrowserMessageFilterPrivate::OnStartContentIntent)
+ IPC_MESSAGE_FORWARD(EwkHostMsg_RequestSelectCollectionInformationUpdateACK,
+ private_, WebViewBrowserMessageFilterPrivate::OnRequestSelectCollectionInformationUpdateACK)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
void EWebView::ShowPopupMenu(const std::vector<content::MenuItem>& items,
int selectedIndex, bool multiple) {
+ // Request form navigation information as early as possible,
+ // given that is renderer will ping-back with actual requested data.
+ RenderFrameHostImpl* render_frame_host = static_cast<RenderFrameHostImpl*>(
+ web_contents_->GetMainFrame());
+ if (render_frame_host)
+ render_frame_host->Send(new EwkFrameMsg_RequestSelectCollectionInformation(
+ render_frame_host->GetRoutingID()));
+
Eina_List* popupItems = 0;
const size_t size = items.size();
for (size_t i = 0; i < size; ++i) {
SetFormIsNavigating(true);
listClosed(popupPicker_, 0, 0, 0);
-#if !defined(EWK_BRINGUP)
- render_frame_host->MoveSelectElement(direction);
-#endif
+ render_frame_host->Send(new EwkFrameMsg_MoveToNextOrPreviousSelectElement(
+ render_frame_host->GetRoutingID(), direction));
}
Eina_Bool EWebView::DidSelectPopupMenuItem(int selectedIndex) {
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
+#include "third_party/WebKit/public/web/WebElementCollection.h"
#include "third_party/WebKit/public/web/WebFormElement.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebView.h"
using blink::WebDocument;
using blink::WebElement;
+using blink::WebElementCollection;
+using blink::WebFrame;
using blink::WebLocalFrame;
+using blink::WebView;
namespace content {
namespace {
WebElement GetFocusedElement(WebLocalFrame* frame) {
- //WebLocalFrame* frame_ = render_frame()->GetWebFrame();
WebDocument doc = frame->document();
if (!doc.isNull())
return doc.focusedElement();
IPC_BEGIN_MESSAGE_MAP(RenderFrameObserverEfl, message)
IPC_MESSAGE_HANDLER(EwkFrameMsg_LoadNotFoundErrorPage, OnLoadNotFoundErrorPage)
IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems)
-#if !defined(EWK_BRINGUP)
- IPC_MESSAGE_HANDLER(FrameMsg_MoveToPreviousSelectElement, OnMovePreviousSelectElement)
- IPC_MESSAGE_HANDLER(FrameMsg_MoveToNextSelectElement, OnMoveNextSelectElement)
-#endif
+ IPC_MESSAGE_HANDLER(EwkFrameMsg_MoveToNextOrPreviousSelectElement, OnMoveToNextOrPreviousSelectElement)
+ IPC_MESSAGE_HANDLER(EwkFrameMsg_RequestSelectCollectionInformation, OnRequestSelectCollectionInformation);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
replace);
}
-void RenderFrameObserverEfl::OnMoveNextSelectElement() {
-#if !defined(EWK_BRINGUP)
+void RenderFrameObserverEfl::OnMoveToNextOrPreviousSelectElement(bool direction) {
content::RenderView* render_view_ = render_frame()->GetRenderView();
- render_view_->GetWebView()->moveSelectElementToNext();
-#endif
+ if (direction)
+ render_view_->GetWebView()->moveFocusToNext(WebView::TraverseFocusThrough::SelectElement);
+ else
+ render_view_->GetWebView()->moveFocusToPrevious(WebView::TraverseFocusThrough::SelectElement);
}
-void RenderFrameObserverEfl::OnMovePreviousSelectElement() {
-#if !defined(EWK_BRINGUP)
+void RenderFrameObserverEfl::OnRequestSelectCollectionInformation() {
+ WebElement focused_element = GetFocusedElement(render_frame()->GetWebFrame());
+ if (focused_element.isNull())
+ return;
+
content::RenderView* render_view_ = render_frame()->GetRenderView();
- render_view_->GetWebView()->moveSelectElementToPrevious();
-#endif
+ WebFrame* focused_frame = render_view_->GetWebView()->focusedFrame();
+ if (!focused_frame)
+ return;
+
+ WebDocument document = focused_frame->document();
+ if (document.isNull())
+ return;
+
+ WebElementCollection select_elements = document.getElementsByHTMLTagName("select");
+ int count = 0;
+ int index = 0;
+ for (WebElement e = select_elements.firstItem();
+ !e.isNull(); e = select_elements.nextItem()) {
+ // take only visible elements into account
+ if (e.hasNonEmptyBoundingBox()) {
+ if (e == focused_element)
+ index = count;
+ ++count;
+ }
+ }
+
+ if (count) {
+ bool prev_status = index > 0;
+ bool next_status = index < count - 1;
+
+ Send(new EwkHostMsg_RequestSelectCollectionInformationUpdateACK(
+ render_frame()->GetRoutingID(), count, index, prev_status, next_status));
+ }
}
void RenderFrameObserverEfl::DidChangeScrollOffset() {