Changeset 74005 in webkit


Ignore:
Timestamp:
Dec 13, 2010 10:58:06 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-12-13 takano takumi <takano@apple.com>

Reviewed by Dan Bernstein.

GlyphPage::fill() is slow on vertical writing (Mac)
https://bugs.webkit.org/show_bug.cgi?id=50865

No test. Just a performance improvement.

  • platform/graphics/Font.cpp: (WebCore::Font::isCJKIdeograph): Now this only checks pure ideographs (Hanji). (WebCore::Font::isCJKIdeographOrSymbol): Added this for Hanji and Hanji related symbols.
  • platform/graphics/Font.h:
  • platform/graphics/FontFastPath.cpp: (WebCore::Font::glyphDataForCharacter): Changed to call isCJKIdeographOrSymbol() instead of isCJKIdeograph().
  • platform/graphics/mac/GlyphPageTreeNodeMac.cpp: (WebCore::shouldUseCoreText): This tests if GlyphPage::fill() should use CoreText or not. For vertical writing, if the current page contains only ideographs, we go CG path. (WebCore::GlyphPage::fill): Made to call shouldUseCoreText() and switch code path.
Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r74004 r74005  
     12010-12-13  takano takumi  <takano@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        GlyphPage::fill() is slow on vertical writing (Mac)
     6        https://bugs.webkit.org/show_bug.cgi?id=50865
     7
     8        No test. Just a performance improvement.
     9
     10        * platform/graphics/Font.cpp:
     11        (WebCore::Font::isCJKIdeograph): Now this only checks pure ideographs (Hanji).
     12        (WebCore::Font::isCJKIdeographOrSymbol): Added this for Hanji and Hanji related symbols.
     13        * platform/graphics/Font.h:
     14        * platform/graphics/FontFastPath.cpp:
     15        (WebCore::Font::glyphDataForCharacter): Changed to call isCJKIdeographOrSymbol() instead of isCJKIdeograph().
     16        * platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
     17        (WebCore::shouldUseCoreText): This tests if GlyphPage::fill() should use CoreText or not.
     18        For vertical writing, if the current page contains only ideographs, we go CG path.
     19        (WebCore::GlyphPage::fill): Made to call shouldUseCoreText() and switch code path.
     20
    1212010-12-13  Antonio Gomes  <agomes@rim.com>
    222
  • trunk/WebCore/platform/graphics/Font.cpp

    r73706 r74005  
    339339bool Font::isCJKIdeograph(UChar32 c)
    340340{
     341    // The basic CJK Unified Ideographs block.
     342    if (c >= 0x4E00 && c <= 0x9FFF)
     343        return true;
     344   
     345    // CJK Unified Ideographs Extension A.
     346    if (c >= 0x3400 && c <= 0x4DBF)
     347        return true;
     348   
     349    // CJK Radicals Supplement.
     350    if (c >= 0x2E80 && c <= 0x2EFF)
     351        return true;
     352   
     353    // Kangxi Radicals.
     354    if (c >= 0x2F00 && c <= 0x2FDF)
     355        return true;
     356   
     357    // CJK Strokes.
     358    if (c >= 0x31C0 && c <= 0x31EF)
     359        return true;
     360   
     361    // CJK Compatibility Ideographs.
     362    if (c >= 0xF900 && c <= 0xFAFF)
     363        return true;
     364   
     365    // CJK Unified Ideographs Extension B.
     366    if (c >= 0x20000 && c <= 0x2A6DF)
     367        return true;
     368       
     369    // CJK Unified Ideographs Extension C.
     370    if (c >= 0x2A700 && c <= 0x2B73F)
     371        return true;
     372   
     373    // CJK Unified Ideographs Extension D.
     374    if (c >= 0x2B740 && c <= 0x2B81F)
     375        return true;
     376   
     377    // CJK Compatibility Ideographs Supplement.
     378    if (c >= 0x2F800 && c <= 0x2FA1F)
     379        return true;
     380
     381    return false;
     382}
     383
     384bool Font::isCJKIdeographOrSymbol(UChar32 c)
     385{
    341386    // 0x2C7 Caron, Mandarin Chinese 3rd Tone
    342387    // 0x2CA Modifier Letter Acute Accent, Mandarin Chinese 2nd Tone
     
    346391        return true;
    347392
    348     // The basic CJK Unified Ideographs block.
    349     if (c >= 0x4E00 && c <= 0x9FFF)
    350         return true;
    351    
    352     // CJK Unified Ideographs Extension A.
    353     if (c >= 0x3400 && c <= 0x4DBF)
    354         return true;
    355    
    356     // CJK Radicals Supplement.
    357     if (c >= 0x2E80 && c <= 0x2EFF)
    358         return true;
    359    
    360     // Kangxi Radicals.
    361     if (c >= 0x2F00 && c <= 0x2FDF)
    362         return true;
    363    
    364393    // Ideographic Description Characters.
    365394    if (c >= 0x2FF0 && c <= 0x2FFF)
     
    378407        return true;
    379408 
    380     // CJK Strokes.
    381     if (c >= 0x31C0 && c <= 0x31EF)
    382         return true;
    383    
    384409    // Enclosed CJK Letters and Months.
    385410    if (c >= 0x3200 && c <= 0x32FF)
     
    390415        return true;
    391416   
    392     // CJK Compatibility Ideographs.
    393     if (c >= 0xF900 && c <= 0xFAFF)
    394         return true;
    395    
    396417    // CJK Compatibility Forms.
    397418    if (c >= 0xFE30 && c <= 0xFE4F)
     
    402423        return true;
    403424
    404     // CJK Unified Ideographs Extension B.
    405     if (c >= 0x20000 && c <= 0x2A6DF)
    406         return true;
    407        
    408     // CJK Unified Ideographs Extension C.
    409     if (c >= 0x2A700 && c <= 0x2B73F)
    410         return true;
    411    
    412     // CJK Unified Ideographs Extension D.
    413     if (c >= 0x2B740 && c <= 0x2B81F)
    414         return true;
    415    
    416     // CJK Compatibility Ideographs Supplement.
    417     if (c >= 0x2F800 && c <= 0x2FA1F)
    418         return true;
    419 
    420     return false;
    421 }
    422 
    423 }
     425    return isCJKIdeograph(c);
     426}
     427
     428}
  • trunk/WebCore/platform/graphics/Font.h

    r72165 r74005  
    145145
    146146    static bool isCJKIdeograph(UChar32);
     147    static bool isCJKIdeographOrSymbol(UChar32);
    147148   
    148149#if PLATFORM(QT)
  • trunk/WebCore/platform/graphics/FontFastPath.cpp

    r71970 r74005  
    7676                GlyphData data = page->glyphDataForCharacter(c);
    7777                if (data.fontData) {
    78                     if (data.fontData->platformData().orientation() == Vertical && data.fontData->orientation() == Horizontal && Font::isCJKIdeograph(c)) {
     78                    if (data.fontData->platformData().orientation() == Vertical && data.fontData->orientation() == Horizontal && Font::isCJKIdeographOrSymbol(c)) {
    7979                        const SimpleFontData* ideographFontData = data.fontData->brokenIdeographFontData();
    8080                        GlyphPageTreeNode* ideographNode = GlyphPageTreeNode::getRootChild(ideographFontData, pageNumber);
  • trunk/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp

    r71973 r74005  
    2929#include "config.h"
    3030#include "GlyphPageTreeNode.h"
     31#include "Font.h"
    3132
    3233#include "SimpleFontData.h"
     
    3637namespace WebCore {
    3738
     39#ifndef BUILDING_ON_TIGER
     40static bool shouldUseCoreText(UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
     41{
     42    if (fontData->orientation() == Vertical && !fontData->isBrokenIdeographFont()) {
     43        // Ideographs don't have a vertical variant.
     44        for (unsigned i = 0; i < bufferLength; ++i) {
     45            if (!Font::isCJKIdeograph(buffer[i]))
     46                return true;
     47        }
     48    }
     49
     50    return false;
     51}
     52#endif
     53
    3854bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
    3955{
     
    4157
    4258#ifndef BUILDING_ON_TIGER
    43     if (fontData->orientation() == Horizontal || fontData->isBrokenIdeographFont()) {
     59    if (!shouldUseCoreText(buffer, bufferLength, fontData)) {
    4460        Vector<CGGlyph, 512> glyphs(bufferLength);
    4561        wkGetGlyphsForCharacters(fontData->platformData().cgFont(), buffer, glyphs.data(), bufferLength);
Note: See TracChangeset for help on using the changeset viewer.