Title: [90119] trunk/Source
Revision
90119
Author
[email protected]
Date
2011-06-30 07:45:21 -0700 (Thu, 30 Jun 2011)

Log Message

2011-06-30  Alexander Pavlov  <[email protected]>

        Reviewed by Kent Tamura.

        [Chromium] Autofill suggestions appear in upper left corner after input change
        https://bugs.webkit.org/show_bug.cgi?id=63702

        This change fixes a few popup layout issues, some of which have existed for quite a while:
        - the absence of the ChromeClientImpl::screenToWindow() implementation (the method used to always return (0, 0));
        - the confusion of window and screen coordinates passed into the autofill popup client's setWindowRect() method;
        - the use of the current frameRect() width as the target element's width (which was wrong when refreshing
          a popup resized during the initial layout (e.g. made wider than the target element)).

        No new tests, as this is a change to platform-specific widget code. The test case is provided in the bug description.

        * platform/chromium/PopupMenuChromium.cpp:
        (WebCore::PopupContainer::layoutAndGetRTLOffset): Use original target element width, not frameRect().width(),
        since the latter gets updated if the popup is not the same width as the target element.
        (WebCore::PopupContainer::refresh): Restore only the popup bounds rather than its original rectangle,
        since it sometimes breaks the invalidation region and layout.
2011-06-30  Alexander Pavlov  <[email protected]>

        Reviewed by Kent Tamura.

        [Chromium] Autofill suggestions appear in upper left corner after input change
        https://bugs.webkit.org/show_bug.cgi?id=63702

        * src/ChromeClientImpl.cpp:
        (WebKit::ChromeClientImpl::screenToWindow): Implemented.
        * src/WebViewImpl.cpp:
        (WebKit::WebViewImpl::refreshAutoFillPopup): Pass screen (not window) coordinates into setWindowRect().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90118 => 90119)


--- trunk/Source/WebCore/ChangeLog	2011-06-30 14:30:19 UTC (rev 90118)
+++ trunk/Source/WebCore/ChangeLog	2011-06-30 14:45:21 UTC (rev 90119)
@@ -1,3 +1,24 @@
+2011-06-30  Alexander Pavlov  <[email protected]>
+
+        Reviewed by Kent Tamura.
+
+        [Chromium] Autofill suggestions appear in upper left corner after input change
+        https://bugs.webkit.org/show_bug.cgi?id=63702
+
+        This change fixes a few popup layout issues, some of which have existed for quite a while:
+        - the absence of the ChromeClientImpl::screenToWindow() implementation (the method used to always return (0, 0));
+        - the confusion of window and screen coordinates passed into the autofill popup client's setWindowRect() method;
+        - the use of the current frameRect() width as the target element's width (which was wrong when refreshing
+          a popup resized during the initial layout (e.g. made wider than the target element)).
+
+        No new tests, as this is a change to platform-specific widget code. The test case is provided in the bug description.
+
+        * platform/chromium/PopupMenuChromium.cpp:
+        (WebCore::PopupContainer::layoutAndGetRTLOffset): Use original target element width, not frameRect().width(),
+        since the latter gets updated if the popup is not the same width as the target element.
+        (WebCore::PopupContainer::refresh): Restore only the popup bounds rather than its original rectangle,
+        since it sometimes breaks the invalidation region and layout.
+
 2011-06-30  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r90102.

Modified: trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp (90118 => 90119)


--- trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp	2011-06-30 14:30:19 UTC (rev 90118)
+++ trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp	2011-06-30 14:45:21 UTC (rev 90119)
@@ -468,17 +468,16 @@
     // Place the listbox within our border.
     m_listBox->move(kBorderSize, kBorderSize);
 
-    // popupWidth is the width of <select> element. Record it before resize frame.
-    int popupWidth = frameRect().width();
     // Size ourselves to contain listbox + border.
     int listBoxWidth = m_listBox->width() + kBorderSize * 2;
     resize(listBoxWidth, m_listBox->height() + kBorderSize * 2);
     invalidate();
 
     // Compute the starting x-axis for a normal RTL or right-aligned LTR dropdown. For those,
-    // the right edge of dropdown box should be aligned with the right edge of <select> element box,
+    // the right edge of dropdown box should be aligned with the right edge of <select>/<input> element box,
     // and the dropdown box should be expanded to the left if more space is needed.
-    return popupWidth - listBoxWidth;
+    // m_originalFrameRect.width() is the width of the target <select>/<input> element.
+    return m_originalFrameRect.width() - listBoxWidth;
 }
 
 bool PopupContainer::handleMouseDownEvent(const PlatformMouseEvent& event)
@@ -596,7 +595,7 @@
     location.move(0, targetControlRect.height());
 
     listBox()->setBaseWidth(max(m_originalFrameRect.width() - kBorderSize * 2, 0));
-    setFrameRect(m_originalFrameRect);
+    setBoundsSize(m_originalFrameRect.size());
 
     listBox()->updateFromElement();
     // Store the original size to check if we need to request the location.

Modified: trunk/Source/WebKit/chromium/ChangeLog (90118 => 90119)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-06-30 14:30:19 UTC (rev 90118)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-06-30 14:45:21 UTC (rev 90119)
@@ -1,3 +1,15 @@
+2011-06-30  Alexander Pavlov  <[email protected]>
+
+        Reviewed by Kent Tamura.
+
+        [Chromium] Autofill suggestions appear in upper left corner after input change
+        https://bugs.webkit.org/show_bug.cgi?id=63702
+
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::screenToWindow): Implemented.
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::refreshAutoFillPopup): Pass screen (not window) coordinates into setWindowRect().
+
 2011-06-30  Kentaro Hara  <[email protected]>
 
         Reviewed by Kent Tamura.

Modified: trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp (90118 => 90119)


--- trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2011-06-30 14:30:19 UTC (rev 90118)
+++ trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2011-06-30 14:45:21 UTC (rev 90119)
@@ -565,10 +565,16 @@
 #endif
 }
 
-IntPoint ChromeClientImpl::screenToWindow(const IntPoint&) const
+IntPoint ChromeClientImpl::screenToWindow(const IntPoint& point) const
 {
-    notImplemented();
-    return IntPoint();
+    IntPoint windowPoint(point);
+
+    if (m_webView->client()) {
+        WebRect windowRect = m_webView->client()->windowRect();
+        windowPoint.move(-windowRect.x, -windowRect.y);
+    }
+
+    return windowPoint;
 }
 
 IntRect ChromeClientImpl::windowToScreen(const IntRect& rect) const

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (90118 => 90119)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-06-30 14:30:19 UTC (rev 90118)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-06-30 14:45:21 UTC (rev 90119)
@@ -2361,7 +2361,7 @@
         WebPopupMenuImpl* popupMenu =
             static_cast<WebPopupMenuImpl*>(m_autoFillPopup->client());
         if (popupMenu)
-            popupMenu->client()->setWindowRect(newBounds);
+            popupMenu->client()->setWindowRect(m_chromeClientImpl.windowToScreen(newBounds));
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to