Ejemplo n.º 1
0
WebTouchEvent WebEventFactory::createWebTouchEvent(const EwkTouchEvent* event, const AffineTransform& toWebContent)
{
    API::Array* touchPointsArray = toImpl(event->touchPoints());
    size_t size = touchPointsArray->size();

    Vector<WebPlatformTouchPoint> touchPoints;
    touchPoints.reserveInitialCapacity(size);

    for (size_t i = 0; i < size; ++i) {
        if (EwkTouchPoint* point = touchPointsArray->at<EwkTouchPoint>(i))
            touchPoints.uncheckedAppend(WebPlatformTouchPoint(point->id(), toWebPlatformTouchPointState(point->state()), toIntPoint(point->screenPosition()), toWebContent.mapPoint(toIntPoint(point->position())), toIntSize(point->radius()), point->rotationAngle(), point->forceFactor()));
    }

    return WebTouchEvent(toWebEventType(event->eventType()), touchPoints, toWebEventModifiers(event->modifiers()), event->timestamp());
}
Ejemplo n.º 2
0
static void webkitCookieManagerGetDomainsWithCookiesCallback(WKArrayRef wkDomains, WKErrorRef, void* context)
{
    GRefPtr<GTask> task = adoptGRef(G_TASK(context));
    if (g_task_return_error_if_cancelled(task.get()))
        return;

    API::Array* domains = toImpl(wkDomains);
    GPtrArray* returnValue = g_ptr_array_sized_new(domains->size());
    for (size_t i = 0; i < domains->size(); ++i) {
        API::String* domainString = static_cast<API::String*>(domains->at(i));
        String domain = domainString->string();
        if (domain.isEmpty())
            continue;
        g_ptr_array_add(returnValue, g_strdup(domain.utf8().data()));
    }
    g_ptr_array_add(returnValue, 0);
    g_task_return_pointer(task.get(), g_ptr_array_free(returnValue, FALSE), reinterpret_cast<GDestroyNotify>(g_strfreev));
}
static Vector<String> filePathsFromFileURLs(const API::Array& fileURLs)
{
    Vector<String> filePaths;

    size_t size = fileURLs.size();
    filePaths.reserveInitialCapacity(size);

    for (size_t i = 0; i < size; ++i) {
        API::URL* apiURL = fileURLs.at<API::URL>(i);
        if (apiURL)
            filePaths.uncheckedAppend(URL(URL(), apiURL->string()).fileSystemPath());
    }

    return filePaths;
}