Changeset 39206 in webkit


Ignore:
Timestamp:
Dec 11, 2008 6:14:46 AM (15 years ago)
Author:
zecke@webkit.org
Message:

WebCorv
2008-12-11 Holger Freyther <zecke@selfish.org>

Reviewed by Simon Hausmann.

https://bugs.webkit.org/show_bug.cgi?id=20953

For Qt it is not pratical to have a FontCache and GlyphPageTreeNode
implementation. This is one of the reasons why the Qt port is currently not
using WebCore/platform/graphics/Font.cpp. By allowing to not use
the simple/fast-path the Qt port will be able to use it.

Introduce USE(FONT_FAST_PATH) and define it for every port but the
Qt one.

  • platform/graphics/Font.cpp: (WebCore::Font::drawText): (WebCore::Font::floatWidth): (WebCore::Font::selectionRectForText): (WebCore::Font::offsetForPosition):
  • platform/graphics/Font.h:

JavaScriptCore
2008-12-11 Holger Freyther <zecke@selfish.org>

Reviewed by Simon Hausmann.

https://bugs.webkit.org/show_bug.cgi?id=20953

For Qt it is not pratical to have a FontCache and GlyphPageTreeNode
implementation. This is one of the reasons why the Qt port is currently not
using WebCore/platform/graphics/Font.cpp. By allowing to not use
the simple/fast-path the Qt port will be able to use it.

Introduce USE(FONT_FAST_PATH) and define it for every port but the
Qt one.

  • wtf/Platform.h: Enable USE(FONT_FAST_PATH)
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r39204 r39206  
     12008-12-11  Holger Freyther  <zecke@selfish.org>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=20953
     6
     7        For Qt it is not pratical to have a FontCache and GlyphPageTreeNode
     8        implementation. This is one of the reasons why the Qt port is currently not
     9        using WebCore/platform/graphics/Font.cpp. By allowing to not use
     10        the simple/fast-path the Qt port will be able to use it.
     11
     12        Introduce USE(FONT_FAST_PATH) and define it for every port but the
     13        Qt one.
     14
     15        * wtf/Platform.h: Enable USE(FONT_FAST_PATH)
     16
    1172008-12-11  Gabor Loki  <loki@inf.u-szeged.hu>
    218
  • trunk/JavaScriptCore/wtf/Platform.h

    r39115 r39206  
    462462#endif
    463463
     464#if !PLATFORM(QT)
     465#define WTF_USE_FONT_FAST_PATH 1
     466#endif
     467
    464468#endif /* WTF_Platform_h */
  • trunk/WebCore/ChangeLog

    r39205 r39206  
     12008-12-11  Holger Freyther  <zecke@selfish.org>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=20953
     6
     7        For Qt it is not pratical to have a FontCache and GlyphPageTreeNode
     8        implementation. This is one of the reasons why the Qt port is currently not
     9        using WebCore/platform/graphics/Font.cpp. By allowing to not use
     10        the simple/fast-path the Qt port will be able to use it.
     11
     12        Introduce USE(FONT_FAST_PATH) and define it for every port but the
     13        Qt one.
     14
     15        * platform/graphics/Font.cpp:
     16        (WebCore::Font::drawText):
     17        (WebCore::Font::floatWidth):
     18        (WebCore::Font::selectionRectForText):
     19        (WebCore::Font::offsetForPosition):
     20        * platform/graphics/Font.h:
     21
    1222008-12-11  Holger Hans Peter Freyther  <zecke@selfish.org>
    223
  • trunk/WebCore/platform/graphics/Font.cpp

    r39205 r39206  
    3838namespace WebCore {
    3939
     40#if USE(FONT_FAST_PATH)
    4041const uint8_t Font::gRoundingHackCharacterTable[256] = {
    4142    0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*\t*/, 1 /*\n*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     
    5051
    5152Font::CodePath Font::s_codePath = Auto;
     53#endif
    5254
    5355// ============================================================================================
     
    228230#endif
    229231
    230     if (canUseGlyphCache(run))
    231         drawSimpleText(context, run, point, from, to);
    232     else
    233         drawComplexText(context, run, point, from, to);
     232#if USE(FONT_FAST_PATH)
     233    if (canUseGlyphCache(run))
     234        return drawSimpleText(context, run, point, from, to);
     235#endif
     236
     237    return drawComplexText(context, run, point, from, to);
    234238}
    235239
     
    241245#endif
    242246
     247#if USE(FONT_FAST_PATH)
    243248    if (canUseGlyphCache(run))
    244249        return floatWidthForSimpleText(run, 0);
     250#endif
     251
    245252    return floatWidthForComplexText(run);
    246253}
     
    255262    charsConsumed = run.length();
    256263    glyphName = "";
     264
     265#if ENABLE(FONT_FAST_PATH)
    257266    if (canUseGlyphCache(run))
    258267        return floatWidthForSimpleText(run, 0);
     268#endif
     269
    259270    return floatWidthForComplexText(run);
    260271}
     
    268279
    269280    to = (to == -1 ? run.length() : to);
     281
     282#if USE(FONT_FAST_PATH)
    270283    if (canUseGlyphCache(run))
    271284        return selectionRectForSimpleText(run, point, h, from, to);
     285#endif
     286
    272287    return selectionRectForComplexText(run, point, h, from, to);
    273288}
     
    280295#endif
    281296
     297#if USE(FONT_FAST_PATH)
    282298    if (canUseGlyphCache(run))
    283299        return offsetForPositionForSimpleText(run, x, includePartialGlyphs);
     300#endif
     301
    284302    return offsetForPositionForComplexText(run, x, includePartialGlyphs);
    285303}
  • trunk/WebCore/platform/graphics/Font.h

    r38024 r39206  
    137137    // Used for complex text, and does not utilize the glyph map cache.
    138138    const FontData* fontDataForCharacters(const UChar*, int length) const;
     139#endif
    139140
    140141private:
    141     bool canUseGlyphCache(const TextRun&) const;
    142     void drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
    143142#if ENABLE(SVG_FONTS)
    144143    void drawTextUsingSVGFont(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
     
    148147    int offsetForPositionForTextUsingSVGFont(const TextRun&, int position, bool includePartialGlyphs) const;
    149148#endif
     149
     150#if USE(FONT_FAST_PATH)
     151    bool canUseGlyphCache(const TextRun&) const;
     152    void drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
    150153    void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const;
    151154    void drawGlyphBuffer(GraphicsContext*, const GlyphBuffer&, const TextRun&, const FloatPoint&) const;
     155    float floatWidthForSimpleText(const TextRun&, GlyphBuffer*) const;
     156    int offsetForPositionForSimpleText(const TextRun&, int position, bool includePartialGlyphs) const;
     157    FloatRect selectionRectForSimpleText(const TextRun&, const IntPoint&, int h, int from, int to) const;
     158#endif
     159
    152160    void drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
    153     float floatWidthForSimpleText(const TextRun&, GlyphBuffer*) const;
    154161    float floatWidthForComplexText(const TextRun&) const;
    155     int offsetForPositionForSimpleText(const TextRun&, int position, bool includePartialGlyphs) const;
    156162    int offsetForPositionForComplexText(const TextRun&, int position, bool includePartialGlyphs) const;
    157     FloatRect selectionRectForSimpleText(const TextRun&, const IntPoint&, int h, int from, int to) const;
    158163    FloatRect selectionRectForComplexText(const TextRun&, const IntPoint&, int h, int from, int to) const;
    159164    void cachePrimaryFont() const;
    160 #endif
     165
    161166    friend struct WidthIterator;
    162167
     
    166171#else
    167172    // Useful for debugging the different font rendering code paths.
     173#if USE(FONT_FAST_PATH)
    168174    enum CodePath { Auto, Simple, Complex };
    169175    static void setCodePath(CodePath);
     
    176182        return (((c & ~0xFF) == 0 && gRoundingHackCharacterTable[c]));
    177183    }
     184#endif
    178185
    179186    FontSelector* fontSelector() const;
Note: See TracChangeset for help on using the changeset viewer.