Changeset 60005 in webkit


Ignore:
Timestamp:
May 22, 2010 10:17:09 AM (14 years ago)
Author:
tkent@chromium.org
Message:

2010-05-22 Kent Tamura <tkent@chromium.org>

Reviewed by Dimitri Glazkov.

[DRT/Chromium] Link resources and load Ahem font for Windows
https://bugs.webkit.org/show_bug.cgi?id=39473

  • WebKit.gyp: Add net and webkit resources for Windows. Copy AHEM.TTF to DumpRenderTree.exe directory.

2010-05-22 Kent Tamura <tkent@chromium.org>

Reviewed by Dimitri Glazkov.

[DRT/Chromium] Link resources and load Ahem font for Windows
https://bugs.webkit.org/show_bug.cgi?id=39473

  • DumpRenderTree/chromium/DumpRenderTree.cpp: (main): Call platformInit().
  • DumpRenderTree/chromium/TestShell.h: Declare platformInit(). It is not related to TestShell class, but the implementation of paltformInit() is placed at TestShell*.{cpp,mm}.
  • DumpRenderTree/chromium/TestShellGtk.cpp: (platformInit):
  • DumpRenderTree/chromium/TestShellMac.mm: (platformInit):
  • DumpRenderTree/chromium/TestShellWin.cpp: (platformInit):
    • Make stdout/stderr binary mode
    • Load Ahem font
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r59935 r60005  
     12010-05-22  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        [DRT/Chromium] Link resources and load Ahem font for Windows
     6        https://bugs.webkit.org/show_bug.cgi?id=39473
     7
     8        * WebKit.gyp:
     9          Add net and webkit resources for Windows.
     10          Copy AHEM____.TTF to DumpRenderTree.exe directory.
     11
    1122010-05-21  Steve Block  <steveblock@google.com>
    213
  • trunk/WebKit/chromium/WebKit.gyp

    r59772 r60005  
    4848            }],
    4949        ],
     50        'ahem_path': '../../WebKitTools/DumpRenderTree/qt/fonts/AHEM____.TTF',
    5051    },
    5152    'targets': [
     
    580581            ],
    581582            'conditions': [
     583                ['OS=="win"', {
     584                    'resource_include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/webkit'],
     585                    'sources': [
     586                       '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc',
     587                       '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc',
     588                       '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc',
     589                       '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.rc',
     590                    ],
     591                    'copies': [{
     592                       'destination': '<(PRODUCT_DIR)',
     593                       'files': ['<(ahem_path)'],
     594                    }],
     595                }],
    582596                ['OS=="mac"', {
    583597                    'dependencies': ['LayoutTestHelper'],
    584598
    585599                    'mac_bundle_resources': [
    586                         '../../WebKitTools/DumpRenderTree/qt/fonts/AHEM____.TTF',
     600                        '<(ahem_path)',
    587601                        '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf',
    588602                        '../../WebKitTools/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf',
  • trunk/WebKitTools/ChangeLog

    r59986 r60005  
     12010-05-22  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        [DRT/Chromium] Link resources and load Ahem font for Windows
     6        https://bugs.webkit.org/show_bug.cgi?id=39473
     7
     8        * DumpRenderTree/chromium/DumpRenderTree.cpp:
     9        (main): Call platformInit().
     10        * DumpRenderTree/chromium/TestShell.h:
     11         Declare platformInit(). It is not related to TestShell class, but the
     12         implementation of paltformInit() is placed at TestShell*.{cpp,mm}.
     13        * DumpRenderTree/chromium/TestShellGtk.cpp:
     14        (platformInit):
     15        * DumpRenderTree/chromium/TestShellMac.mm:
     16        (platformInit):
     17        * DumpRenderTree/chromium/TestShellWin.cpp:
     18        (platformInit):
     19         - Make stdout/stderr binary mode
     20         - Load Ahem font
     21
    1222010-05-21  Eric Seidel  <eric@webkit.org>
    223
  • trunk/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp

    r58862 r60005  
    3737using namespace std;
    3838
     39void platformInit();
     40
    3941static const char optionComplexText[] = "--complex-text";
    4042static const char optionDumpAllPixels[] = "--dump-all-pixels";
     
    6062{
    6163    webkit_support::SetUpTestEnvironment();
     64    platformInit();
    6265
    6366    TestParams params;
  • trunk/WebKitTools/DumpRenderTree/chromium/TestShell.h

    r59193 r60005  
    154154#endif
    155155};
     156
     157void platformInit();
  • trunk/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp

    r57703 r60005  
    6363    signal(SIGALRM, SIG_DFL);
    6464}
     65
     66void platformInit()
     67{
     68}
  • trunk/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm

    r56966 r60005  
    124124    [thread release];
    125125}
     126
     127void platformInit()
     128{
     129}
  • trunk/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp

    r57649 r60005  
    3333
    3434#include "webkit/support/webkit_support.h"
     35#include <fcntl.h>
     36#include <io.h>
    3537#include <process.h>
     38#include <shlwapi.h>
     39#include <sys/stat.h>
    3640
    3741// Default timeout in ms for file page loads when in layout test mode.
     
    99103    WaitForSingleObject(threadHandle, 1000);
    100104}
     105
     106void platformInit()
     107{
     108    // Set stdout/stderr binary mode.
     109    _setmode(_fileno(stdout), _O_BINARY);
     110    _setmode(_fileno(stderr), _O_BINARY);
     111
     112    // Load Ahem font.
     113    // AHEM____.TTF is copied to the directory of DumpRenderTree.exe by WebKit.gyp.
     114    WCHAR path[_MAX_PATH];
     115    if (!::GetModuleFileName(0, path, _MAX_PATH)) {
     116        fprintf(stderr, "Can't get the module path.\n");
     117        exit(1);
     118    }
     119    ::PathRemoveFileSpec(path);
     120    wcscat_s(path, _MAX_PATH, L"/AHEM____.TTF");
     121    struct _stat ahemStat;
     122    if (_wstat(path, &ahemStat) == -1) {
     123        fprintf(stderr, "Can't access: '%S'\n", path);
     124        exit(1);
     125    }
     126
     127    FILE* fp = _wfopen(path, L"rb");
     128    if (!fp) {
     129        _wperror(path);
     130        exit(1);
     131    }
     132    size_t size = ahemStat.st_size;
     133    char* fontBuffer = new char[size];
     134    if (fread(fontBuffer, 1, size, fp) != size) {
     135        fprintf(stderr, "Can't read the font: '%S'\n", path);
     136        fclose(fp);
     137        exit(1);
     138    }
     139    fclose(fp);
     140    DWORD numFonts = 1;
     141    HANDLE fontHandle = ::AddFontMemResourceEx(fontBuffer, size, 0, &numFonts);
     142    delete[] fontBuffer; // OS owns a copy of the buffer.
     143    if (!fontHandle) {
     144        fprintf(stderr, "Failed to register Ahem font: '%S'\n", path);
     145        exit(1);
     146    }
     147    // We don't need to release the font explicitly.
     148}
Note: See TracChangeset for help on using the changeset viewer.