Beispiel #1
0
StyleResolverChange StyleEngine::resolverChanged(RecalcStyleTime time, StyleResolverUpdateMode mode)
{
    StyleResolverChange change;

    if (!isMaster()) {
        if (Document* master = this->master())
            master->styleResolverChanged(time, mode);
        return change;
    }

    // Don't bother updating, since we haven't loaded all our style info yet
    // and haven't calculated the style selector for the first time.
    if (!m_document.isActive() || shouldClearResolver()) {
        clearResolver();
        return change;
    }

    m_didCalculateResolver = true;
    if (m_document.didLayoutWithPendingStylesheets() && !hasPendingSheets())
        change.setNeedsRepaint();

    if (updateActiveStyleSheets(mode))
        change.setNeedsStyleRecalc();

    return change;
}
void CryptoResultImpl::cancel()
{
    ASSERT(m_cancel);
    m_cancel->cancel();
    m_cancel.clear();
    clearResolver();
}
void CryptoResultImpl::completeWithKey(const WebCryptoKey& key)
{
    if (!m_resolver)
        return;

    m_resolver->resolve(CryptoKey::create(key));
    clearResolver();
}
void CryptoResultImpl::completeWithBoolean(bool b)
{
    if (!m_resolver)
        return;

    m_resolver->resolve(b);
    clearResolver();
}
void CryptoResultImpl::completeWithBuffer(const void* bytes, unsigned bytesSize)
{
    if (!m_resolver)
        return;

    m_resolver->resolve(DOMArrayBuffer::create(bytes, bytesSize));
    clearResolver();
}
void CryptoResultImpl::completeWithError(WebCryptoErrorType errorType, const WebString& errorDetails)
{
    if (!m_resolver)
        return;

    ExceptionCode ec = webCryptoErrorToExceptionCode(errorType);

    // Handle TypeError separately, as it cannot be created using
    // DOMException.
    if (ec == V8TypeError)
        rejectWithTypeError(errorDetails, m_resolver);
    else
        m_resolver->reject(DOMException::create(ec, errorDetails));
    clearResolver();
}
void CryptoResultImpl::completeWithKeyPair(const WebCryptoKey& publicKey, const WebCryptoKey& privateKey)
{
    if (!m_resolver)
        return;

    ScriptState* scriptState = m_resolver->getScriptState();
    ScriptState::Scope scope(scriptState);

    V8ObjectBuilder keyPair(scriptState);

    keyPair.add("publicKey", ScriptValue::from(scriptState, CryptoKey::create(publicKey)));
    keyPair.add("privateKey", ScriptValue::from(scriptState, CryptoKey::create(privateKey)));

    m_resolver->resolve(keyPair.v8Value());
    clearResolver();
}
Beispiel #8
0
void StyleEngine::resolverChanged(StyleResolverUpdateMode mode)
{
    if (!isMaster()) {
        if (Document* master = this->master())
            master->styleResolverChanged(mode);
        return;
    }

    // Don't bother updating, since we haven't loaded all our style info yet
    // and haven't calculated the style selector for the first time.
    if (!document().isActive()) {
        clearResolver();
        return;
    }

    updateActiveStyleSheets(mode);
}
void CryptoResultImpl::completeWithJson(const char* utf8Data, unsigned length)
{
    if (!m_resolver)
        return;

    ScriptState* scriptState = m_resolver->getScriptState();
    ScriptState::Scope scope(scriptState);

    v8::Local<v8::String> jsonString = v8AtomicString(scriptState->isolate(), utf8Data, length);

    v8::TryCatch exceptionCatcher(scriptState->isolate());
    v8::Local<v8::Value> jsonDictionary;
    if (v8Call(v8::JSON::Parse(scriptState->isolate(), jsonString), jsonDictionary, exceptionCatcher))
        m_resolver->resolve(jsonDictionary);
    else
        m_resolver->reject(exceptionCatcher.Exception());
    clearResolver();
}
Beispiel #10
0
void StyleEngine::didDetach()
{
    clearResolver();
}