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; }
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(); }
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); }
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); }
int MediaValues::viewportHeight() const { if (m_mode == DynamicMode) return calculateViewportHeight(m_frame, m_style.get()); return m_viewportHeight; }
double MediaValuesDynamic::viewportHeight() const { if (m_viewportDimensionsOverridden) return m_viewportHeightOverride; return calculateViewportHeight(m_frame); }
int MediaValuesDynamic::viewportHeight() const { return calculateViewportHeight(m_frame); }