Changeset 66296 in webkit


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

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

Reviewed by Darin Adler.

Implement symbolic CSS3 list-style-types
https://bugs.webkit.org/show_bug.cgi?id=36734

Implements all of the symbolic CSS3 list-style-types as per
section 4.5 of the CSS3 Lists module <http://www.w3.org/TR/css3-lists/#symbolic>.

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

  • css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added list style types Asterisks and Footnotes.
  • css/CSSValueKeywords.in: Ditto.
  • inspector/front-end/SourceCSSTokenizer.re2js: Ditto.
  • rendering/RenderListMarker.cpp: (WebCore::toAlphabeticOrNumeric): Changed type of parameter sequenceSize from int to unsigned. (WebCore::toSymbolic): Added. (WebCore::toAlphabetic): Changed type of parameter alphabetSize from int to unsigned. (WebCore::toNumeric): Changed type of parameter numeralsSize from int to unsigned. (WebCore::effectiveListMarkerType): Added. (WebCore::listMarkerSuffix): Added list style types Asterisks and Footnotes. (WebCore::listMarkerText): Ditto. (WebCore::RenderListMarker::paint): Ditto. (WebCore::RenderListMarker::calcPrefWidths): Ditto. (WebCore::RenderListMarker::getRelativeMarkerRect): Ditto.
  • rendering/style/RenderStyleConstants.h: Ditto. (WebCore::):

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

Reviewed by Darin Adler.

Implement symbolic CSS3 list-style-types
https://bugs.webkit.org/show_bug.cgi?id=36734

Tests that all of the symbolic CSS3 list-style-types are supported.

  • fast/lists/w3-css3-list-styles-symbolic-expected.txt: Added.
  • fast/lists/w3-css3-list-styles-symbolic.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r66294 r66296  
     12010-08-27  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Implement symbolic CSS3 list-style-types
     6        https://bugs.webkit.org/show_bug.cgi?id=36734
     7
     8        Tests that all of the symbolic CSS3 list-style-types are supported.
     9
     10        * fast/lists/w3-css3-list-styles-symbolic-expected.txt: Added.
     11        * fast/lists/w3-css3-list-styles-symbolic.html: Added.
     12
    1132010-08-27  Matthew Delaney  <mdelaney@apple.com>
    214
  • trunk/WebCore/ChangeLog

    r66295 r66296  
     12010-08-27  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Implement symbolic CSS3 list-style-types
     6        https://bugs.webkit.org/show_bug.cgi?id=36734
     7
     8        Implements all of the symbolic CSS3 list-style-types as per
     9        section 4.5 of the CSS3 Lists module <http://www.w3.org/TR/css3-lists/#symbolic>.
     10
     11        Test: fast/lists/w3-css3-list-styles-symbolic.html
     12
     13        * css/CSSPrimitiveValueMappings.h:
     14        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added list style types Asterisks and Footnotes.
     15        * css/CSSValueKeywords.in: Ditto.
     16        * inspector/front-end/SourceCSSTokenizer.re2js: Ditto.
     17        * rendering/RenderListMarker.cpp:
     18        (WebCore::toAlphabeticOrNumeric): Changed type of parameter sequenceSize from int to unsigned.
     19        (WebCore::toSymbolic): Added.
     20        (WebCore::toAlphabetic): Changed type of parameter alphabetSize from int to unsigned.
     21        (WebCore::toNumeric): Changed type of parameter numeralsSize from int to unsigned.
     22        (WebCore::effectiveListMarkerType): Added.
     23        (WebCore::listMarkerSuffix): Added list style types Asterisks and Footnotes.
     24        (WebCore::listMarkerText): Ditto.
     25        (WebCore::RenderListMarker::paint): Ditto.
     26        (WebCore::RenderListMarker::calcPrefWidths): Ditto.
     27        (WebCore::RenderListMarker::getRelativeMarkerRect): Ditto.
     28        * rendering/style/RenderStyleConstants.h: Ditto.
     29        (WebCore::):
     30
    1312010-08-27  Vincent Scheib  <scheib@chromium.org>
    232
  • trunk/WebCore/css/CSSPrimitiveValueMappings.h

    r66251 r66296  
    10091009        m_value.ident = CSSValueArmenian;
    10101010        break;
     1011    case Asterisks:
     1012        m_value.ident = CSSValueAsterisks;
     1013        break;
    10111014    case BinaryListStyle:
    10121015        m_value.ident = CSSValueBinary;
     
    10891092    case EthiopicHalehameTig:
    10901093        m_value.ident = CSSValueEthiopicHalehameTig;
     1094        break;
     1095    case Footnotes:
     1096        m_value.ident = CSSValueFootnotes;
    10911097        break;
    10921098    case Georgian:
  • trunk/WebCore/css/CSSValueKeywords.in

    r66251 r66296  
    289289upper-greek
    290290upper-norwegian
     291asterisks
     292footnotes
    291293hebrew
    292294armenian
  • trunk/WebCore/inspector/front-end/SourceCSSTokenizer.re2js

    r65942 r66296  
    4949    this._valueKeywords = [
    5050        "above", "absolute", "activeborder", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll",
    51         "alternate", "always","amharic", "amharic-abegede", "antialiased", "appworkspace", "aqua", "arabic-indic", "armenian",
     51        "alternate", "always","amharic", "amharic-abegede", "antialiased", "appworkspace", "aqua", "arabic-indic", "armenian", "asterisks",
    5252        "auto", "avoid", "background", "backwards", "baseline", "below", "bidi-override", "binary", "bengali", "black", "blink",
    5353        "block", "block-axis", "blue", "bold", "bolder", "border", "border-box", "both", "bottom", "break-all", "break-word", "button",
     
    6262        "ethiopic-halehame-am-et", "ethiopic-halehame-gez", "ethiopic-halehame-om-et", "ethiopic-halehame-sid-et",
    6363        "ethiopic-halehame-so-et", "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ew-resize", "expanded",
    64         "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "forwards", "from", "fuchsia", "geometricPrecision",
     64        "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "footnotes", "forwards", "from", "fuchsia", "geometricPrecision",
    6565        "georgian", "gray", "graytext", "green", "grey", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew", "help",
    6666        "hidden", "hide", "higher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
  • trunk/WebCore/rendering/RenderListMarker.cpp

    r65969 r66296  
    8080}
    8181
    82 static inline String toAlphabeticOrNumeric(int number, const UChar* sequence, int sequenceSize, SequenceType type)
     82static inline String toAlphabeticOrNumeric(int number, const UChar* sequence, unsigned sequenceSize, SequenceType type)
    8383{
    8484    ASSERT(sequenceSize >= 2);
     
    116116}
    117117
    118 static String toAlphabetic(int number, const UChar* alphabet, int alphabetSize)
     118static String toSymbolic(int number, const UChar* symbols, unsigned symbolsSize)
     119{
     120    ASSERT(number > 0);
     121    ASSERT(symbolsSize >= 1);
     122    unsigned numberShadow = number;
     123    --numberShadow;
     124
     125    // The asterisks list-style-type is the worst case; we show |numberShadow| asterisks.
     126    Vector<UChar> letters;
     127    letters.append(symbols[numberShadow % symbolsSize]);
     128    unsigned numSymbols = numberShadow / symbolsSize;
     129    while (numSymbols--)
     130        letters.append(symbols[numberShadow % symbolsSize]);
     131    return String::adopt(letters);
     132}
     133
     134static String toAlphabetic(int number, const UChar* alphabet, unsigned alphabetSize)
    119135{
    120136    return toAlphabeticOrNumeric(number, alphabet, alphabetSize, AlphabeticSequence);
    121137}
    122138
    123 static String toNumeric(int number, const UChar* numerals, int numeralsSize)
     139static String toNumeric(int number, const UChar* numerals, unsigned numeralsSize)
    124140{
    125141    return toAlphabeticOrNumeric(number, numerals, numeralsSize, NumericSequence);
     
    134150{
    135151    return toNumeric(number, alphabet, size);
     152}
     153
     154template <size_t size> static inline String toSymbolic(int number, const UChar(&alphabet)[size])
     155{   
     156    return toSymbolic(number, alphabet, size);
    136157}
    137158
     
    420441    case Amharic:
    421442    case AmharicAbegede:
     443    case Asterisks:
    422444    case CjkEarthlyBranch:
    423445    case CjkHeavenlyStem:
     
    438460    case EthiopicHalehameTiEt:
    439461    case EthiopicHalehameTig:
     462    case Footnotes:
    440463    case Hangul:
    441464    case HangulConsonant:
     
    476499    // grouped by list-style-type suffix.
    477500    switch (effectiveType) {
     501    case Asterisks:
     502    case Circle:
     503    case Disc:
     504    case Footnotes:
    478505    case NoneListStyle:
    479     case Disc:
    480     case Circle:
    481506    case Square:
    482507        ASSERT_NOT_REACHED();
     
    571596            return "";
    572597
     598        case Asterisks: {
     599            static const UChar asterisksSymbols[1] = {
     600                0x002A
     601            };
     602            return toSymbolic(value, asterisksSymbols);
     603        }
    573604        // We use the same characters for text security.
    574605        // See RenderText::setInternalString.
     
    577608        case Disc:
    578609            return String(&bullet, 1);
     610        case Footnotes: {
     611            static const UChar footnotesSymbols[4] = {
     612                0x002A, 0x2051, 0x2020, 0x2021
     613            };
     614            return toSymbolic(value, footnotesSymbols);
     615        }
    579616        case Square:
    580617            // The CSS 2.1 test suite uses U+25EE BLACK MEDIUM SMALL SQUARE
     
    11111148    EListStyleType type = style()->listStyleType();
    11121149    switch (type) {
     1150        case Asterisks:
     1151        case Footnotes:
     1152            context->drawText(style()->font(), TextRun(m_text), marker.location());
     1153            return;
    11131154        case Disc:
    11141155            context->drawEllipse(marker);
     
    12911332    switch (type) {
    12921333        case NoneListStyle:
     1334            break;
     1335        case Asterisks:
     1336        case Footnotes:
     1337            m_text = listMarkerText(type, m_listItem->value());
     1338            width = font.width(m_text); // no suffix for these types
    12931339            break;
    12941340        case Circle:
     
    14901536    EListStyleType type = style()->listStyleType();
    14911537    switch (type) {
     1538        case Asterisks:
     1539        case Footnotes: {
     1540            const Font& font = style()->font();
     1541            return IntRect(x(), y() + font.ascent(), font.width(m_text), font.height());
     1542        }
    14921543        case Disc:
    14931544        case Circle:
  • trunk/WebCore/rendering/style/RenderStyleConstants.h

    r66251 r66296  
    278278    UpperGreek,
    279279    UpperNorwegian,
     280    Asterisks,
     281    Footnotes,
    280282    Hebrew,
    281283    Armenian,
Note: See TracChangeset for help on using the changeset viewer.