MediaValuesCached::MediaValuesCached(LocalFrame* frame)
{
    ASSERT(isMainThread());
    ASSERT(frame);
    // In case that frame is missing (e.g. for images that their document does not have a frame)
    // We simply leave the MediaValues object with the default MediaValuesCachedData values.
    m_data.viewportWidth = calculateViewportWidth(frame);
    m_data.viewportHeight = calculateViewportHeight(frame);
    m_data.deviceWidth = calculateDeviceWidth(frame);
    m_data.deviceHeight = calculateDeviceHeight(frame);
    m_data.devicePixelRatio = calculateDevicePixelRatio(frame);
    m_data.colorBitsPerComponent = calculateColorBitsPerComponent(frame);
    m_data.monochromeBitsPerComponent = calculateMonochromeBitsPerComponent(frame);
    m_data.primaryPointerType = calculatePrimaryPointerType(frame);
    m_data.availablePointerTypes = calculateAvailablePointerTypes(frame);
    m_data.primaryHoverType = calculatePrimaryHoverType(frame);
    m_data.availableHoverTypes = calculateAvailableHoverTypes(frame);
    m_data.defaultFontSize = calculateDefaultFontSize(frame);
    m_data.threeDEnabled = calculateThreeDEnabled(frame);
    m_data.strictMode = calculateStrictMode(frame);
    m_data.displayMode = calculateDisplayMode(frame);
    const String mediaType = calculateMediaType(frame);
    if (!mediaType.isEmpty())
        m_data.mediaType = mediaType.isolatedCopy();
}
示例#2
0
PassRefPtr<MediaValues> MediaValues::create(LocalFrame* frame, RenderStyle* style, MediaValuesMode mode)
{
    ASSERT(frame && style);
    RefPtr<MediaValues> mediaValues;
    mediaValues = adoptRef(new MediaValues(frame, style, mode));
    if (mode == CachingMode) {
        mediaValues->m_viewportWidth = calculateViewportWidth(frame, style);
        mediaValues->m_viewportHeight = calculateViewportHeight(frame, style),
        mediaValues->m_deviceWidth = calculateDeviceWidth(frame),
        mediaValues->m_deviceHeight = calculateDeviceHeight(frame),
        mediaValues->m_devicePixelRatio = calculateDevicePixelRatio(frame),
        mediaValues->m_colorBitsPerComponent = calculateColorBitsPerComponent(frame),
        mediaValues->m_monochromeBitsPerComponent = calculateMonochromeBitsPerComponent(frame),
        mediaValues->m_pointer = calculateLeastCapablePrimaryPointerDeviceType(frame),
        mediaValues->m_defaultFontSize = calculateDefaultFontSize(style),
        mediaValues->m_threeDEnabled = calculateThreeDEnabled(frame),
        mediaValues->m_scanMediaType = calculateScanMediaType(frame),
        mediaValues->m_screenMediaType = calculateScreenMediaType(frame),
        mediaValues->m_printMediaType = calculatePrintMediaType(frame),
        mediaValues->m_strictMode = calculateStrictMode(frame);

        mediaValues->m_style.clear();
        mediaValues->m_frame = 0;
    }

    return mediaValues;
}
示例#3
0
MediaValuesCached::MediaValuesCached(LocalFrame* frame)
{
    ASSERT(isMainThread());
    ASSERT(frame);
    // In case that frame is missing (e.g. for images that their document does not have a frame)
    // We simply leave the MediaValues object with the default MediaValuesCachedData values.
    m_data.viewportWidth = calculateViewportWidth(frame);
    m_data.viewportHeight = calculateViewportHeight(frame);
    m_data.deviceWidth = calculateDeviceWidth(frame);
    m_data.deviceHeight = calculateDeviceHeight(frame);
    m_data.devicePixelRatio = calculateDevicePixelRatio(frame);
    m_data.colorBitsPerComponent = calculateColorBitsPerComponent(frame);
    m_data.monochromeBitsPerComponent = calculateMonochromeBitsPerComponent(frame);
    m_data.pointer = calculateLeastCapablePrimaryPointerDeviceType(frame);
    m_data.defaultFontSize = calculateDefaultFontSize(frame);
    m_data.threeDEnabled = calculateThreeDEnabled(frame);
    m_data.scanMediaType = calculateScanMediaType(frame);
    m_data.screenMediaType = calculateScreenMediaType(frame);
    m_data.printMediaType = calculatePrintMediaType(frame);
    m_data.strictMode = calculateStrictMode(frame);
}
示例#4
0
bool MediaValues::strictMode() const
{
    if (m_mode == DynamicMode)
        return calculateStrictMode(m_frame);
    return m_strictMode;
}
示例#5
0
bool MediaValuesDynamic::strictMode() const {
  return calculateStrictMode(m_frame);
}