Changeset 57992 in webkit


Ignore:
Timestamp:
Apr 21, 2010 10:30:09 AM (14 years ago)
Author:
xji@chromium.org
Message:

2010-04-21 Xiaomei Ji <xji@chromium.org>

Reviewed by Dimitri Glazkov

This patch fixes [chromium] RTL <select> dropdown box expands to right
instead of left.
https://bugs.webkit.org/show_bug.cgi?id=37232

No automatic test is possible.

  • manual-tests/select_dropdown_box_alignment.html: Added.
  • platform/chromium/PopupMenuChromium.cpp: (WebCore::PopupContainer::layout): Adjust the x-axis of dropdown box for RTL.
Location:
trunk/WebCore
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r57991 r57992  
     12010-04-21  Xiaomei Ji  <xji@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov
     4
     5        This patch fixes [chromium] RTL <select> dropdown box expands to right
     6        instead of left.
     7        https://bugs.webkit.org/show_bug.cgi?id=37232
     8
     9        No automatic test is possible.
     10
     11        * manual-tests/select_dropdown_box_alignment.html: Added.
     12        * platform/chromium/PopupMenuChromium.cpp:
     13        (WebCore::PopupContainer::layout): Adjust the x-axis of dropdown box
     14        for RTL.
     15
    1162010-04-21  anton muhin  <antonm@google.com>
    217
  • trunk/WebCore/platform/chromium/PopupMenuChromium.cpp

    r57891 r57992  
    432432    m_listBox->move(kBorderSize, kBorderSize);
    433433
     434    // popupWidth is the width of <select> element. Record it before resize frame.
     435    int popupWidth = frameRect().width();
    434436    // Size ourselves to contain listbox + border.
    435     resize(m_listBox->width() + kBorderSize * 2, m_listBox->height() + kBorderSize * 2);
    436 
     437    int listBoxWidth = m_listBox->width() + kBorderSize * 2;
     438    resize(listBoxWidth, m_listBox->height() + kBorderSize * 2);
     439
     440    // Adjust the starting x-axis for RTL dropdown. For RTL dropdown, the right edge
     441    // of dropdown box should be aligned with the right edge of <select> element box,
     442    // and the dropdown box should be expanded to left if more space needed.
     443    PopupMenuClient* popupClient = m_listBox->m_popupClient;
     444    if (popupClient) {
     445        bool rightAligned = m_listBox->m_popupClient->menuStyle().textDirection() == RTL;
     446        if (rightAligned)
     447            move(x() + popupWidth - listBoxWidth, y());
     448    }
    437449    invalidate();
    438450}
Note: See TracChangeset for help on using the changeset viewer.