Changeset 65967 in webkit


Ignore:
Timestamp:
Aug 24, 2010 8:05:10 PM (14 years ago)
Author:
dbates@webkit.org
Message:

2010-08-23 Daniel Bates <dbates@rim.com>

Reviewed by Darin Adler.

Suffix for CSS alphabetic list style types should fallback to
decimal for ordinals outside of their representable range
https://bugs.webkit.org/show_bug.cgi?id=44486

Test: fast/lists/w3-css3-list-styles-fallback-style.html

Fixes an issue where the decimal suffix is not used for
ordinals that cannot be represented by the alphabetic list
style type.

Currently, for ordinals that cannot be represented in the
alphabetic list style we use the suffix associated with the
list style. Instead, we should use the suffix for the decimal
list style ('.'). For instance, when the list style type is
Afar and the starting ordinal is 0, then we fallback to the
decimal list style suffix '.' because 0 cannot be represented
in Afar.

  • rendering/RenderListMarker.cpp: (WebCore::toRoman): Moved bounds check into WebCore::effectiveListMarkerType(). (WebCore::toAlphabetic): Ditto. (WebCore::toHebrew): Ditto. (WebCore::toArmenian): Ditto. (WebCore::toGeorgian): Ditto. (WebCore::toCJKIdeographic): Ditto. (WebCore::effectiveListMarkerType): Added. (WebCore::listMarkerSuffix): Added value parameter to prototype. Modified to call WebCore::effectiveListMarkerType. (WebCore::listMarkerText): Modified to call WebCore::effectiveListMarkerType(). (WebCore::RenderListMarker::paint): Modified to pass list item ordinal (i.e. m_listItem->value()) to WebCore::listMarkerSuffix(). (WebCore::RenderListMarker::calcPrefWidths): Ditto. (WebCore::RenderListMarker::getRelativeMarkerRect): Ditto.

2010-08-23 Daniel Bates <dbates@rim.com>

Reviewed by Darin Adler.

Suffix for CSS alphabetic list style types should fallback to
decimal for ordinals outside of their representable range
https://bugs.webkit.org/show_bug.cgi?id=44486

Tests that CSS list styles fallback to the decimal list style
for ordinals that cannot be represented. We need to implement
DRT support to test the actual suffix (see bug #44489).

Also, adds test for ordinal 0 for each numeric list style type.

  • fast/lists/resources/w3-css3-list-styles-alphabetic.css: Added.
  • fast/lists/w3-css3-list-styles-alphabetic.html: Moved CSS list styles to file w3-css3-list-styles-alphabetic.css,
  • fast/lists/w3-css3-list-styles-fallback-style-expected.txt: Added.
  • fast/lists/w3-css3-list-styles-fallback-style.html: Added.
  • fast/lists/w3-css3-list-styles-numeric-expected.txt: Added test for ordinal 0 for each list style type.
  • fast/lists/w3-css3-list-styles-numeric.html: Rebased result.
Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65966 r65967  
     12010-08-23  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Suffix for CSS alphabetic list style types should fallback to
     6        decimal for ordinals outside of their representable range
     7        https://bugs.webkit.org/show_bug.cgi?id=44486
     8
     9        Tests that CSS list styles fallback to the decimal list style
     10        for ordinals that cannot be represented. We need to implement
     11        DRT support to test the actual suffix (see bug #44489).
     12
     13        Also, adds test for ordinal 0 for each numeric list style type.
     14
     15        * fast/lists/resources/w3-css3-list-styles-alphabetic.css: Added.
     16        * fast/lists/w3-css3-list-styles-alphabetic.html: Moved CSS list styles to file w3-css3-list-styles-alphabetic.css,
     17        * fast/lists/w3-css3-list-styles-fallback-style-expected.txt: Added.
     18        * fast/lists/w3-css3-list-styles-fallback-style.html: Added.
     19        * fast/lists/w3-css3-list-styles-numeric-expected.txt: Added test for ordinal 0 for each list style type.
     20        * fast/lists/w3-css3-list-styles-numeric.html: Rebased result.
     21
    1222010-08-24  Kent Tamura  <tkent@chromium.org>
    223
  • trunk/LayoutTests/fast/lists/w3-css3-list-styles-alphabetic.html

    r64259 r65967  
    22<head>
    33    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     4    <link rel="stylesheet" href="resources/w3-css3-list-styles-alphabetic.css" type="text/css" charset="utf-8" />
    45    <style>
    56        .test ol { float: left; padding-right: 20px; }
    67        .test h2 { clear: left; }
    7        
    8         /*
    9         The following styles are ordered as they appear in section 4.4. of the
    10         Draft 7 November 2002 draft of the CSS3 Lists module <http://www.w3.org/TR/css3-lists/#alphabetic>.
    11         */
    12        
    13         ol.afar { list-style-type: afar; }
    14         ol.ethiopic-halehame-aa-et { list-style-type: ethiopic-halehame-aa-et; }
    15         ol.ethiopic-halehame-aa-er { list-style-type: ethiopic-halehame-aa-er; }
    16        
    17         ol.amharic { list-style-type: amharic; }
    18         ol.ethiopic-halehame-am-et { list-style-type: ethiopic-halehame-am-et; }
    19        
    20         ol.amharic-abegede { list-style-type: amharic-abegede; }
    21         ol.ethiopic-abegede-am-et { list-style-type: ethiopic-abegede-am-et; }
    22        
    23         ol.cjk-earthly-branch { list-style-type: cjk-earthly-branch; }
    24        
    25         ol.cjk-heavenly-stem { list-style-type: cjk-heavenly-stem; }
    26        
    27         ol.ethiopic { list-style-type: ethiopic; }
    28         ol.ethiopic-halehame-gez { list-style-type: ethiopic-halehame-gez; }
    29        
    30         ol.ethiopic-abegede { list-style-type: ethiopic-abegede; }
    31         ol.ethiopic-abegede-gez { list-style-type: ethiopic-abegede-gez; }
    32        
    33         ol.hangul-consonant { list-style-type: hangul-consonant; }
    34         ol.hangul { list-style-type: hangul; }
    35        
    36         ol.hiragana-iroha { list-style-type: hiragana-iroha; }
    37        
    38         ol.hiragana { list-style-type: hiragana; }
    39        
    40         ol.katakana-iroha { list-style-type: katakana-iroha; }
    41        
    42         ol.katakana { list-style-type: katakana; }
    43        
    44         ol.lower-alpha { list-style-type: lower-alpha; }
    45         ol.lower-latin { list-style-type: lower-latin; }
    46        
    47         ol.lower-greek { list-style-type: lower-greek; }
    48        
    49         ol.lower-norwegian { list-style-type: lower-norwegian; }
    50        
    51         ol.oromo { list-style-type: oromo; }
    52         ol.ethiopic-halehame-om-et { list-style-type: ethiopic-halehame-om-et; }
    53        
    54         ol.sidama { list-style-type: sidama; }
    55         ol.ethiopic-halehame-sid-et { list-style-type: ethiopic-halehame-sid-et; }
    56        
    57         ol.somali { list-style-type: somali; }
    58         ol.ethiopic-halehame-so-et { list-style-type: ethiopic-halehame-so-et; }
    59        
    60         ol.tigre { list-style-type: tigre; }
    61         ol.ethiopic-halehame-tig { list-style-type: ethiopic-halehame-tig; }
    62        
    63         ol.tigrinya-er { list-style-type: tigrinya-er; }
    64         ol.ethiopic-halehame-ti-er { list-style-type: ethiopic-halehame-ti-er; }
    65        
    66         ol.tigrinya-er-abegede { list-style-type: tigrinya-er-abegede; }
    67         ol.ethiopic-abegede-ti-er { list-style-type: ethiopic-abegede-ti-er; }
    68        
    69         ol.tigrinya-et { list-style-type: tigrinya-et; }
    70         ol.ethiopic-halehame-ti-et { list-style-type: ethiopic-halehame-ti-et; }
    71        
    72         ol.tigrinya-et-abegede { list-style-type: tigrinya-et-abegede; }
    73         ol.ethiopic-abegede-ti-et { list-style-type: ethiopic-abegede-ti-et; }
    74        
    75         ol.upper-alpha { list-style-type: upper-alpha; }
    76         ol.upper-latin { list-style-type: upper-latin; }
    77        
    78         ol.upper-greek { list-style-type: upper-greek; }
    79        
    80         ol.upper-norwegian { list-style-type: upper-norwegian; }
    818    </style>
    829    <script src="resources/dump-list.js"></script>
  • trunk/LayoutTests/fast/lists/w3-css3-list-styles-numeric-expected.txt

    r64259 r65967  
    1313PASS list marker is ٩.
    1414PASS list marker is ١٠.
     15PASS list marker is ٠.
    1516PASS list marker is ١.
    1617PASS list marker is -٢١٤٧٤٨٣٦٤٨.
     
    2021PASS list marker is 1.
    2122PASS list marker is 10.
     23PASS list marker is 0.
    2224PASS list marker is 1.
    2325PASS list marker is -10000000000000000000000000000000.
     
    3537PASS list marker is ৯.
    3638PASS list marker is ১০.
     39PASS list marker is ০.
    3740PASS list marker is ১.
    3841PASS list marker is -২১৪৭৪৮৩৬৪৮.
     
    5053PASS list marker is ៩.
    5154PASS list marker is ១០.
     55PASS list marker is ០.
    5256PASS list marker is ១.
    5357PASS list marker is -២១៤៧៤៨៣៦៤៨.
     
    6569PASS list marker is ៩.
    6670PASS list marker is ១០.
     71PASS list marker is ០.
    6772PASS list marker is ១.
    6873PASS list marker is -២១៤៧៤៨៣៦៤៨.
     
    8085PASS list marker is 9.
    8186PASS list marker is 10.
     87PASS list marker is 0.
    8288PASS list marker is 1.
    8389PASS list marker is -2147483648.
     
    95101PASS list marker is 09.
    96102PASS list marker is 10.
     103PASS list marker is 00.
    97104PASS list marker is 01.
    98105PASS list marker is -2147483648.
     
    110117PASS list marker is ९.
    111118PASS list marker is १०.
     119PASS list marker is ०.
    112120PASS list marker is १.
    113121PASS list marker is -२१४७४८३६४८.
     
    125133PASS list marker is ૯.
    126134PASS list marker is ૧૦.
     135PASS list marker is ૦.
    127136PASS list marker is ૧.
    128137PASS list marker is -૨૧૪૭૪૮૩૬૪૮.
     
    140149PASS list marker is ੯.
    141150PASS list marker is ੧੦.
     151PASS list marker is ੦.
    142152PASS list marker is ੧.
    143153PASS list marker is -੨੧੪੭੪੮੩੬੪੮.
     
    155165PASS list marker is ೯.
    156166PASS list marker is ೧೦.
     167PASS list marker is ೦.
    157168PASS list marker is ೧.
    158169PASS list marker is -೨೧೪೭೪೮೩೬೪೮.
     
    176187PASS list marker is f.
    177188PASS list marker is 10.
     189PASS list marker is 0.
    178190PASS list marker is 1.
    179191PASS list marker is -80000000.
     
    191203PASS list marker is ໙.
    192204PASS list marker is ໑໐.
     205PASS list marker is ໐.
    193206PASS list marker is ໑.
    194207PASS list marker is -໒໑໔໗໔໘໓໖໔໘.
     
    206219PASS list marker is ൯.
    207220PASS list marker is ൧൦.
     221PASS list marker is ൦.
    208222PASS list marker is ൧.
    209223PASS list marker is -൨൧൪൭൪൮൩൬൪൮.
     
    221235PASS list marker is ᠙.
    222236PASS list marker is ᠑᠐.
     237PASS list marker is ᠐.
    223238PASS list marker is ᠑.
    224239PASS list marker is -᠒᠑᠔᠗᠔᠘᠓᠖᠔᠘.
     
    236251PASS list marker is ၉.
    237252PASS list marker is ၁၀.
     253PASS list marker is ၀.
    238254PASS list marker is ၁.
    239255PASS list marker is -၂၁၄၇၄၈၃၆၄၈.
     
    249265PASS list marker is 7.
    250266PASS list marker is 10.
     267PASS list marker is 0.
    251268PASS list marker is 1.
    252269PASS list marker is -20000000000.
     
    264281PASS list marker is ୯.
    265282PASS list marker is ୧୦.
     283PASS list marker is ୦.
    266284PASS list marker is ୧.
    267285PASS list marker is -୨୧୪୭୪୮୩୬୪୮.
     
    279297PASS list marker is ۹.
    280298PASS list marker is ۱۰.
     299PASS list marker is ۰.
    281300PASS list marker is ۱.
    282301PASS list marker is -۲۱۴۷۴۸۳۶۴۸.
     
    294313PASS list marker is ۹.
    295314PASS list marker is ۱۰.
     315PASS list marker is ۰.
    296316PASS list marker is ۱.
    297317PASS list marker is -۲۱۴۷۴۸۳۶۴۸.
     
    309329PASS list marker is ౯.
    310330PASS list marker is ౧౦.
     331PASS list marker is ౦.
    311332PASS list marker is ౧.
    312333PASS list marker is -౨౧౪౭౪౮౩౬౪౮.
     
    324345PASS list marker is ༩.
    325346PASS list marker is ༡༠.
     347PASS list marker is ༠.
    326348PASS list marker is ༡.
    327349PASS list marker is -༢༡༤༧༤༨༣༦༤༨.
     
    339361PASS list marker is ๙.
    340362PASS list marker is ๑๐.
     363PASS list marker is ๐.
    341364PASS list marker is ๑.
    342365PASS list marker is -๒๑๔๗๔๘๓๖๔๘.
     
    360383PASS list marker is F.
    361384PASS list marker is 10.
     385PASS list marker is 0.
    362386PASS list marker is 1.
    363387PASS list marker is -80000000.
  • trunk/LayoutTests/fast/lists/w3-css3-list-styles-numeric.html

    r64259 r65967  
    9797            <li>&#x0661;&#x0660;</li>
    9898        </ol>
     99        <ol class="arabic-indic" start="0">
     100            <li>&#x0660;</li>
     101        </ol>
    99102        <ol class="arabic-indic" start="-2147483649">
    100103            <li>&#x661;</li>
     
    111114            <li>1</li>
    112115            <li>10</li>
     116        </ol>
     117        <ol class="binary" start="0">
     118            <li>0</li>
    113119        </ol>
    114120        <ol class="binary" start="-2147483649">
     
    135141            <li>&#x09E7;&#x09E6;</li>
    136142        </ol>
     143        <ol class="bengali" start="0">
     144            <li>&#x09E6;</li>
     145        </ol>
    137146        <ol class="bengali" start="-2147483649">
    138147            <li>&#x9E7;</li>
     
    158167            <li>&#x17E1;&#x17E0;</li>
    159168        </ol>
     169        <ol class="cambodian" start="0">
     170            <li>&#x17E0;</li>
     171        </ol>
    160172        <ol class="cambodian" start="-2147483649">
    161173            <li>&#x17E1;</li>
     
    180192            <li>&#x17E1;&#x17E0;</li>
    181193        </ol>
     194        <ol class="khmer" start="0">
     195            <li>&#x17E0;</li>
     196        </ol>
    182197        <ol class="khmer" start="-2147483649">
    183198            <li>&#x17E1;</li>
     
    202217            <li>9</li>
    203218            <li>10</li>
     219        </ol>
     220        <ol class="decimal" start="0">
     221            <li>0</li>
    204222        </ol>
    205223        <ol class="decimal" start="-2147483649">
     
    226244            <li>10</li>
    227245        </ol>
     246        <ol class="decimal-leading-zero" start="0">
     247            <li>00</li>
     248        </ol>
    228249        <ol class="decimal-leading-zero" start="-2147483649">
    229250            <li>01</li>
     
    249270            <li>&#x0967;&#x0966;</li>
    250271        </ol>
     272        <ol class="devanagari" start="0">
     273            <li>&#x0966;</li>
     274        </ol>
    251275        <ol class="devanagari" start="-2147483649">
    252276            <li>&#x967;</li>
     
    272296            <li>&#x0AE7;&#x0AE6;</li>
    273297        </ol>
     298        <ol class="gujarati" start="0">
     299            <li>&#x0AE6;</li>
     300        </ol>
    274301        <ol class="gujarati" start="-2147483649">
    275302            <li>&#xAE7;</li>
     
    295322            <li>&#x0A67;&#x0A66;</li>
    296323        </ol>
     324        <ol class="gurmukhi" start="0">
     325            <li>&#x0A66;</li>
     326        </ol>
    297327        <ol class="gurmukhi" start="-2147483649">
    298328            <li>&#xA67;</li>
     
    317347            <li>&#x0CEF;</li>
    318348            <li>&#x0CE7;&#x0CE6;</li>
     349        </ol>
     350        <ol class="kannada" start="0">
     351            <li>&#x0CE6;</li>
    319352        </ol>
    320353        <ol class="kannada" start="-2147483649">
     
    347380            <li>10</li>
    348381        </ol>
     382        <ol class="lower-hexadecimal" start="0">
     383            <li>0</li>
     384        </ol>
    349385        <ol class="lower-hexadecimal" start="-2147483649">
    350386            <li>1</li>
     
    370406            <li>&#x0ED1;&#x0ED0;</li>
    371407        </ol>
     408        <ol class="lao" start="0">
     409            <li>&#x0ED0;</li>
     410        </ol>
    372411        <ol class="lao" start="-2147483649">
    373412            <li>&#xED1;</li>
     
    393432            <li>&#x0D67;&#x0D66;</li>
    394433        </ol>
     434        <ol class="malayalam" start="0">
     435            <li>&#x0D66;</li>
     436        </ol>
    395437        <ol class="malayalam" start="-2147483649">
    396438            <li>&#xD67;</li>
     
    416458            <li>&#x1811;&#x1810;</li>
    417459        </ol>
     460        <ol class="mongolian" start="0">
     461            <li>&#x1810;</li>
     462        </ol>
    418463        <ol class="mongolian" start="-2147483649">
    419464            <li>&#x1811;</li>
     
    439484            <li>&#x1041;&#x1040;</li>
    440485        </ol>
     486        <ol class="myanmar" start="0">
     487            <li>&#x1040;</li>
     488        </ol>
    441489        <ol class="myanmar" start="-2147483649">
    442490            <li>&#x1041;</li>
     
    459507            <li>7</li>
    460508            <li>10</li>
     509        </ol>
     510        <ol class="octal" start="0">
     511            <li>0</li>
    461512        </ol>
    462513        <ol class="octal" start="-2147483649">
     
    483534            <li>&#x0B67;&#x0B66;</li>
    484535        </ol>
     536        <ol class="oriya" start="0">
     537            <li>&#x0B66;</li>
     538        </ol>
    485539        <ol class="oriya" start="-2147483649">
    486540            <li>&#xB67;</li>
     
    506560            <li>&#x06F1;&#x06F0;</li>
    507561        </ol>
     562        <ol class="persian" start="0">
     563            <li>&#x06F0;</li>
     564        </ol>
    508565        <ol class="persian" start="-2147483649">
    509566            <li>&#x6F1;</li>
     
    528585            <li>&#x06F1;&#x06F0;</li>
    529586        </ol>
     587        <ol class="urdu" start="0">
     588            <li>&#x06F0;</li>
     589        </ol>
    530590        <ol class="urdu" start="-2147483649">
    531591            <li>&#x6F1;</li>
     
    551611            <li>&#x0C67;&#x0C66;</li>
    552612        </ol>
     613        <ol class="telugu" start="0">
     614            <li>&#x0C66;</li>
     615        </ol>
    553616        <ol class="telugu" start="-2147483649">
    554617            <li>&#xC67;</li>
     
    574637            <li>&#x0F21;&#x0F20;</li>
    575638        </ol>
     639        <ol class="tibetan" start="0">
     640            <li>&#x0F20;</li>
     641        </ol>
    576642        <ol class="tibetan" start="-2147483649">
    577643            <li>&#xF21;</li>
     
    596662            <li>&#x0E59;</li>
    597663            <li>&#x0E51;&#x0E50;</li>
     664        </ol>
     665        <ol class="thai" start="0">
     666            <li>&#x0E50;</li>
    598667        </ol>
    599668        <ol class="thai" start="-2147483649">
     
    626695            <li>10</li>
    627696        </ol>
     697        <ol class="upper-hexadecimal" start="0">
     698            <li>0</li>
     699        </ol>
    628700        <ol class="upper-hexadecimal" start="-2147483649">
    629701            <li>1</li>
  • trunk/WebCore/ChangeLog

    r65963 r65967  
     12010-08-23  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Suffix for CSS alphabetic list style types should fallback to
     6        decimal for ordinals outside of their representable range
     7        https://bugs.webkit.org/show_bug.cgi?id=44486
     8
     9        Test: fast/lists/w3-css3-list-styles-fallback-style.html
     10
     11        Fixes an issue where the decimal suffix is not used for
     12        ordinals that cannot be represented by the alphabetic list
     13        style type.
     14
     15        Currently, for ordinals that cannot be represented in the
     16        alphabetic list style we use the suffix associated with the
     17        list style. Instead, we should use the suffix for the decimal
     18        list style ('.'). For instance, when the list style type is
     19        Afar and the starting ordinal is 0, then we fallback to the
     20        decimal list style suffix '.' because 0 cannot be represented
     21        in Afar.
     22
     23        * rendering/RenderListMarker.cpp:
     24        (WebCore::toRoman): Moved bounds check into WebCore::effectiveListMarkerType().
     25        (WebCore::toAlphabetic): Ditto.
     26        (WebCore::toHebrew): Ditto.
     27        (WebCore::toArmenian): Ditto.
     28        (WebCore::toGeorgian): Ditto.
     29        (WebCore::toCJKIdeographic): Ditto.
     30        (WebCore::effectiveListMarkerType): Added.
     31        (WebCore::listMarkerSuffix): Added value parameter to prototype.
     32        Modified to call WebCore::effectiveListMarkerType.
     33        (WebCore::listMarkerText): Modified to call WebCore::effectiveListMarkerType().
     34        (WebCore::RenderListMarker::paint): Modified to pass list item ordinal (i.e. m_listItem->value()) to WebCore::listMarkerSuffix().
     35        (WebCore::RenderListMarker::calcPrefWidths): Ditto.
     36        (WebCore::RenderListMarker::getRelativeMarkerRect): Ditto.
     37
    1382010-08-24  Gavin Barraclough  <barraclough@apple.com>
    239
  • trunk/WebCore/rendering/RenderListMarker.cpp

    r59956 r65967  
    4949    // using overbars and special characters. It also specifies the characters
    5050    // in the range U+2160 to U+217F instead of standard ASCII ones.
    51     if (number < 1 || number > 3999)
    52         return String::number(number);
     51    ASSERT(number >= 1 && number <= 3999);
    5352
    5453    // Big enough to store largest roman number less than 3999 which
     
    119118static String toAlphabetic(int number, const UChar* alphabet, int alphabetSize)
    120119{
    121     if (number < 1)
    122         return String::number(number);
    123 
    124120    return toAlphabeticOrNumeric(number, alphabet, alphabetSize, AlphabeticSequence);
    125121}
     
    171167{
    172168    // FIXME: CSS3 mentions ways to make this work for much larger numbers.
    173     if (number < 0 || number > 999999)
    174         return String::number(number);
     169    ASSERT(number >= 0 && number <= 999999);
    175170
    176171    if (number == 0) {
     
    239234static String toArmenian(int number, bool upper)
    240235{
    241     if (number < 1 || number > 99999999)
    242         return String::number(number);
     236    ASSERT(number >= 1 && number <= 99999999);
    243237
    244238    const int lettersSize = 18; // twice what toArmenianUnder10000 needs
     
    254248static String toGeorgian(int number)
    255249{
    256     if (number < 1 || number > 19999)
    257         return String::number(number);
     250    ASSERT(number >= 1 && number <= 19999);
    258251
    259252    const int lettersSize = 5;
     
    301294static String toCJKIdeographic(int number, const UChar table[16])
    302295{
    303     if (number < 0)
    304         return String::number(number);
     296    ASSERT(number >= 0);
    305297
    306298    enum AbstractCJKChar {
     
    380372}
    381373
    382 static UChar listMarkerSuffix(EListStyleType type)
    383 {
     374static EListStyleType effectiveListMarkerType(EListStyleType type, int value)
     375{
     376    // Note, the following switch statement has been explicitly grouped
     377    // by list-style-type ordinal range.
     378    switch (type) {
     379    case ArabicIndic:
     380    case Bengali:
     381    case BinaryListStyle:
     382    case Cambodian:
     383    case Circle:
     384    case DecimalLeadingZero:
     385    case DecimalListStyle:
     386    case Devanagari:
     387    case Disc:
     388    case Gujarati:
     389    case Gurmukhi:
     390    case Kannada:
     391    case Khmer:
     392    case Lao:
     393    case LowerHexadecimal:
     394    case Malayalam:
     395    case Mongolian:
     396    case Myanmar:
     397    case NoneListStyle:
     398    case Octal:
     399    case Oriya:
     400    case Persian:
     401    case Square:
     402    case Telugu:
     403    case Thai:
     404    case Tibetan:
     405    case UpperHexadecimal:
     406    case Urdu:
     407        return type; // Can represent all ordinals.
     408    case Armenian:
     409        return (value < 1 || value > 99999999) ? DecimalListStyle : type;
     410    case CJKIdeographic:
     411        return (value < 0) ? DecimalListStyle : type;
     412    case Georgian:
     413        return (value < 1 || value > 19999) ? DecimalListStyle : type;
     414    case Hebrew:
     415        return (value < 0 || value > 999999) ? DecimalListStyle : type;
     416    case LowerRoman:
     417    case UpperRoman:
     418        return (value < 1 || value > 3999) ? DecimalListStyle : type;
     419    case Afar:
     420    case Amharic:
     421    case AmharicAbegede:
     422    case CjkEarthlyBranch:
     423    case CjkHeavenlyStem:
     424    case Ethiopic:
     425    case EthiopicAbegede:
     426    case EthiopicAbegedeAmEt:
     427    case EthiopicAbegedeGez:
     428    case EthiopicAbegedeTiEr:
     429    case EthiopicAbegedeTiEt:
     430    case EthiopicHalehameAaEr:
     431    case EthiopicHalehameAaEt:
     432    case EthiopicHalehameAmEt:
     433    case EthiopicHalehameGez:
     434    case EthiopicHalehameOmEt:
     435    case EthiopicHalehameSidEt:
     436    case EthiopicHalehameSoEt:
     437    case EthiopicHalehameTiEr:
     438    case EthiopicHalehameTiEt:
     439    case EthiopicHalehameTig:
     440    case Hangul:
     441    case HangulConsonant:
     442    case Hiragana:
     443    case HiraganaIroha:
     444    case Katakana:
     445    case KatakanaIroha:
     446    case LowerAlpha:
     447    case LowerGreek:
     448    case LowerLatin:
     449    case LowerNorwegian:
     450    case Oromo:
     451    case Sidama:
     452    case Somali:
     453    case Tigre:
     454    case TigrinyaEr:
     455    case TigrinyaErAbegede:
     456    case TigrinyaEt:
     457    case TigrinyaEtAbegede:
     458    case UpperAlpha:
     459    case UpperGreek:
     460    case UpperLatin:
     461    case UpperNorwegian:
     462        return (value < 1) ? DecimalListStyle : type;
     463    }
     464
     465    ASSERT_NOT_REACHED();
     466    return type;
     467}
     468
     469static UChar listMarkerSuffix(EListStyleType type, int value)
     470{
     471    // If the list-style-type, say hebrew, cannot represent |value| because it's outside
     472    // its ordinal range then we fallback to some list style that can represent |value|.
     473    EListStyleType effectiveType = effectiveListMarkerType(type, value);
     474
    384475    // Note, the following switch statement has been explicitly
    385476    // grouped by list-style-type suffix.
    386     switch (type) {
     477    switch (effectiveType) {
    387478    case NoneListStyle:
    388479    case Disc:
     
    474565String listMarkerText(EListStyleType type, int value)
    475566{
    476     switch (type) {
     567    // If the list-style-type, say hebrew, cannot represent |value| because it's outside
     568    // its ordinal range then we fallback to some list style that can represent |value|.
     569    switch (effectiveListMarkerType(type, value)) {
    477570        case NoneListStyle:
    478571            return "";
     
    11231216
    11241217    const Font& font = style()->font();
    1125     const UChar suffix = listMarkerSuffix(type);
     1218    const UChar suffix = listMarkerSuffix(type, m_listItem->value());
    11261219    if (style()->direction() == LTR) {
    11271220        int width = font.width(textRun);
     
    12831376            else {
    12841377                int itemWidth = font.width(m_text);
    1285                 UChar suffixSpace[2] = { listMarkerSuffix(type), ' ' };
     1378                UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()), ' ' };
    12861379                int suffixSpaceWidth = font.width(TextRun(suffixSpace, 2));
    12871380                width = itemWidth + suffixSpaceWidth;
     
    14851578            const Font& font = style()->font();
    14861579            int itemWidth = font.width(m_text);
    1487             UChar suffixSpace[2] = { listMarkerSuffix(type), ' ' };
     1580            UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()), ' ' };
    14881581            int suffixSpaceWidth = font.width(TextRun(suffixSpace, 2));
    14891582            return IntRect(x(), y() + font.ascent(), itemWidth + suffixSpaceWidth, font.height());
Note: See TracChangeset for help on using the changeset viewer.