Changeset 80448 in webkit


Ignore:
Timestamp:
Mar 6, 2011 8:50:05 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-03-06 Naoki Takano <takano.naoki@gmail.com>

Reviewed by Kent Tamura.

[Chromium] Autocomplete suggestion extends out of window (and onto second monitor)
https://bugs.webkit.org/show_bug.cgi?id=54795

Implement width clip logic according to browser screen width and popup window width. This fix is enough for Win and Mac, but there is a problem in Linux. Because WebScreenInfoFactory::screenInfo() can get only merged screen size, not the screen size where the browser exists.

Test: manual-tests/popup-width-restriction-within-screen.html

  • manual-tests/popup-width-restriction-within-screen.html: Added.
  • platform/chromium/PopupMenuChromium.cpp: (WebCore::PopupContainer::layoutAndCalculateWidgetRect): Implement the width clip logic according to screen width.
Location:
trunk/Source/WebCore
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r80446 r80448  
     12011-03-06  Naoki Takano  <takano.naoki@gmail.com>
     2
     3        Reviewed by Kent Tamura.
     4
     5        [Chromium] Autocomplete suggestion extends out of window (and onto second monitor)
     6        https://bugs.webkit.org/show_bug.cgi?id=54795
     7
     8        Implement width clip logic according to browser screen width and popup window width. This fix is enough for Win and Mac, but there is a problem in Linux. Because WebScreenInfoFactory::screenInfo() can get only merged screen size, not the screen size where the browser exists.
     9
     10        Test: manual-tests/popup-width-restriction-within-screen.html
     11
     12        * manual-tests/popup-width-restriction-within-screen.html: Added.
     13        * platform/chromium/PopupMenuChromium.cpp:
     14        (WebCore::PopupContainer::layoutAndCalculateWidgetRect): Implement the width clip logic according to screen width.
     15
    1162011-03-06  Yuta Kitamura  <yutak@chromium.org>
    217
  • trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp

    r79294 r80448  
    352352        // needs to be considered.
    353353        widgetRect = chromeClient->windowToScreen(IntRect(popupInitialCoordinate.x() + rightOffset, popupInitialCoordinate.y(), targetSize.width(), targetSize.height()));
     354
     355        // If we have multiple screens and the browser rect is in one screen, we have
     356        // to clip the window width to the screen width.
     357        FloatRect windowRect = chromeClient->windowRect();
     358        if (windowRect.x() >= screen.x() && windowRect.maxX() <= screen.maxX()) {
     359            if (m_listBox->m_popupClient->menuStyle().textDirection() == RTL && widgetRect.x() < screen.x()) {
     360                widgetRect.setWidth(widgetRect.maxX() - screen.x());
     361                widgetRect.setX(screen.x());
     362            } else if (widgetRect.maxX() > screen.maxX())
     363                widgetRect.setWidth(screen.maxX() - widgetRect.x());
     364        }
     365
     366        // Calculate Y axis size.
    354367        if (widgetRect.maxY() > static_cast<int>(screen.maxY())) {
    355368            if (widgetRect.y() - widgetRect.height() - targetControlHeight > 0) {
     
    366379                    m_listBox->setMaxHeight(spaceBelow);
    367380                layoutAndGetRightOffset();
    368                 // Our size has changed, recompute the widgetRect.
    369                 widgetRect = chromeClient->windowToScreen(frameRect());
     381                // Our height has changed, so recompute only Y axis of widgetRect.
     382                // We don't have to recompute X axis, so we only replace Y axis
     383                // in widgetRect.
     384                IntRect frameInScreen = chromeClient->windowToScreen(frameRect());
     385                widgetRect.setY(frameInScreen.y());
     386                widgetRect.setHeight(frameInScreen.height());
    370387                // And move upwards if necessary.
    371388                if (spaceAbove > spaceBelow)
Note: See TracChangeset for help on using the changeset viewer.