This source file includes following definitions.
- height
- width
- colorDepth
- pixelDepth
- availLeft
- availTop
- availHeight
- availWidth
- interfaceName
- executionContext
- trace
#include "config.h"
#include "core/frame/Screen.h"
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "platform/PlatformScreen.h"
#include "platform/geometry/FloatRect.h"
namespace WebCore {
Screen::Screen(LocalFrame* frame)
: DOMWindowProperty(frame)
{
ScriptWrappable::init(this);
}
unsigned Screen::height() const
{
if (!m_frame)
return 0;
FrameHost* host = m_frame->host();
if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk())
return lroundf(screenRect(m_frame->view()).height() * host->deviceScaleFactor());
return static_cast<unsigned>(screenRect(m_frame->view()).height());
}
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());
}
unsigned Screen::colorDepth() const
{
if (!m_frame)
return 0;
return static_cast<unsigned>(screenDepth(m_frame->view()));
}
unsigned Screen::pixelDepth() const
{
if (!m_frame)
return 0;
return static_cast<unsigned>(screenDepth(m_frame->view()));
}
int Screen::availLeft() const
{
if (!m_frame)
return 0;
FrameHost* host = m_frame->host();
if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk())
return lroundf(screenAvailableRect(m_frame->view()).x() * host->deviceScaleFactor());
return static_cast<int>(screenAvailableRect(m_frame->view()).x());
}
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());
}
unsigned Screen::availHeight() const
{
if (!m_frame)
return 0;
FrameHost* host = m_frame->host();
if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk())
return lroundf(screenAvailableRect(m_frame->view()).height() * host->deviceScaleFactor());
return static_cast<unsigned>(screenAvailableRect(m_frame->view()).height());
}
unsigned Screen::availWidth() const
{
if (!m_frame)
return 0;
FrameHost* host = m_frame->host();
if (host && host->settings().reportScreenSizeInPhysicalPixelsQuirk())
return lroundf(screenAvailableRect(m_frame->view()).width() * host->deviceScaleFactor());
return static_cast<unsigned>(screenAvailableRect(m_frame->view()).width());
}
const AtomicString& Screen::interfaceName() const
{
return EventTargetNames::Screen;
}
ExecutionContext* Screen::executionContext() const
{
if (!m_frame)
return 0;
return m_frame->document();
}
void Screen::trace(Visitor* visitor)
{
#if ENABLE(OILPAN)
HeapSupplementable<Screen>::trace(visitor);
#endif
}
}