Changeset 46388 in webkit


Ignore:
Timestamp:
Jul 24, 2009 8:50:23 PM (15 years ago)
Author:
mitz@apple.com
Message:

Reviewed by Darin Adler.

Add functions to print the glyph page trees for debugging
https://bugs.webkit.org/show_bug.cgi?id=27671

  • platform/graphics/FontData.h: Defined a description() method.
  • platform/graphics/GlyphPageTreeNode.cpp: (WebCore::GlyphPageTreeNode::showSubtree): Added. Prints the node and

its descendants.

(showGlyphPageTrees): Added. Prints all glyph page trees.
(showGlyphPageTree): Added. Prints the glyph page tree for a given page.

  • platform/graphics/GlyphPageTreeNode.h:
  • platform/graphics/SegmentedFontData.cpp: (WebCore::SegmentedFontData::description): Added.
  • platform/graphics/SegmentedFontData.h:
  • platform/graphics/SimpleFontData.cpp: (WebCore::SimpleFontData::description): Added. Uses the platform data

as the description for non-svg, non-custom fonts.

  • platform/graphics/SimpleFontData.h:
  • platform/graphics/gtk/FontPlatformData.h:
  • platform/graphics/gtk/FontPlatformDataGtk.cpp: (WebCore::FontPlatformData::description): Added. Returns a null string.
  • platform/graphics/gtk/FontPlatformDataPango.cpp: (WebCore::FontPlatformData::description): Added. Returns a null string.
  • platform/graphics/mac/FontPlatformData.h:
  • platform/graphics/mac/FontPlatformDataMac.mm: (WebCore::FontPlatformData::description): Added. Returns the

description of the CGFont, the size and the synthetic style flags,
if set.

  • platform/graphics/qt/FontPlatformData.h:
  • platform/graphics/qt/FontPlatformDataQt.cpp: (WebCore::FontPlatformData::description): Added. Returns a null string.
  • platform/graphics/win/FontPlatformData.h:
  • platform/graphics/win/FontPlatformDataWin.cpp: (WebCore::FontPlatformData::description): Added. Returns a null string.
  • platform/graphics/wince/FontPlatformData.cpp: (WebCore::FontPlatformData::description): Added. Returns a null string.
  • platform/graphics/wince/FontPlatformData.h:
  • platform/graphics/wx/FontPlatformData.h:
  • platform/graphics/wx/FontPlatformDataWx.cpp: (WebCore::FontPlatformData::description): Added. Returns a null string.
Location:
trunk/WebCore
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r46383 r46388  
     12009-07-24  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Add functions to print the glyph page trees for debugging
     6        https://bugs.webkit.org/show_bug.cgi?id=27671
     7
     8        * platform/graphics/FontData.h: Defined a description() method.
     9
     10        * platform/graphics/GlyphPageTreeNode.cpp:
     11        (WebCore::GlyphPageTreeNode::showSubtree): Added. Prints the node and
     12            its descendants.
     13        (showGlyphPageTrees): Added. Prints all glyph page trees.
     14        (showGlyphPageTree): Added. Prints the glyph page tree for a given page.
     15        * platform/graphics/GlyphPageTreeNode.h:
     16
     17        * platform/graphics/SegmentedFontData.cpp:
     18        (WebCore::SegmentedFontData::description): Added.
     19
     20        * platform/graphics/SegmentedFontData.h:
     21        * platform/graphics/SimpleFontData.cpp:
     22        (WebCore::SimpleFontData::description): Added. Uses the platform data
     23            as the description for non-svg, non-custom fonts.
     24        * platform/graphics/SimpleFontData.h:
     25
     26        * platform/graphics/gtk/FontPlatformData.h:
     27        * platform/graphics/gtk/FontPlatformDataGtk.cpp:
     28        (WebCore::FontPlatformData::description): Added. Returns a null string.
     29        * platform/graphics/gtk/FontPlatformDataPango.cpp:
     30        (WebCore::FontPlatformData::description): Added. Returns a null string.
     31
     32        * platform/graphics/mac/FontPlatformData.h:
     33        * platform/graphics/mac/FontPlatformDataMac.mm:
     34        (WebCore::FontPlatformData::description): Added. Returns the
     35            description of the CGFont, the size and the synthetic style flags,
     36            if set.
     37
     38        * platform/graphics/qt/FontPlatformData.h:
     39        * platform/graphics/qt/FontPlatformDataQt.cpp:
     40        (WebCore::FontPlatformData::description): Added. Returns a null string.
     41
     42        * platform/graphics/win/FontPlatformData.h:
     43        * platform/graphics/win/FontPlatformDataWin.cpp:
     44        (WebCore::FontPlatformData::description): Added. Returns a null string.
     45
     46        * platform/graphics/wince/FontPlatformData.cpp:
     47        (WebCore::FontPlatformData::description): Added. Returns a null string.
     48        * platform/graphics/wince/FontPlatformData.h:
     49
     50        * platform/graphics/wx/FontPlatformData.h:
     51        * platform/graphics/wx/FontPlatformDataWx.cpp:
     52        (WebCore::FontPlatformData::description): Added. Returns a null string.
     53
    1542009-07-24  Mads Ager  <ager@chromium.org>
    255
  • trunk/WebCore/platform/graphics/FontData.h

    r45891 r46388  
    3333
    3434class SimpleFontData;
     35class String;
    3536
    3637class FontData : public Noncopyable {
     
    5253    unsigned maxGlyphPageTreeLevel() const { return m_maxGlyphPageTreeLevel; }
    5354
     55#ifndef NDEBUG
     56    virtual String description() const = 0;
     57#endif
     58
    5459private:
    5560    mutable unsigned m_maxGlyphPageTreeLevel;
  • trunk/WebCore/platform/graphics/GlyphPageTreeNode.cpp

    r43364 r46388  
    3030#include "GlyphPageTreeNode.h"
    3131
     32#include "CString.h"
    3233#include "CharacterNames.h"
    3334#include "SegmentedFontData.h"
     
    378379}
    379380
    380 }
     381#ifndef NDEBUG
     382    void GlyphPageTreeNode::showSubtree()
     383    {
     384        Vector<char> indent(level());
     385        indent.fill('\t', level());
     386        indent.append(0);
     387
     388        HashMap<const FontData*, GlyphPageTreeNode*>::iterator end = m_children.end();
     389        for (HashMap<const FontData*, GlyphPageTreeNode*>::iterator it = m_children.begin(); it != end; ++it) {
     390            printf("%s\t%p %s\n", indent.data(), it->first, it->first->description().utf8().data());
     391            it->second->showSubtree();
     392        }
     393        if (m_systemFallbackChild) {
     394            printf("%s\t* fallback\n", indent.data());
     395            m_systemFallbackChild->showSubtree();
     396        }
     397    }
     398#endif
     399
     400}
     401
     402#ifndef NDEBUG
     403void showGlyphPageTrees()
     404{
     405    printf("Page 0:\n");
     406    showGlyphPageTree(0);
     407    HashMap<int, WebCore::GlyphPageTreeNode*>::iterator end = WebCore::GlyphPageTreeNode::roots->end();
     408    for (HashMap<int, WebCore::GlyphPageTreeNode*>::iterator it = WebCore::GlyphPageTreeNode::roots->begin(); it != end; ++it) {
     409        printf("\nPage %d:\n", it->first);
     410        showGlyphPageTree(it->first);
     411    }
     412}
     413
     414void showGlyphPageTree(unsigned pageNumber)
     415{
     416    WebCore::GlyphPageTreeNode::getRoot(pageNumber)->showSubtree();
     417}
     418#endif
  • trunk/WebCore/platform/graphics/GlyphPageTreeNode.h

    r43373 r46388  
    3636#include <wtf/unicode/Unicode.h>
    3737
     38#ifndef NDEBUG
     39void showGlyphPageTrees();
     40void showGlyphPageTree(unsigned pageNumber);
     41#endif
     42
    3843namespace WebCore {
    3944
     
    211216    void initializePage(const FontData*, unsigned pageNumber);
    212217
     218#ifndef NDEBUG
     219    void showSubtree();
     220#endif
     221
    213222    GlyphPageTreeNode* m_parent;
    214223    RefPtr<GlyphPage> m_page;
     
    221230#ifndef NDEBUG
    222231    unsigned m_pageNumber;
     232
     233    friend void ::showGlyphPageTree(unsigned pageNumber);
    223234#endif
    224235};
  • trunk/WebCore/platform/graphics/SegmentedFontData.cpp

    r39818 r46388  
    2727#include "SegmentedFontData.h"
    2828
     29#include "PlatformString.h"
    2930#include "SimpleFontData.h"
    3031#include <wtf/Assertions.h>
     
    8889}
    8990
     91#ifndef NDEBUG
     92String SegmentedFontData::description() const
     93{
     94    return "[segmented font]";
     95}
     96#endif
     97
    9098} // namespace WebCore
  • trunk/WebCore/platform/graphics/SegmentedFontData.h

    r39818 r46388  
    6060    const FontDataRange& rangeAt(unsigned i) const { return m_ranges[i]; }
    6161
     62#ifndef NDEBUG
     63    virtual String description() const;
     64#endif
     65
    6266private:
    6367    virtual const SimpleFontData* fontDataForCharacter(UChar32) const;
  • trunk/WebCore/platform/graphics/SimpleFontData.cpp

    r44439 r46388  
    191191}
    192192
     193#ifndef NDEBUG
     194String SimpleFontData::description() const
     195{
     196    if (isSVGFont())
     197        return "[SVG font]";
     198    if (isCustomFont())
     199        return "[custom font]";
     200
     201    return platformData().description();
     202}
     203#endif
     204
    193205} // namespace WebCore
  • trunk/WebCore/platform/graphics/SimpleFontData.h

    r44442 r46388  
    106106    const GlyphData& missingGlyphData() const { return m_missingGlyphData; }
    107107
     108#ifndef NDEBUG
     109    virtual String description() const;
     110#endif
     111
    108112#if PLATFORM(MAC)
    109113    NSFont* getNSFont() const { return m_platformData.font(); }
  • trunk/WebCore/platform/graphics/gtk/FontPlatformData.h

    r44272 r46388  
    4242
    4343namespace WebCore {
     44
     45class String;
    4446
    4547class FontPlatformData {
     
    108110    };
    109111
     112#ifndef NDEBUG
     113    String description() const;
     114#endif
     115
    110116#if defined(USE_FREETYPE)
    111117    FcPattern* m_pattern;
  • trunk/WebCore/platform/graphics/gtk/FontPlatformDataGtk.cpp

    r42199 r46388  
    260260}
    261261
    262 }
     262#ifndef NDEBUG
     263String FontPlatformData::description() const
     264{
     265    return String();
     266}
     267#endif
     268
     269}
  • trunk/WebCore/platform/graphics/gtk/FontPlatformDataPango.cpp

    r46333 r46388  
    276276}
    277277
    278 }
     278#ifndef NDEBUG
     279String FontPlatformData::description() const
     280{
     281    return String();
     282}
     283#endif
     284
     285}
  • trunk/WebCore/platform/graphics/mac/FontPlatformData.h

    r44272 r46388  
    4545
    4646namespace WebCore {
     47
     48class String;
    4749
    4850#ifndef BUILDING_ON_TIGER
     
    119121#endif
    120122
     123#ifndef NDEBUG
     124    String description() const;
     125#endif
     126
    121127private:
    122128    static NSFont *hashTableDeletedFontValue() { return reinterpret_cast<NSFont *>(-1); }
  • trunk/WebCore/platform/graphics/mac/FontPlatformDataMac.mm

    r41939 r46388  
    2424#import "FontPlatformData.h"
    2525
     26#import "PlatformString.h"
    2627#import "WebCoreSystemInterface.h"
    2728#import <AppKit/NSFont.h>
     
    108109}
    109110
     111#ifndef NDEBUG
     112String FontPlatformData::description() const
     113{
     114    RetainPtr<CFStringRef> cgFontDescription(AdoptCF, CFCopyDescription(cgFont()));
     115    return String(cgFontDescription.get()) + " " + String::number(m_size) + (m_syntheticBold ? " synthetic bold" : "") + (m_syntheticOblique ? " syntheitic oblique" : "");
     116}
     117#endif
     118
    110119} // namespace WebCore
  • trunk/WebCore/platform/graphics/qt/FontPlatformData.h

    r46124 r46388  
    2525
    2626#include "FontDescription.h"
    27 
    2827#include <QFont>
    2928
    3029namespace WebCore {
     30
     31class String;
    3132
    3233class FontPlatformData
     
    4849    int pixelSize() const { return m_font.pixelSize(); }
    4950
     51#ifndef NDEBUG
     52    String description() const;
     53#endif
     54
    5055    float m_size;
    5156    bool m_bold;
  • trunk/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp

    r46124 r46388  
    2121#include "config.h"
    2222#include "FontPlatformData.h"
     23
     24#include "PlatformString.h"
    2325
    2426namespace WebCore {
     
    7981}
    8082
     83#ifndef NDEBUG
     84String FontPlatformData::description() const
     85{
     86    return String();
    8187}
     88#endif
     89
     90}
  • trunk/WebCore/platform/graphics/win/FontPlatformData.h

    r44740 r46388  
    4040
    4141class FontDescription;
     42class String;
    4243
    4344class FontPlatformData {
     
    108109    }
    109110
     111#ifndef NDEBUG
     112    String description() const;
     113#endif
     114
    110115private:
    111116    class RefCountedHFONT : public RefCounted<RefCountedHFONT> {
  • trunk/WebCore/platform/graphics/win/FontPlatformDataWin.cpp

    r44628 r46388  
    8686}
    8787
     88#ifndef NDEBUG
     89String FontPlatformData::description() const
     90{
     91    return String();
    8892}
     93#endif
     94
     95}
  • trunk/WebCore/platform/graphics/wince/FontPlatformData.cpp

    r46196 r46388  
    2525#include "FontCache.h"
    2626#include "FontData.h"
     27#include "PlatformString.h"
    2728#include "SimpleFontData.h"
    2829#include "UnicodeRange.h"
     
    522523}
    523524
    524 }
    525 
     525#ifndef NDEBUG
     526String FontPlatformData::description() const
     527{
     528    return String();
     529}
     530#endif
     531
     532}
  • trunk/WebCore/platform/graphics/wince/FontPlatformData.h

    r46196 r46388  
    3636
    3737    class FontPlatformPrivateData;
     38    class String;
    3839
    3940    class FontPlatformData {
     
    7677        static const String& defaultFontFamily();
    7778        static LONG adjustedGDIFontWeight(LONG gdiFontWeight, const String& family);
     79
     80#ifndef NDEBUG
     81        String description() const;
     82#endif
     83
    7884    private:
    7985        FontPlatformPrivateData* m_private;
  • trunk/WebCore/platform/graphics/wx/FontPlatformData.h

    r41044 r46388  
    4040
    4141namespace WebCore {
     42
     43class String;
    4244
    4345class FontHolder: public WTF::RefCounted<FontHolder>
     
    112114    bool isHashTableDeletedValue() const { return m_fontState == DELETED; }
    113115   
    114    
     116#ifndef NDEBUG
     117    String description() const;
     118#endif
    115119
    116120private:
  • trunk/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp

    r40965 r46388  
    2828
    2929#include "FontDescription.h"
    30 
     30#include "PlatformString.h"
    3131#include <wx/defs.h>
    3232#include <wx/gdicmn.h>
     
    123123}
    124124
     125#ifndef NDEBUG
     126String FontPlatformData::description() const
     127{
     128    return String();
    125129}
     130#endif
     131
     132}
Note: See TracChangeset for help on using the changeset viewer.