Title: [115702] trunk/Source/WebKit/chromium
Revision
115702
Author
[email protected]
Date
2012-04-30 19:38:40 -0700 (Mon, 30 Apr 2012)

Log Message

[Chromium] Fix Autofill popup visibility behavior
Prevent users from interacting with invisible Autofill popups rendered outside the main frame's contents view.
This is a recommit of r115400, restricted to just Autofill popups.
https://bugs.webkit.org/show_bug.cgi?id=84420

Reviewed by Abhishek Arya

* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::popupOpened): Hide popups rendered outside the main frame's contents view.
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::applyAutofillSuggestions): Fix up order of operations to support immediately hiding a popup if it would not be visible

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (115701 => 115702)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-01 02:15:51 UTC (rev 115701)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-01 02:38:40 UTC (rev 115702)
@@ -1,3 +1,17 @@
+2012-04-30  Ilya Sherman  <[email protected]>
+
+        [Chromium] Fix Autofill popup visibility behavior
+        Prevent users from interacting with invisible Autofill popups rendered outside the main frame's contents view.
+        This is a recommit of r115400, restricted to just Autofill popups.
+        https://bugs.webkit.org/show_bug.cgi?id=84420
+
+        Reviewed by Abhishek Arya
+
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::popupOpened): Hide popups rendered outside the main frame's contents view.
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::applyAutofillSuggestions): Fix up order of operations to support immediately hiding a popup if it would not be visible
+
 2012-04-30  Sadrul Habib Chowdhury  <[email protected]>
 
         [chromium] Disable battery-status API support.

Modified: trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp (115701 => 115702)


--- trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2012-05-01 02:15:51 UTC (rev 115701)
+++ trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2012-05-01 02:38:40 UTC (rev 115702)
@@ -779,6 +779,22 @@
                                    const IntRect& bounds,
                                    bool handleExternally)
 {
+    // For Autofill popups, if the popup will not be fully visible, we shouldn't
+    // show it at all. Among other things, this prevents users from being able
+    // to interact via the keyboard with an invisible popup.
+    if (popupContainer->popupType() == PopupContainer::Suggestion) {
+        FrameView* view = m_webView->page()->mainFrame()->view();
+        IntRect visibleRect = view->visibleContentRect(true /* include scrollbars */);
+        // |bounds| is in screen coordinates, so make sure to convert it to
+        // content coordinates prior to comparing to |visibleRect|.
+        IntRect screenRect = bounds;
+        screenRect.setLocation(view->screenToContents(bounds.location()));
+        if (!visibleRect.contains(screenRect)) {
+            m_webView->hideAutofillPopup();
+            return;
+        }
+    }
+
     if (!m_webView->client())
         return;
 

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (115701 => 115702)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-05-01 02:15:51 UTC (rev 115701)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-05-01 02:38:40 UTC (rev 115702)
@@ -2797,8 +2797,8 @@
     if (m_autofillPopupShowing) {
         refreshAutofillPopup();
     } else {
+        m_autofillPopupShowing = true;
         m_autofillPopup->showInRect(focusedNode->getPixelSnappedRect(), focusedNode->ownerDocument()->view(), 0);
-        m_autofillPopupShowing = true;
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to