Changeset 18671 in webkit


Ignore:
Timestamp:
Jan 8, 2007 11:15:43 AM (17 years ago)
Author:
darin
Message:

LayoutTests:

  • added a W3C list style test that was cited in a bug
  • fast/lists/w3-list-styles-expected.checksum: Added.
  • fast/lists/w3-list-styles-expected.png: Added.
  • fast/lists/w3-list-styles-expected.txt: Added.
  • fast/lists/w3-list-styles.html: Added.

WebCore:

Reviewed by Maciej.

Test case showed problems in cjk-ideographic and hebrew
Test: fast/lists/w3-list-styles.html

  • rendering/RenderListMarker.cpp: (WebCore::toCJKIdeographic): Fix the algorithm so it doesn't include leading zeroes. I had misread the part that says you start with the decimal form of the number. Fix an assertion that was too stringent. Fix the code to collapse consecutive zeroes so that it doesn't get confused by intervening "noChar" characters. (WebCore::RenderListMarker::paint): Reverse the text before painting if the first character's direction is right to left.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r18670 r18671  
     12007-01-08  Darin Adler  <darin@apple.com>
     2
     3        - added a W3C list style test that was cited in a bug
     4
     5        * fast/lists/w3-list-styles-expected.checksum: Added.
     6        * fast/lists/w3-list-styles-expected.png: Added.
     7        * fast/lists/w3-list-styles-expected.txt: Added.
     8        * fast/lists/w3-list-styles.html: Added.
     9
    1102007-01-08  Darin Adler  <darin@apple.com>
    211
  • trunk/WebCore/ChangeLog

    r18670 r18671  
     12007-01-08  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=3232
     6          CSS2: Web Kit does not support all list style types
     7
     8        Test case showed problems in cjk-ideographic and hebrew
     9        Test: fast/lists/w3-list-styles.html
     10
     11        * rendering/RenderListMarker.cpp:
     12        (WebCore::toCJKIdeographic): Fix the algorithm so it doesn't include leading zeroes.
     13        I had misread the part that says you start with the decimal form of the number.
     14        Fix an assertion that was too stringent. Fix the code to collapse consecutive zeroes
     15        so that it doesn't get confused by intervening "noChar" characters.
     16        (WebCore::RenderListMarker::paint): Reverse the text before painting if the first character's
     17        direction is right to left.
     18
    1192007-01-08  Darin Adler  <darin@apple.com>
    220
  • trunk/WebCore/rendering/RenderListMarker.cpp

    r18654 r18671  
    3636
    3737using namespace std;
     38namespace Unicode = WTF::Unicode;
    3839
    3940namespace WebCore {
     
    280281            group[7] = static_cast<AbstractCJKChar>(secondGroupMarker - 1 + i);
    281282
    282         // Put in the four digits.
     283        // Put in the four digits and digit markers for any non-zero digits.
    283284        group[0] = static_cast<AbstractCJKChar>(digit0 + (groupValue % 10));
    284         group[1] = static_cast<AbstractCJKChar>(digit0 + ((groupValue / 10) % 10));
    285         group[3] = static_cast<AbstractCJKChar>(digit0 + ((groupValue / 100) % 10));
    286         group[5] = static_cast<AbstractCJKChar>(digit0 + groupValue / 1000);
    287 
    288         // Put in digit markers for any non-zero digits.
    289         if (group[1] != digit0)
    290             group[2] = secondDigitMarker;
    291         if (group[3] != digit0)
    292             group[4] = thirdDigitMarker;
    293         if (group[5] != digit0)
    294             group[6] = fourthDigitMarker;
     285        if (number != 0 || groupValue > 9) {
     286            int digitValue = ((groupValue / 10) % 10);
     287            group[1] = static_cast<AbstractCJKChar>(digit0 + digitValue);
     288            if (digitValue)
     289                group[2] = secondDigitMarker;
     290        }
     291        if (number != 0 || groupValue > 99) {
     292            int digitValue = ((groupValue / 100) % 10);
     293            group[3] = static_cast<AbstractCJKChar>(digit0 + digitValue);
     294            if (digitValue)
     295                group[4] = thirdDigitMarker;
     296        }
     297        if (number != 0 || groupValue > 999) {
     298            int digitValue = groupValue / 1000;
     299            group[5] = static_cast<AbstractCJKChar>(digit0 + digitValue);
     300            if (digitValue)
     301                group[6] = fourthDigitMarker;
     302        }
    295303
    296304        // Remove the tens digit, but leave the marker, for any group that has
    297305        // a value of less than 20.
    298306        if (groupValue < 20) {
    299             ASSERT(group[1] == noChar || group[1] == digit1);
     307            ASSERT(group[1] == noChar || group[1] == digit0 || group[1] == digit1);
    300308            group[1] = noChar;
    301309        }
     310
     311        if (number == 0)
     312            break;
    302313    }
    303314
     
    308319    for (int i = 0; i < bufferLength; ++i) {
    309320        AbstractCJKChar a = buffer[i];
    310         if (a != noChar && (a != digit0 || last != digit0))
    311             characters[length++] = table[a - 1];
    312         last = a;
     321        if (a != noChar) {
     322            if (a != digit0 || last != digit0)
     323                characters[length++] = table[a - 1];
     324            last = a;
     325        }
    313326    }
    314327    return String(characters, length);
     
    601614    if (m_text.isEmpty())
    602615        return;
     616
     617    TextRun textRun(m_text.impl());
     618
     619    // Text is not arbitrary. We can judge whether it's RTL from the first character,
     620    // and we only need to handle the direction RightToLeft for now.
     621    bool textNeedsReversing = Unicode::direction(m_text[0]) == Unicode::RightToLeft;
     622    Vector<UChar> reversedText;
     623    if (textNeedsReversing) {
     624        int length = m_text.length();
     625        reversedText.resize(length);
     626        for (int i = 0; i < length; ++i)
     627            reversedText[length - i - 1] = m_text[i];
     628        textRun = TextRun(reversedText.data(), length);
     629    }
     630
    603631    const Font& font = style()->font();
    604     TextRun textRun(m_text.impl());
    605632    if (style()->direction() == LTR) {
    606633        int width = font.width(textRun);
Note: See TracChangeset for help on using the changeset viewer.