Ejemplo n.º 1
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;
}
Ejemplo n.º 2
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.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();
}
Ejemplo n.º 3
0
bool MediaValuesDynamic::computeLength(double value,
                                       CSSPrimitiveValue::UnitType type,
                                       double& result) const {
  return MediaValues::computeLength(value, type,
                                    calculateDefaultFontSize(m_frame),
                                    calculateViewportWidth(m_frame),
                                    calculateViewportHeight(m_frame), result);
}
Ejemplo n.º 4
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);
}
Ejemplo n.º 5
0
int MediaValues::viewportWidth() const
{
    if (m_mode == DynamicMode)
        return calculateViewportWidth(m_frame, m_style.get());
    return m_viewportWidth;
}
Ejemplo n.º 6
0
double MediaValuesDynamic::viewportWidth() const {
  if (m_viewportDimensionsOverridden)
    return m_viewportWidthOverride;
  return calculateViewportWidth(m_frame);
}
Ejemplo n.º 7
0
int MediaValuesDynamic::viewportWidth() const
{
    return calculateViewportWidth(m_frame);
}