Source/WebCore: <rdar://problem/4761512> <select> can't display right-to-left (rtl...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Jan 2011 21:34:55 +0000 (21:34 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Jan 2011 21:34:55 +0000 (21:34 +0000)
commit617833d6bcba36fb96832025ebe645499ebb19a0
tree63eac247be961a419adc3ea5e9cc02ba7ea0ba2e
parent0495c70f58924057adcd79ed45ee4b0627fcf99c
Source/WebCore: <rdar://problem/4761512> <select> can't display right-to-left (rtl) languages
https://bugs.webkit.org/show_bug.cgi?id=19785

Reviewed by Sam Weinig.

Changed <select> pop-up menus on Mac OS X Snow Leopard and later to have their items aligned in the
direction corresponding to the writing direction of the <select> element, with the checkmarks
on the "start" side, and use the <option>'s writing direction rather than "natural". Made the
pop-up button match the menu by adding a Chrome boolean function, selectItemAlignmentFollowsMenuWritingDirection(),
which returns true for this pop-up behavior.

* loader/EmptyClients.h:
(WebCore::EmptyChromeClient::selectItemAlignmentFollowsMenuWritingDirection): Added.
* manual-tests/pop-up-alignment-and-direction.html: Added.
* page/Chrome.cpp:
(WebCore::Chrome::selectItemAlignmentFollowsMenuWritingDirection): Added. Calls through to the
client.
* page/Chrome.h:
* page/ChromeClient.h:
* platform/PopupMenuStyle.h:
(WebCore::PopupMenuStyle::PopupMenuStyle): Added hasTextDirectionOverride parameter and member
variable initialization.
(WebCore::PopupMenuStyle::hasTextDirectionOverride): Added this accessor.
* platform/mac/PopupMenuMac.mm:
(WebCore::PopupMenuMac::populate): Set the pop-up's layout direction and items' text alignment
to match the menu's writing direction. Set items' writing direction and direction override
according to their styles.
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::RenderMenuList): Removed unncesaary initialization of a smart pointer.
(WebCore::RenderMenuList::adjustInnerStyle): If the alignment of items in the menu follows the
menu's writing direction, use that alignment for the button as well. Also in this mode, use the
item's writing direction and override setting.
(WebCore::RenderMenuList::setTextFromOption): Store the option element's style.
(WebCore::RenderMenuList::itemStyle): Pass the text direction override value.
(WebCore::RenderMenuList::menuStyle): Ditto. Also use the button's direction, not the inner text's.
* rendering/RenderMenuList.h:
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::menuStyle): Pass the text direction override value.

Source/WebKit/chromium: <select> can't display right-to-left (rtl) languages
https://bugs.webkit.org/show_bug.cgi?id=19785

Reviewed by Sam Weinig.

* src/AutoFillPopupMenuClient.cpp:
(WebKit::AutoFillPopupMenuClient::initialize): Pass hasTextDirectionOverride to the PopupMenuStyle
constructor.
* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::selectItemAlignmentFollowsMenuWritingDirection): Added.
* src/ChromeClientImpl.h:
* tests/PopupMenuTest.cpp:
(WebKit::TestPopupMenuClient::itemStyle): Pass hasTextDirectionOverride to the PopupMenuStyle
constructor.

Source/WebKit/efl: <select> can't display right-to-left (rtl) languages
https://bugs.webkit.org/show_bug.cgi?id=19785

Reviewed by Sam Weinig.

* WebCoreSupport/ChromeClientEfl.cpp:
(WebCore::ChromeClientEfl::selectItemAlignmentFollowsMenuWritingDirection): Added.
* WebCoreSupport/ChromeClientEfl.h:

Source/WebKit/gtk: <select> can't display right-to-left (rtl) languages
https://bugs.webkit.org/show_bug.cgi?id=19785

Reviewed by Sam Weinig.

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::selectItemAlignmentFollowsMenuWritingDirection): Added.
* WebCoreSupport/ChromeClientGtk.h:

Source/WebKit/haiku: <select> can't display right-to-left (rtl) languages
https://bugs.webkit.org/show_bug.cgi?id=19785

Reviewed by Sam Weinig.

* WebCoreSupport/ChromeClientHaiku.cpp:
(WebCore::ChromeClientHaiku::selectItemAlignmentFollowsMenuWritingDirection): Added.
* WebCoreSupport/ChromeClientHaiku.h:

Source/WebKit/mac: <select> can't display right-to-left (rtl) languages
https://bugs.webkit.org/show_bug.cgi?id=19785

Reviewed by Sam Weinig.

* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::selectItemWritingDirectionIsNatural): Changed to return false.
(WebChromeClient::selectItemAlignmentFollowsMenuWritingDirection): Added. Returns true.

Source/WebKit/qt: <select> can't display right-to-left (rtl) languages
https://bugs.webkit.org/show_bug.cgi?id=19785

Reviewed by Sam Weinig.

* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::selectItemAlignmentFollowsMenuWritingDirection): Added.
* WebCoreSupport/ChromeClientQt.h:

Source/WebKit/win: <select> can't display right-to-left (rtl) languages
https://bugs.webkit.org/show_bug.cgi?id=19785

Reviewed by Sam Weinig.

* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::selectItemAlignmentFollowsMenuWritingDirection): Added.
* WebCoreSupport/WebChromeClient.h:

Source/WebKit/wince: <select> can't display right-to-left (rtl) languages
https://bugs.webkit.org/show_bug.cgi?id=19785

Reviewed by Sam Weinig.

* WebCoreSupport/ChromeClientWinCE.cpp:
(WebKit::ChromeClientWinCE::selectItemAlignmentFollowsMenuWritingDirection): Added.
* WebCoreSupport/ChromeClientWinCE.h:

Source/WebKit/wx: <select> can't display right-to-left (rtl) languages
https://bugs.webkit.org/show_bug.cgi?id=19785

Reviewed by Sam Weinig.

* WebKitSupport/ChromeClientWx.cpp:
(WebCore::ChromeClientWx::selectItemAlignmentFollowsMenuWritingDirection): Added.
* WebKitSupport/ChromeClientWx.h:

Source/WebKit2: <select> can't display right-to-left (rtl) languages
https://bugs.webkit.org/show_bug.cgi?id=19785

Reviewed by Sam Weinig.

* Shared/WebPopupItem.cpp:
(WebKit::WebPopupItem::WebPopupItem): Added initializers for m_textDirection and m_hasTextDirectionOverride.
(WebKit::WebPopupItem::encode): Encode the item's writing direction and direction override values.
(WebKit::WebPopupItem::decode): Decode the item's writing direction and direction override values.
* Shared/WebPopupItem.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::showPopupMenu): Added a parameter for the menu's text direction.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in: Ditto.
* UIProcess/WebPopupMenuProxy.h:
* UIProcess/mac/WebPopupMenuProxyMac.h:
* UIProcess/mac/WebPopupMenuProxyMac.mm:
(WebKit::WebPopupMenuProxyMac::populate): Added a parameter for the menu's text direction.
Set items' text alignment to match the menu's writing direction. Set items' writing direction
and direction override according to their styles.
(WebKit::WebPopupMenuProxyMac::showPopupMenu): Set the pop-up's layout direction.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::selectItemWritingDirectionIsNatural): Changed to return false.
(WebKit::WebChromeClient::selectItemAlignmentFollowsMenuWritingDirection): Added.
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/WebPopupMenu.cpp:
(WebKit::WebPopupMenu::populateItems): Initialize items' writing direction and direction override
values.
(WebKit::WebPopupMenu::show): Pass the menu's writing direction.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76983 268f45cc-cd09-0410-ab3c-d52691b4dbfc
56 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/EmptyClients.h
Source/WebCore/manual-tests/pop-up-alignment-and-direction.html [new file with mode: 0644]
Source/WebCore/page/Chrome.cpp
Source/WebCore/page/Chrome.h
Source/WebCore/page/ChromeClient.h
Source/WebCore/platform/PopupMenuStyle.h
Source/WebCore/platform/mac/PopupMenuMac.mm
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderMenuList.h
Source/WebCore/rendering/RenderTextControlSingleLine.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/AutoFillPopupMenuClient.cpp
Source/WebKit/chromium/src/ChromeClientImpl.cpp
Source/WebKit/chromium/src/ChromeClientImpl.h
Source/WebKit/chromium/tests/PopupMenuTest.cpp
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
Source/WebKit/haiku/ChangeLog
Source/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp
Source/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/win/WebCoreSupport/WebChromeClient.h
Source/WebKit/wince/ChangeLog
Source/WebKit/wince/WebCoreSupport/ChromeClientWinCE.cpp
Source/WebKit/wince/WebCoreSupport/ChromeClientWinCE.h
Source/WebKit/wx/ChangeLog
Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
Source/WebKit/wx/WebKitSupport/ChromeClientWx.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPopupItem.cpp
Source/WebKit2/Shared/WebPopupItem.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/WebPopupMenuProxy.h
Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h
Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h
Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp