Exemple #1
0
void PlatformSupport::getRenderStyleForStrike(const char* font, int sizeAndStyle, FontRenderStyle* result)
{
#if !OS(ANDROID)
    WebFontRenderStyle style;

    if (webKitPlatformSupport()->sandboxSupport())
        webKitPlatformSupport()->sandboxSupport()->getRenderStyleForStrike(font, sizeAndStyle, &style);
    else
        WebFontInfo::renderStyleForStrike(font, sizeAndStyle, &style);

    style.toFontRenderStyle(result);
#endif
}
Exemple #2
0
PlatformMessagePortChannel::PlatformMessagePortChannel()
    : m_localPort(0)
{
    m_webChannel = webKitPlatformSupport()->createMessagePortChannel();
    if (m_webChannel)
        m_webChannel->setClient(this);
}
void SocketStreamHandleInternal::connect(const KURL& url)
{
    m_socket = adoptPtr(webKitPlatformSupport()->createSocketStreamHandle());
    LOG(Network, "connect");
    ASSERT(m_socket.get());
    m_socket->connect(url, this);
}
Exemple #4
0
PassOwnPtr<AudioBus> PlatformSupport::decodeAudioFileData(const char* data, size_t size, double sampleRate)
{
    WebAudioBus webAudioBus;
    if (webKitPlatformSupport()->loadAudioResource(&webAudioBus, data, size, sampleRate))
        return webAudioBus.release();
    return nullptr;
}
Exemple #5
0
void PlatformSupport::paintScrollbarArrow(
    GraphicsContext* gc, int state, int classicState,
    const IntRect& rect)
{
    webKitPlatformSupport()->themeEngine()->paintScrollbarArrow(
        gc->platformContext()->canvas(), state, classicState, rect);
}
Exemple #6
0
void PlatformSupport::paintTrackbar(
    GraphicsContext* gc, int part, int state, int classicState,
    const IntRect& rect)
{
    webKitPlatformSupport()->themeEngine()->paintTrackbar(
        gc->platformContext()->canvas(), part, state, classicState, rect);
}
Exemple #7
0
LinkHash PlatformSupport::visitedLinkHash(const KURL& base,
                                         const AtomicString& attributeURL)
{
    // Resolve the relative URL using googleurl and pass the absolute URL up to
    // the embedder. We could create a GURL object from the base and resolve
    // the relative URL that way, but calling the lower-level functions
    // directly saves us the string allocation in most cases.
    url_canon::RawCanonOutput<2048> buffer;
    url_parse::Parsed parsed;

#if USE(GOOGLEURL)
    const CString& cstr = base.utf8String();
    const char* data = cstr.data();
    int length = cstr.length();
    const url_parse::Parsed& srcParsed = base.parsed();
#else
    // When we're not using GoogleURL, first canonicalize it so we can resolve it
    // below.
    url_canon::RawCanonOutput<2048> srcCanon;
    url_parse::Parsed srcParsed;
    String str = base.string();
    if (!url_util::Canonicalize(str.characters(), str.length(), 0, &srcCanon, &srcParsed))
        return 0;
    const char* data = srcCanon.data();
    int length = srcCanon.length();
#endif

    if (!url_util::ResolveRelative(data, length, srcParsed, attributeURL.characters(),
                                   attributeURL.length(), 0, &buffer, &parsed))
        return 0;  // Invalid resolved URL.

    return webKitPlatformSupport()->visitedLinkHash(buffer.data(), buffer.length());
}
Exemple #8
0
String PlatformSupport::signedPublicKeyAndChallengeString(
    unsigned keySizeIndex, const String& challenge, const KURL& url)
{
    return webKitPlatformSupport()->signedPublicKeyAndChallengeString(keySizeIndex,
                                                             WebString(challenge),
                                                             WebURL(url));
}
Exemple #9
0
void PlatformSupport::paintThemePart(
    GraphicsContext* gc, ThemePart part, ThemePaintState state, const IntRect& rect, const ThemePaintExtraParams* extraParams)
{
    WebThemeEngine::ExtraParams webThemeExtraParams;
    GetWebThemeExtraParams(part, state, extraParams, &webThemeExtraParams);
    webKitPlatformSupport()->themeEngine()->paint(
        gc->platformContext()->canvas(), WebThemePart(part), WebThemeState(state), rect, &webThemeExtraParams);
}
Exemple #10
0
bool PlatformSupport::ensureFontLoaded(HFONT font)
{
    WebSandboxSupport* ss = webKitPlatformSupport()->sandboxSupport();

    // if there is no sandbox, then we can assume the font
    // was able to be loaded successfully already
    return ss ? ss->ensureFontLoaded(font) : true;
}
Exemple #11
0
bool PlatformSupport::getFileModificationTime(const String& path, time_t& result)
{
    double modificationTime;
    if (!webKitPlatformSupport()->fileUtilities()->getFileModificationTime(path, modificationTime))
        return false;
    result = static_cast<time_t>(modificationTime);
    return true;
}
Exemple #12
0
void PlatformSupport::clipboardWriteSelection(const String& htmlText,
                                             const KURL& sourceURL,
                                             const String& plainText,
                                             bool writeSmartPaste)
{
    webKitPlatformSupport()->clipboard()->writeHTML(
        htmlText, sourceURL, plainText, writeSmartPaste);
}
Exemple #13
0
bool PlatformSupport::clipboardIsFormatAvailable(
    PasteboardPrivate::ClipboardFormat format,
    PasteboardPrivate::ClipboardBuffer buffer)
{
    return webKitPlatformSupport()->clipboard()->isFormatAvailable(
        static_cast<WebClipboard::Format>(format),
        static_cast<WebClipboard::Buffer>(buffer));
}
Exemple #14
0
LinkHash PlatformSupport::visitedLinkHash(const UChar* url, unsigned length)
{
    url_canon::RawCanonOutput<2048> buffer;
    url_parse::Parsed parsed;
    if (!url_util::Canonicalize(url, length, 0, &buffer, &parsed))
        return 0;  // Invalid URLs are unvisited.
    return webKitPlatformSupport()->visitedLinkHash(buffer.data(), buffer.length());
}
Exemple #15
0
PassOwnPtr<AudioBus> PlatformSupport::loadPlatformAudioResource(const char* name, double sampleRate)
{
    const WebData& resource = webKitPlatformSupport()->loadResource(name);
    if (resource.isEmpty())
        return nullptr;
    
    return decodeAudioFileData(resource.data(), resource.size(), sampleRate);
}
Exemple #16
0
void PlatformSupport::clipboardReadHTML(
    PasteboardPrivate::ClipboardBuffer buffer,
    String* htmlText, KURL* sourceURL, unsigned* fragmentStart, unsigned* fragmentEnd)
{
    WebURL url;
    *htmlText = webKitPlatformSupport()->clipboard()->readHTML(
        static_cast<WebClipboard::Buffer>(buffer), &url, fragmentStart, fragmentEnd);
    *sourceURL = url;
}
Exemple #17
0
void PlatformSupport::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters, const char* preferredLocale, FontFamily* family)
{
#if OS(ANDROID)
    // FIXME: We do not use fontconfig on Android, so use simple logic for now.
    // https://bugs.webkit.org/show_bug.cgi?id=67587
    family->name = "Arial";
    family->isBold = false;
    family->isItalic = false;
#else
    WebFontFamily webFamily;
    if (webKitPlatformSupport()->sandboxSupport())
        webKitPlatformSupport()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters, preferredLocale, &webFamily);
    else
        WebFontInfo::familyForChars(characters, numCharacters, preferredLocale, &webFamily);
    family->name = String::fromUTF8(webFamily.name.data(), webFamily.name.length());
    family->isBold = webFamily.isBold;
    family->isItalic = webFamily.isItalic;
#endif
}
Exemple #18
0
static WebCookieJar* getCookieJar(const Document* document)
{
    WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(document->frame());
    if (!frameImpl || !frameImpl->client())
        return 0;
    WebCookieJar* cookieJar = frameImpl->client()->cookieJar(frameImpl);
    if (!cookieJar)
        cookieJar = webKitPlatformSupport()->cookieJar();
    return cookieJar;
}
Exemple #19
0
HashSet<String> PlatformSupport::clipboardReadAvailableTypes(
    PasteboardPrivate::ClipboardBuffer buffer, bool* containsFilenames)
{
    WebVector<WebString> result = webKitPlatformSupport()->clipboard()->readAvailableTypes(
        static_cast<WebClipboard::Buffer>(buffer), containsFilenames);
    HashSet<String> types;
    for (size_t i = 0; i < result.size(); ++i)
        types.add(result[i]);
    return types;
}
Exemple #20
0
PassRefPtr<Image> PlatformSupport::loadPlatformImageResource(const char* name)
{
    const WebData& resource = webKitPlatformSupport()->loadResource(name);
    if (resource.isEmpty())
        return Image::nullImage();

    RefPtr<Image> image = BitmapImage::create();
    image->setData(resource, true);
    return image;
}
Exemple #21
0
void PlatformSupport::clipboardWriteImage(NativeImagePtr image,
                                         const KURL& sourceURL,
                                         const String& title)
{
#if WEBKIT_USING_SKIA
    WebImage webImage(image->bitmap());
#else
    WebImage webImage(image);
#endif
    webKitPlatformSupport()->clipboard()->writeImage(webImage, sourceURL, title);
}
Exemple #22
0
void PlatformSupport::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const String& keyPath, Vector<RefPtr<IDBKey> >& keys)
{
    WebVector<WebSerializedScriptValue> webValues = values;
    WebVector<WebIDBKey> webKeys;
    webKitPlatformSupport()->createIDBKeysFromSerializedValuesAndKeyPath(webValues, keyPath, webKeys);

    size_t webKeysSize = webKeys.size();
    keys.reserveCapacity(webKeysSize);
    for (size_t i = 0; i < webKeysSize; ++i)
        keys.append(PassRefPtr<IDBKey>(webKeys[i]));
}
Exemple #23
0
void PlatformSupport::paintTextField(
    GraphicsContext* gc, int part, int state, int classicState,
    const IntRect& rect, const Color& color, bool fillContentArea,
    bool drawEdges)
{
    // Fallback to white when |color| is invalid.
    RGBA32 backgroundColor = color.isValid() ? color.rgb() : Color::white;

    webKitPlatformSupport()->themeEngine()->paintTextField(
        gc->platformContext()->canvas(), part, state, classicState, rect,
        backgroundColor, fillContentArea, drawEdges);
}
Exemple #24
0
void ResourceHandleInternal::start()
{
    if (m_state != ConnectionStateNew)
        CRASH();
    m_state = ConnectionStateStarted;

    m_loader = adoptPtr(webKitPlatformSupport()->createURLLoader());
    ASSERT(m_loader);

    WrappedResourceRequest wrappedRequest(m_request);
    wrappedRequest.setAllowStoredCredentials(allowStoredCredentials());
    m_loader->loadAsynchronously(wrappedRequest, this);
}
Exemple #25
0
bool PlatformSupport::loadFont(NSFont* srcFont, CGFontRef* out, uint32_t* fontID)
{
    WebSandboxSupport* ss = webKitPlatformSupport()->sandboxSupport();
    if (ss)
        return ss->loadFont(srcFont, out, fontID);

    // This function should only be called in response to an error loading a
    // font due to being blocked by the sandbox.
    // This by definition shouldn't happen if there is no sandbox support.
    ASSERT_NOT_REACHED();
    *out = 0;
    *fontID = 0;
    return false;
}
Exemple #26
0
CCThreadImpl::CCThreadImpl(WebThread* thread)
    : m_thread(thread)
{
    if (thread == webKitPlatformSupport()->currentThread()) {
        m_threadID = currentThread();
        return;
    }

    // Get the threadId for the newly-created thread by running a task
    // on that thread, blocking on the result.
    m_threadID = currentThread();
    CCCompletionEvent completion;
    m_thread->postTask(new GetThreadIDTask(&m_threadID, &completion));
    completion.wait();
}
Exemple #27
0
// static
void ResourceHandle::loadResourceSynchronously(NetworkingContext* context,
                                               const ResourceRequest& request,
                                               StoredCredentials storedCredentials,
                                               ResourceError& error,
                                               ResourceResponse& response,
                                               Vector<char>& data)
{
    OwnPtr<WebURLLoader> loader = adoptPtr(webKitPlatformSupport()->createURLLoader());
    ASSERT(loader);

    WrappedResourceRequest requestIn(request);
    requestIn.setAllowStoredCredentials(storedCredentials == AllowStoredCredentials);
    WrappedResourceResponse responseOut(response);
    WebURLError errorOut;
    WebData dataOut;

    loader->loadSynchronously(requestIn, responseOut, errorOut, dataOut);

    error = errorOut;
    data.clear();
    data.append(dataOut.data(), dataOut.size());
}
Exemple #28
0
void PlatformSupport::sampleGamepads(GamepadList* into)
{
    WebGamepads gamepads;

    webKitPlatformSupport()->sampleGamepads(gamepads);

    for (unsigned i = 0; i < WebKit::WebGamepads::itemsLengthCap; ++i) {
        WebGamepad& webGamepad = gamepads.items[i];
        if (i < gamepads.length && webGamepad.connected) {
            RefPtr<Gamepad> gamepad = into->item(i);
            if (!gamepad)
                gamepad = Gamepad::create();
            gamepad->id(webGamepad.id);
            gamepad->index(i);
            gamepad->timestamp(webGamepad.timestamp);
            gamepad->axes(webGamepad.axesLength, webGamepad.axes);
            gamepad->buttons(webGamepad.buttonsLength, webGamepad.buttons);
            into->set(i, gamepad);
        } else
            into->set(i, 0);
    }
}
Exemple #29
0
void PlatformSupport::paintScrollbarThumb(
    GraphicsContext* gc, ThemePaintState state, ThemePaintSize size, const IntRect& rect, const ThemePaintScrollbarInfo& scrollbarInfo)
{
    WebThemeEngine::ScrollbarInfo webThemeScrollbarInfo;

    webThemeScrollbarInfo.orientation = static_cast<WebThemeEngine::ScrollbarOrientation>(scrollbarInfo.orientation);
    webThemeScrollbarInfo.parent = static_cast<WebThemeEngine::ScrollbarParent>(scrollbarInfo.parent);
    webThemeScrollbarInfo.maxValue = scrollbarInfo.maxValue;
    webThemeScrollbarInfo.currentValue = scrollbarInfo.currentValue;
    webThemeScrollbarInfo.visibleSize = scrollbarInfo.visibleSize;
    webThemeScrollbarInfo.totalSize = scrollbarInfo.totalSize;

#if WEBKIT_USING_SKIA
    WebKit::WebCanvas* webCanvas = gc->platformContext()->canvas();
#else
    WebKit::WebCanvas* webCanvas = gc->platformContext();
#endif
    webKitPlatformSupport()->themeEngine()->paintScrollbarThumb(
        webCanvas,
        static_cast<WebThemeEngine::State>(state),
        static_cast<WebThemeEngine::Size>(size),
        rect,
        webThemeScrollbarInfo);
}
IDBFactoryBackendProxy::IDBFactoryBackendProxy()
    : m_webIDBFactory(webKitPlatformSupport()->idbFactory())
{
}