| Differences between
and this patch
- Source/WebCore/ChangeLog +23 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2011-02-02  Xiaomei Ji  <xji@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Implement "<option> should support the dir attribute and be displayed accordingly both in the drop-down and after being chosen" for chromium port after r76983.
6
        https://bugs.webkit.org/show_bug.cgi?id=50969
7
       
8
        Override selectItemAlignmentFollowsMenuWritingDirection() as true in Chromium
9
        so that <option> is displayed according to its dir attribute when chosen.
10
        And chromium port already implemented supporting paint items in drop-down using
11
        item's directionality. But that feature was turned on only for autofill.
12
        Turn on it for <select>.
13
14
        Use manual test Source/WebCore/manual-tests/pop-up-alignment-and-direction.html
15
        added in r76983.
16
17
        * platform/chromium/PopupMenuChromium.cpp: Remove directionality hint from
18
        <select> drop-down setting.
19
        (WebCore::PopupListBox::paintRow): Use <option>'s directionality to paint
20
        items in drop-down and pass-in bidi override flag when creating text run.
21
        * platform/chromium/PopupMenuChromium.h: Remove directionalityHint from
22
        PopupContainerSettings.
23
1
2011-02-02  Mark Rowe  <mrowe@apple.com>
24
2011-02-02  Mark Rowe  <mrowe@apple.com>
2
25
3
        Build fix.
26
        Build fix.
- Source/WebCore/platform/chromium/PopupMenuChromium.cpp -14 / +7 lines
Lines 78-89 static const TimeStamp kTypeAheadTimeout Source/WebCore/platform/chromium/PopupMenuChromium.cpp_sec1
78
// The settings used for the drop down menu.
78
// The settings used for the drop down menu.
79
// This is the delegate used if none is provided.
79
// This is the delegate used if none is provided.
80
static const PopupContainerSettings dropDownSettings = {
80
static const PopupContainerSettings dropDownSettings = {
81
    true,   // setTextOnIndexChange
81
    true, // setTextOnIndexChange
82
    true,   // acceptOnAbandon
82
    true, // acceptOnAbandon
83
    false,  // loopSelectionNavigation
83
    false, // loopSelectionNavigation
84
    false,  // restrictWidthOfListBox
84
    false // restrictWidthOfListBox
85
    // display item text in its first strong directional character's directionality.
86
    PopupContainerSettings::FirstStrongDirectionalCharacterDirection,
87
};
85
};
88
86
89
// This class uses WebCore code to paint and handle events for a drop-down list
87
// This class uses WebCore code to paint and handle events for a drop-down list
Lines 966-978 void PopupListBox::paintRow(GraphicsCont Source/WebCore/platform/chromium/PopupMenuChromium.cpp_sec2
966
    }
964
    }
967
965
968
    // Prepare the directionality to draw text.
966
    // Prepare the directionality to draw text.
969
    bool rtl = false;
967
    bool rtl = style.textDirection() == RTL;
970
    if (m_settings.itemTextDirectionalityHint == PopupContainerSettings::DOMElementDirection)
968
    TextRun textRun(itemText.characters(), itemText.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl, style.hasTextDirectionOverride());
971
        rtl = style.textDirection() == RTL;
972
    else if (m_settings.itemTextDirectionalityHint ==
973
             PopupContainerSettings::FirstStrongDirectionalCharacterDirection)
974
        rtl = itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft;
975
    TextRun textRun(itemText.characters(), itemText.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl);
976
    // If the text is right-to-left, make it right-aligned by adjusting its
969
    // If the text is right-to-left, make it right-aligned by adjusting its
977
    // beginning position.
970
    // beginning position.
978
    if (rightAligned)
971
    if (rightAligned)
Lines 1000-1006 void PopupListBox::paintRow(GraphicsCont Source/WebCore/platform/chromium/PopupMenuChromium.cpp_sec3
1000
    // Draw the the label if applicable.
993
    // Draw the the label if applicable.
1001
    if (itemLabel.isEmpty())
994
    if (itemLabel.isEmpty())
1002
        return;
995
        return;
1003
    TextRun labelTextRun(itemLabel.characters(), itemLabel.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl);
996
    TextRun labelTextRun(itemLabel.characters(), itemLabel.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl, style.hasTextDirectionOverride());
1004
    if (rightAligned)
997
    if (rightAligned)
1005
        textX = max(0, m_popupClient->clientPaddingLeft() - m_popupClient->clientInsetLeft());
998
        textX = max(0, m_popupClient->clientPaddingLeft() - m_popupClient->clientInsetLeft());
1006
    else
999
    else
- Source/WebCore/platform/chromium/PopupMenuChromium.h -16 lines
Lines 97-118 struct PopupContainerSettings { Source/WebCore/platform/chromium/PopupMenuChromium.h_sec1
97
    // Whether we should restrict the width of the PopupListBox or not.
97
    // Whether we should restrict the width of the PopupListBox or not.
98
    // Autocomplete popups are restricted, combo-boxes (select tags) aren't.
98
    // Autocomplete popups are restricted, combo-boxes (select tags) aren't.
99
    bool restrictWidthOfListBox;
99
    bool restrictWidthOfListBox;
100
101
    // A hint on the display directionality of the item text in popup menu.
102
    //
103
    // We could either display the items in the drop-down using its DOM element's
104
    // directionality, or we could display the items in the drop-down using heuristics:
105
    // such as in its first strong directionality character's direction.
106
    // Please refer to the discussion (especially comment #7 and #10) in
107
    // https://bugs.webkit.org/show_bug.cgi?id=27889 for details.
108
    enum DirectionalityHint {
109
        // Use the DOM element's directionality to display the item text in popup menu.
110
        DOMElementDirection,
111
        // Use the item text's first strong-directional character's directionality
112
        // to display the item text in popup menu.
113
        FirstStrongDirectionalCharacterDirection,
114
    };
115
    DirectionalityHint itemTextDirectionalityHint;
116
};
100
};
117
101
118
class PopupContainer : public FramelessScrollView {
102
class PopupContainer : public FramelessScrollView {
- Source/WebKit/chromium/ChangeLog +17 lines
Lines 1-3 Source/WebKit/chromium/ChangeLog_sec1
1
2011-02-02  Xiaomei Ji  <xji@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Implement "<option> should support the dir attribute and be displayed accordingly both in the drop-down and after being chosen" for chromium port after r76983.
6
        https://bugs.webkit.org/show_bug.cgi?id=50969
7
8
        Override selectItemAlignmentFollowsMenuWritingDirection() as true in Chromium
9
        so that <option> is displayed according to its dir attribute when chosen.
10
        And chromium port already implemented supporting paint items in drop-down using
11
        item's directionality. But that feature was turned on only for autofill.
12
        Turn on it for <select>.
13
14
        * src/ChromeClientImpl.cpp:
15
        (WebKit::ChromeClientImpl::selectItemAlignmentFollowsMenuWritingDirection): Override as true.
16
        * src/WebViewImpl.cpp: Remove directionality hint from autofill drop-down setting.
17
1
2011-02-02  Evan Martin  <evan@chromium.org>
18
2011-02-02  Evan Martin  <evan@chromium.org>
2
19
3
        Unreviewed, DEPS change.
20
        Unreviewed, DEPS change.
- Source/WebKit/chromium/src/ChromeClientImpl.cpp -1 / +1 lines
Lines 855-861 bool ChromeClientImpl::selectItemWriting Source/WebKit/chromium/src/ChromeClientImpl.cpp_sec1
855
855
856
bool ChromeClientImpl::selectItemAlignmentFollowsMenuWritingDirection()
856
bool ChromeClientImpl::selectItemAlignmentFollowsMenuWritingDirection()
857
{
857
{
858
    return false;
858
    return true;
859
}
859
}
860
860
861
PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(PopupMenuClient* client) const
861
PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(PopupMenuClient* client) const
- Source/WebKit/chromium/src/WebViewImpl.cpp -7 / +3 lines
Lines 201-213 COMPILE_ASSERT_MATCHING_ENUM(DragOperati Source/WebKit/chromium/src/WebViewImpl.cpp_sec1
201
static const PopupContainerSettings autoFillPopupSettings = {
201
static const PopupContainerSettings autoFillPopupSettings = {
202
    false, // setTextOnIndexChange
202
    false, // setTextOnIndexChange
203
    false, // acceptOnAbandon
203
    false, // acceptOnAbandon
204
    true,  // loopSelectionNavigation
204
    true, // loopSelectionNavigation
205
    false, // restrictWidthOfListBox (For security reasons show the entire entry
205
    false // restrictWidthOfListBox (For security reasons show the entire entry
206
           // so the user doesn't enter information he did not intend to.)
206
          // so the user doesn't enter information he did not intend to.)
207
    // For suggestions, we use the direction of the input field as the direction
208
    // of the popup items. The main reason is to keep the display of items in
209
    // drop-down the same as the items in the input field.
210
    PopupContainerSettings::DOMElementDirection,
211
};
207
};
212
208
213
static bool shouldUseExternalPopupMenus = false;
209
static bool shouldUseExternalPopupMenus = false;

Return to Bug 50969