Exemplo n.º 1
0
void Settings::initializeDefaultFontFamilies()
{
    static const char* kLanguages[] = {
        "ar",
        "bn",
        "gu",
        "he",
        "hi",
        "ja",
        "kn",
        "ko",
        "ml",
        "pa",
        "ta",
        "te",
        "th",
        "zh-CN",
        "zh-TW",
    };

    static BlackBerry::Platform::String* languages[WTF_ARRAY_LENGTH(kLanguages)];
    static bool init = false;
    if (!init) {
        for (size_t i = 0; i < WTF_ARRAY_LENGTH(kLanguages); ++i)
            languages[i] = new BlackBerry::Platform::String(kLanguages[i]);
        init = true;
    }

    STATIC_LOCAL_STRING(s_webkitCursive, "-webkit-cursive");
    STATIC_LOCAL_STRING(s_webkitFantasy, "-webkit-fantasy");
    STATIC_LOCAL_STRING(s_webkitMonospace, "-webkit-monospace");
    STATIC_LOCAL_STRING(s_webkitSansSerif, "-webkit-sans-serif");
    STATIC_LOCAL_STRING(s_webkitSerif, "-webkit-serif");
    STATIC_LOCAL_STRING(s_webkitStandard, "-webkit-standard");

    setCursiveFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_webkitCursive, BlackBerry::Platform::String::emptyString()));
    setFantasyFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_webkitFantasy, BlackBerry::Platform::String::emptyString()));
    setFixedFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_webkitMonospace, BlackBerry::Platform::String::emptyString()));
    setSansSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_webkitSansSerif, BlackBerry::Platform::String::emptyString()));
    setSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_webkitSerif, BlackBerry::Platform::String::emptyString()));
    setStandardFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_webkitStandard, BlackBerry::Platform::String::emptyString()));

    STATIC_LOCAL_STRING(s_monospace, "monospace");
    STATIC_LOCAL_STRING(s_serif, "serif");
    STATIC_LOCAL_STRING(s_sansSerif, "sans-serif");
    for (size_t i = 0; i < WTF_ARRAY_LENGTH(languages); ++i) {
        UScriptCode script = localeToScriptCodeForFontSelection(*languages[i]);
        setFixedFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_monospace, *languages[i]), script);
        setSansSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_sansSerif, *languages[i]), script);
        setSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_serif, *languages[i]), script);
        setStandardFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(BlackBerry::Platform::String::emptyString(), *languages[i]), script);
    }
}
Exemplo n.º 2
0
void DumpRenderTree::runTest(const String& url, const String& imageHash)
{
    mainFrame->loader()->stopForUserCancel();
    resetToConsistentStateBeforeTesting(url, imageHash);
    if (shouldLogFrameLoadDelegates(url))
        gTestRunner->setDumpFrameLoadCallbacks(true);
    if (!runFromCommandLine) {
        createFile(m_resultsDir + *m_currentTest + ".dump.crash");

        String stdoutFile = m_resultsDir + *m_currentTest + ".dump";
        String stderrFile = m_resultsDir + *m_currentTest + ".stderr";

        // FIXME: we should preserve the original stdout and stderr here but aren't doing
        // that yet due to issues with dup, etc.
        freopen(stdoutFile.utf8().data(), "wb", stdout);
        freopen(stderrFile.utf8().data(), "wb", stderr);
    }
    FILE* current = fopen(m_currentTestFile.utf8().data(), "w");
    if (current) {
        fwrite(m_currentTest->utf8().data(), 1, m_currentTest->utf8().length(), current);
        fclose(current);
    }
    BlackBerry::Platform::NetworkRequest request;
    STATIC_LOCAL_STRING(s_get, "GET");
    request.setRequestUrl(url, s_get);
    m_page->load(request);
}