Changeset 90119 in webkit


Ignore:
Timestamp:
Jun 30, 2011, 7:45:21 AM (14 years ago)
Author:
apavlov@chromium.org
Message:

2011-06-30 Alexander Pavlov <apavlov@chromium.org>

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 <apavlov@chromium.org>

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().
Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90117 r90119  
     12011-06-30  Alexander Pavlov  <apavlov@chromium.org>
     2
     3        Reviewed by Kent Tamura.
     4
     5        [Chromium] Autofill suggestions appear in upper left corner after input change
     6        https://bugs.webkit.org/show_bug.cgi?id=63702
     7
     8        This change fixes a few popup layout issues, some of which have existed for quite a while:
     9        - the absence of the ChromeClientImpl::screenToWindow() implementation (the method used to always return (0, 0));
     10        - the confusion of window and screen coordinates passed into the autofill popup client's setWindowRect() method;
     11        - the use of the current frameRect() width as the target element's width (which was wrong when refreshing
     12          a popup resized during the initial layout (e.g. made wider than the target element)).
     13
     14        No new tests, as this is a change to platform-specific widget code. The test case is provided in the bug description.
     15
     16        * platform/chromium/PopupMenuChromium.cpp:
     17        (WebCore::PopupContainer::layoutAndGetRTLOffset): Use original target element width, not frameRect().width(),
     18        since the latter gets updated if the popup is not the same width as the target element.
     19        (WebCore::PopupContainer::refresh): Restore only the popup bounds rather than its original rectangle,
     20        since it sometimes breaks the invalidation region and layout.
     21
    1222011-06-30  Sheriff Bot  <webkit.review.bot@gmail.com>
    223
  • trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp

    r89916 r90119  
    469469    m_listBox->move(kBorderSize, kBorderSize);
    470470
    471     // popupWidth is the width of <select> element. Record it before resize frame.
    472     int popupWidth = frameRect().width();
    473471    // Size ourselves to contain listbox + border.
    474472    int listBoxWidth = m_listBox->width() + kBorderSize * 2;
     
    477475
    478476    // Compute the starting x-axis for a normal RTL or right-aligned LTR dropdown. For those,
    479     // the right edge of dropdown box should be aligned with the right edge of <select> element box,
     477    // the right edge of dropdown box should be aligned with the right edge of <select>/<input> element box,
    480478    // and the dropdown box should be expanded to the left if more space is needed.
    481     return popupWidth - listBoxWidth;
     479    // m_originalFrameRect.width() is the width of the target <select>/<input> element.
     480    return m_originalFrameRect.width() - listBoxWidth;
    482481}
    483482
     
    597596
    598597    listBox()->setBaseWidth(max(m_originalFrameRect.width() - kBorderSize * 2, 0));
    599     setFrameRect(m_originalFrameRect);
     598    setBoundsSize(m_originalFrameRect.size());
    600599
    601600    listBox()->updateFromElement();
  • trunk/Source/WebKit/chromium/ChangeLog

    r90101 r90119  
     12011-06-30  Alexander Pavlov  <apavlov@chromium.org>
     2
     3        Reviewed by Kent Tamura.
     4
     5        [Chromium] Autofill suggestions appear in upper left corner after input change
     6        https://bugs.webkit.org/show_bug.cgi?id=63702
     7
     8        * src/ChromeClientImpl.cpp:
     9        (WebKit::ChromeClientImpl::screenToWindow): Implemented.
     10        * src/WebViewImpl.cpp:
     11        (WebKit::WebViewImpl::refreshAutoFillPopup): Pass screen (not window) coordinates into setWindowRect().
     12
    1132011-06-30  Kentaro Hara  <haraken@google.com>
    214
  • trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp

    r89430 r90119  
    566566}
    567567
    568 IntPoint ChromeClientImpl::screenToWindow(const IntPoint&) const
    569 {
    570     notImplemented();
    571     return IntPoint();
     568IntPoint ChromeClientImpl::screenToWindow(const IntPoint& point) const
     569{
     570    IntPoint windowPoint(point);
     571
     572    if (m_webView->client()) {
     573        WebRect windowRect = m_webView->client()->windowRect();
     574        windowPoint.move(-windowRect.x, -windowRect.y);
     575    }
     576
     577    return windowPoint;
    572578}
    573579
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r89837 r90119  
    23622362            static_cast<WebPopupMenuImpl*>(m_autoFillPopup->client());
    23632363        if (popupMenu)
    2364             popupMenu->client()->setWindowRect(newBounds);
     2364            popupMenu->client()->setWindowRect(m_chromeClientImpl.windowToScreen(newBounds));
    23652365    }
    23662366}
Note: See TracChangeset for help on using the changeset viewer.