Reviewed by David Levin.
Implement "<option> should implement the dir attribute" for chromium port after r76983.
https://bugs.webkit.org/show_bug.cgi?id=50969
* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::selectItemAlignmentFollowsMenuWritingDirection): Override as true.
* src/WebViewImpl.cpp: Remove directionality hint from autofill drop-down setting.
2011-02-04 Xiaomei Ji <xji@chromium.org>
Reviewed by David Levin.
Implement "<option> should implement the dir attribute" for chromium port after r76983.
https://bugs.webkit.org/show_bug.cgi?id=50969
Use manual test Source/WebCore/manual-tests/pop-up-alignment-and-direction.html
added in r76983.
* platform/chromium/PopupMenuChromium.cpp: Remove directionality hint from
<select> drop-down setting.
(WebCore::PopupListBox::paintRow): Use <option>'s directionality to paint
items in drop-down and pass-in bidi override flag when creating text run.
* platform/chromium/PopupMenuChromium.h: Remove directionalityHint from
PopupContainerSettings.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77654
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-02-04 Xiaomei Ji <xji@chromium.org>
+
+ Reviewed by David Levin.
+
+ Implement "<option> should implement the dir attribute" for chromium port after r76983.
+ https://bugs.webkit.org/show_bug.cgi?id=50969
+
+ Use manual test Source/WebCore/manual-tests/pop-up-alignment-and-direction.html
+ added in r76983.
+
+ * platform/chromium/PopupMenuChromium.cpp: Remove directionality hint from
+ <select> drop-down setting.
+ (WebCore::PopupListBox::paintRow): Use <option>'s directionality to paint
+ items in drop-down and pass-in bidi override flag when creating text run.
+ * platform/chromium/PopupMenuChromium.h: Remove directionalityHint from
+ PopupContainerSettings.
+
2011-02-04 Jeremy Orlow <jorlow@chromium.org>
Build fix from merge mistake.
// The settings used for the drop down menu.
// This is the delegate used if none is provided.
static const PopupContainerSettings dropDownSettings = {
- true, // setTextOnIndexChange
- true, // acceptOnAbandon
- false, // loopSelectionNavigation
- false, // restrictWidthOfListBox
- // display item text in its first strong directional character's directionality.
- PopupContainerSettings::FirstStrongDirectionalCharacterDirection,
+ true, // setTextOnIndexChange
+ true, // acceptOnAbandon
+ false, // loopSelectionNavigation
+ false // restrictWidthOfListBox
};
// This class uses WebCore code to paint and handle events for a drop-down list
}
// Prepare the directionality to draw text.
- bool rtl = false;
- if (m_settings.itemTextDirectionalityHint == PopupContainerSettings::DOMElementDirection)
- rtl = style.textDirection() == RTL;
- else if (m_settings.itemTextDirectionalityHint ==
- PopupContainerSettings::FirstStrongDirectionalCharacterDirection)
- rtl = itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft;
- TextRun textRun(itemText.characters(), itemText.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl);
+ bool rtl = style.textDirection() == RTL;
+ TextRun textRun(itemText.characters(), itemText.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl, style.hasTextDirectionOverride());
// If the text is right-to-left, make it right-aligned by adjusting its
// beginning position.
if (rightAligned)
// Draw the the label if applicable.
if (itemLabel.isEmpty())
return;
- TextRun labelTextRun(itemLabel.characters(), itemLabel.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl);
+ TextRun labelTextRun(itemLabel.characters(), itemLabel.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl, style.hasTextDirectionOverride());
if (rightAligned)
textX = max(0, m_popupClient->clientPaddingLeft() - m_popupClient->clientInsetLeft());
else
// Whether we should restrict the width of the PopupListBox or not.
// Autocomplete popups are restricted, combo-boxes (select tags) aren't.
bool restrictWidthOfListBox;
-
- // A hint on the display directionality of the item text in popup menu.
- //
- // We could either display the items in the drop-down using its DOM element's
- // directionality, or we could display the items in the drop-down using heuristics:
- // such as in its first strong directionality character's direction.
- // Please refer to the discussion (especially comment #7 and #10) in
- // https://bugs.webkit.org/show_bug.cgi?id=27889 for details.
- enum DirectionalityHint {
- // Use the DOM element's directionality to display the item text in popup menu.
- DOMElementDirection,
- // Use the item text's first strong-directional character's directionality
- // to display the item text in popup menu.
- FirstStrongDirectionalCharacterDirection,
- };
- DirectionalityHint itemTextDirectionalityHint;
};
class PopupContainer : public FramelessScrollView {
+2011-02-04 Xiaomei Ji <xji@chromium.org>
+
+ Reviewed by David Levin.
+
+ Implement "<option> should implement the dir attribute" for chromium port after r76983.
+ https://bugs.webkit.org/show_bug.cgi?id=50969
+
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::selectItemAlignmentFollowsMenuWritingDirection): Override as true.
+ * src/WebViewImpl.cpp: Remove directionality hint from autofill drop-down setting.
+
2011-02-01 Jeremy Orlow <jorlow@chromium.org>
Reviewed by Nate Chapin.
bool ChromeClientImpl::selectItemAlignmentFollowsMenuWritingDirection()
{
- return false;
+ return true;
}
PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(PopupMenuClient* client) const
static const PopupContainerSettings autoFillPopupSettings = {
false, // setTextOnIndexChange
false, // acceptOnAbandon
- true, // loopSelectionNavigation
- false, // restrictWidthOfListBox (For security reasons show the entire entry
- // so the user doesn't enter information he did not intend to.)
- // For suggestions, we use the direction of the input field as the direction
- // of the popup items. The main reason is to keep the display of items in
- // drop-down the same as the items in the input field.
- PopupContainerSettings::DOMElementDirection,
+ true, // loopSelectionNavigation
+ false // restrictWidthOfListBox (For security reasons show the entire entry
+ // so the user doesn't enter information he did not intend to.)
};
static bool shouldUseExternalPopupMenus = false;