void CSSFontFace::load(const FontDescription& fontDescription)
{
    if (loadStatus() == FontFace::Unloaded)
        setLoadStatus(FontFace::Loading);
    ASSERT(loadStatus() == FontFace::Loading);

    while (!m_sources.isEmpty()) {
        OwnPtrWillBeMember<CSSFontFaceSource>& source = m_sources.first();
        if (source->isValid()) {
            if (source->isLocal()) {
                if (source->isLocalFontAvailable(fontDescription)) {
                    setLoadStatus(FontFace::Loaded);
                    return;
                }
            } else {
                if (!source->isLoaded())
                    source->beginLoadIfNeeded();
                else
                    setLoadStatus(FontFace::Loaded);
                return;
            }
        }
        m_sources.removeFirst();
    }
    setLoadStatus(FontFace::Error);
}
void SMActionVideoNative::load(int time)
{
    if (!isLoaded())
    {
        SMAction::load(time);
        mediaPlayer->setMedia(mediaUrl());
        setLoadStatus(STATUS_LOADED);
    }
}
void CSSFontFace::fontLoaded(RemoteFontFaceSource* source)
{
    if (!isValid() || source != m_sources.first())
        return;

    if (loadStatus() == FontFace::Loading) {
        if (source->isValid()) {
            setLoadStatus(FontFace::Loaded);
        } else if (source->displayPeriod() == RemoteFontFaceSource::FailurePeriod) {
            m_sources.clear();
            setLoadStatus(FontFace::Error);
        } else {
            m_sources.removeFirst();
            load();
        }
    }

    if (m_segmentedFontFace)
        m_segmentedFontFace->fontFaceInvalidated();
}
void SMActionVideoVLC::load(int time)
{
    if (!isLoaded())
    {
        SMAction::load(time);qInfo() << mediaVLC();
        _m = libvlc_media_new_path(_vlcinstance, mediaVLC());
        if (!_m)
        {
            setStatus(STATUS_ERROR);
            setLoadStatus(STATUS_ERROR);
            return;
        }
        libvlc_media_player_set_media (_mp, _m);

        QString options = "input-repeat=";
        options += QString::number(repeat());
        libvlc_media_add_option(_m, options.toLatin1());

        setLoadStatus(STATUS_LOADED);
    }
}
void FontFace::initCSSFontFace(const unsigned char* data, unsigned size)
{
    m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get());
    if (m_error)
        return;

    RefPtr<SharedBuffer> buffer = SharedBuffer::create(data, size);
    OwnPtrWillBeRawPtr<BinaryDataFontFaceSource> source = adoptPtrWillBeNoop(new BinaryDataFontFaceSource(buffer.get(), m_otsParseMessage));
    if (source->isValid())
        setLoadStatus(Loaded);
    else
        setError(DOMException::create(SyntaxError, "Invalid font data in ArrayBuffer."));
    m_cssFontFace->addSource(source.release());
}
PassRefPtr<SimpleFontData> CSSFontFace::getFontData(const FontDescription& fontDescription)
{
    if (!isValid())
        return nullptr;

    while (!m_sources.isEmpty()) {
        OwnPtrWillBeMember<CSSFontFaceSource>& source = m_sources.first();
        if (RefPtr<SimpleFontData> result = source->getFontData(fontDescription)) {
            if (loadStatus() == FontFace::Unloaded && (source->isLoading() || source->isLoaded()))
                setLoadStatus(FontFace::Loading);
            if (loadStatus() == FontFace::Loading && source->isLoaded())
                setLoadStatus(FontFace::Loaded);
            return result.release();
        }
        m_sources.removeFirst();
    }

    if (loadStatus() == FontFace::Unloaded)
        setLoadStatus(FontFace::Loading);
    if (loadStatus() == FontFace::Loading)
        setLoadStatus(FontFace::Error);
    return nullptr;
}
Exemple #7
0
void CSSFontFace::fontLoaded(RemoteFontFaceSource* source)
{
    if (!isValid() || source != m_sources.first())
        return;

    if (loadStatus() == FontFace::Loading) {
        if (source->ensureFontData()) {
            setLoadStatus(FontFace::Loaded);
        } else {
            m_sources.removeFirst();
            load();
        }
    }

    if (m_segmentedFontFace)
        m_segmentedFontFace->fontLoaded(this);
}
Exemple #8
0
void CSSFontFace::fontLoaded(RemoteFontFaceSource* source)
{
    if (m_segmentedFontFace)
        m_segmentedFontFace->fontSelector()->fontFaceInvalidated();

    if (!isValid() || source != m_sources.first())
        return;

    if (loadStatus() == FontFace::Loading) {
        if (source->ensureFontData()) {
            setLoadStatus(FontFace::Loaded);
            Document* document = m_segmentedFontFace ? m_segmentedFontFace->fontSelector()->document() : 0;
            if (document && source->isSVGFontFaceSource())
                UseCounter::count(*document, UseCounter::SVGFontInCSS);
        } else {
            m_sources.removeFirst();
            load();
        }
    }

    if (m_segmentedFontFace)
        m_segmentedFontFace->fontLoaded(this);
}
void FontFace::setError(DOMException* error)
{
    if (!m_error)
        m_error = error ? error : DOMException::create(NetworkError);
    setLoadStatus(Error);
}
void CSSFontFace::didBeginLoad()
{
    if (loadStatus() == FontFace::Unloaded)
        setLoadStatus(FontFace::Loading);
}
Exemple #11
0
void FontFace::setError(PassRefPtrWillBeRawPtr<DOMException> error)
{
    if (!m_error)
        m_error = error ? error : DOMException::create(NetworkError);
    setLoadStatus(Error);
}