Changeset 77654 in webkit


Ignore:
Timestamp:
Feb 4, 2011 12:30:20 PM (13 years ago)
Author:
xji@chromium.org
Message:

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-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.
Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r77652 r77654  
     12011-02-04  Xiaomei Ji  <xji@chromium.org>
     2
     3        Reviewed by David Levin.
     4
     5        Implement "<option> should implement the dir attribute" for chromium port after r76983.
     6        https://bugs.webkit.org/show_bug.cgi?id=50969
     7
     8        Use manual test Source/WebCore/manual-tests/pop-up-alignment-and-direction.html
     9        added in r76983.
     10
     11        * platform/chromium/PopupMenuChromium.cpp: Remove directionality hint from
     12        <select> drop-down setting.
     13        (WebCore::PopupListBox::paintRow): Use <option>'s directionality to paint
     14        items in drop-down and pass-in bidi override flag when creating text run.
     15        * platform/chromium/PopupMenuChromium.h: Remove directionalityHint from
     16        PopupContainerSettings.
     17
    1182011-02-04  Jeremy Orlow  <jorlow@chromium.org>
    219
  • trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp

    r77424 r77654  
    7979// This is the delegate used if none is provided.
    8080static const PopupContainerSettings dropDownSettings = {
    81     true,   // setTextOnIndexChange
    82     true,   // acceptOnAbandon
    83     false,  // loopSelectionNavigation
    84     false,  // restrictWidthOfListBox
    85     // display item text in its first strong directional character's directionality.
    86     PopupContainerSettings::FirstStrongDirectionalCharacterDirection,
     81    true, // setTextOnIndexChange
     82    true, // acceptOnAbandon
     83    false, // loopSelectionNavigation
     84    false // restrictWidthOfListBox
    8785};
    8886
     
    969967
    970968    // Prepare the directionality to draw text.
    971     bool rtl = false;
    972     if (m_settings.itemTextDirectionalityHint == PopupContainerSettings::DOMElementDirection)
    973         rtl = style.textDirection() == RTL;
    974     else if (m_settings.itemTextDirectionalityHint ==
    975              PopupContainerSettings::FirstStrongDirectionalCharacterDirection)
    976         rtl = itemText.defaultWritingDirection() == WTF::Unicode::RightToLeft;
    977     TextRun textRun(itemText.characters(), itemText.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl);
     969    bool rtl = style.textDirection() == RTL;
     970    TextRun textRun(itemText.characters(), itemText.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl, style.hasTextDirectionOverride());
    978971    // If the text is right-to-left, make it right-aligned by adjusting its
    979972    // beginning position.
     
    1003996    if (itemLabel.isEmpty())
    1004997        return;
    1005     TextRun labelTextRun(itemLabel.characters(), itemLabel.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl);
     998    TextRun labelTextRun(itemLabel.characters(), itemLabel.length(), false, 0, 0, TextRun::AllowTrailingExpansion, rtl, style.hasTextDirectionOverride());
    1006999    if (rightAligned)
    10071000        textX = max(0, m_popupClient->clientPaddingLeft() - m_popupClient->clientInsetLeft());
  • trunk/Source/WebCore/platform/chromium/PopupMenuChromium.h

    r77370 r77654  
    9898    // Autocomplete popups are restricted, combo-boxes (select tags) aren't.
    9999    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;
    116100};
    117101
  • trunk/Source/WebKit/chromium/ChangeLog

    r77647 r77654  
     12011-02-04  Xiaomei Ji  <xji@chromium.org>
     2
     3        Reviewed by David Levin.
     4
     5        Implement "<option> should implement the dir attribute" for chromium port after r76983.
     6        https://bugs.webkit.org/show_bug.cgi?id=50969
     7
     8        * src/ChromeClientImpl.cpp:
     9        (WebKit::ChromeClientImpl::selectItemAlignmentFollowsMenuWritingDirection): Override as true.
     10        * src/WebViewImpl.cpp: Remove directionality hint from autofill drop-down setting.
     11
    1122011-02-01  Jeremy Orlow  <jorlow@chromium.org>
    213
  • trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp

    r77607 r77654  
    863863bool ChromeClientImpl::selectItemAlignmentFollowsMenuWritingDirection()
    864864{
    865     return false;
     865    return true;
    866866}
    867867
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r77406 r77654  
    202202    false, // setTextOnIndexChange
    203203    false, // acceptOnAbandon
    204     true,  // loopSelectionNavigation
    205     false, // restrictWidthOfListBox (For security reasons show the entire entry
    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,
     204    true, // loopSelectionNavigation
     205    false // restrictWidthOfListBox (For security reasons show the entire entry
     206          // so the user doesn't enter information he did not intend to.)
    211207};
    212208
Note: See TracChangeset for help on using the changeset viewer.