Beispiel #1
0
unsigned Screen::width() const
{
    if (!m_frame)
        return 0;
    FrameHost* host = m_frame->host();
    if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk())
        return lroundf(screenRect(m_frame->view()).width() * host->deviceScaleFactor());
    return static_cast<unsigned>(screenRect(m_frame->view()).width());
}
Beispiel #2
0
int Screen::availTop() const
{
    if (!m_frame)
        return 0;
    FrameHost* host = m_frame->host();
    if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk())
        return lroundf(screenAvailableRect(m_frame->view()).y() * host->deviceScaleFactor());
    return static_cast<int>(screenAvailableRect(m_frame->view()).y());
}
Beispiel #3
0
int Screen::availTop() const
{
    if (!m_frame)
        return 0;
    FrameHost* host = m_frame->host();
    if (!host)
        return 0;
    if (host->settings().reportScreenSizeInPhysicalPixelsQuirk())
        return lroundf(host->chromeClient().screenInfo().availableRect.y * host->deviceScaleFactor());
    return static_cast<int>(host->chromeClient().screenInfo().availableRect.y);
}
Beispiel #4
0
int Screen::width() const
{
    if (!m_frame)
        return 0;
    FrameHost* host = m_frame->host();
    if (!host)
        return 0;
    if (host->settings().reportScreenSizeInPhysicalPixelsQuirk())
        return lroundf(host->chromeClient().screenInfo().rect.width * host->deviceScaleFactor());
    return host->chromeClient().screenInfo().rect.width;
}
Storage* DOMWindowStorage::localStorage(ExceptionState& exceptionState) const
{
    if (!m_window->isCurrentlyDisplayedInFrame())
        return nullptr;
    Document* document = m_window->document();
    if (!document)
        return nullptr;
    String accessDeniedMessage = "Access is denied for this document.";
    if (!document->securityOrigin()->canAccessLocalStorage()) {
        if (document->isSandboxed(SandboxOrigin))
            exceptionState.throwSecurityError("The document is sandboxed and lacks the 'allow-same-origin' flag.");
        else if (document->url().protocolIs("data"))
            exceptionState.throwSecurityError("Storage is disabled inside 'data:' URLs.");
        else
            exceptionState.throwSecurityError(accessDeniedMessage);
        return nullptr;
    }
    if (m_localStorage) {
        if (!m_localStorage->area()->canAccessStorage(m_window->frame())) {
            exceptionState.throwSecurityError(accessDeniedMessage);
            return nullptr;
        }
        return m_localStorage;
    }
    // FIXME: Seems this check should be much higher?
    FrameHost* host = document->frameHost();
    if (!host || !host->settings().localStorageEnabled())
        return nullptr;
    StorageArea* storageArea = StorageNamespace::localStorageArea(document->securityOrigin());
    if (!storageArea->canAccessStorage(m_window->frame())) {
        exceptionState.throwSecurityError(accessDeniedMessage);
        return nullptr;
    }
    m_localStorage = Storage::create(m_window->frame(), storageArea);
    return m_localStorage;
}