std::pair<CachedImage*, float> CSSImageSetValue::loadBestFitImage(CachedResourceLoader& loader, const ResourceLoaderOptions& options) { Document* document = loader.document(); updateDeviceScaleFactor(*document); if (!m_accessedBestFitImage) { m_accessedBestFitImage = true; // FIXME: In the future, we want to take much more than deviceScaleFactor into acount here. // All forms of scale should be included: Page::pageScaleFactor(), Frame::pageZoomFactor(), // and any CSS transforms. https://bugs.webkit.org/show_bug.cgi?id=81698 ImageWithScale image = bestImageForScaleFactor(); CachedResourceRequest request(ResourceRequest(document->completeURL(image.imageURL)), options); request.setInitiator(cachedResourceRequestInitiators().css); if (options.mode == FetchOptions::Mode::Cors) { ASSERT(document->securityOrigin()); updateRequestForAccessControl(request.mutableResourceRequest(), *document->securityOrigin(), options.allowCredentials); } m_cachedImage = loader.requestImage(request); m_bestFitImageScaleFactor = image.scaleFactor; } return { m_cachedImage.get(), m_bestFitImageScaleFactor }; }
HRESULT WinLauncher::init() { updateDeviceScaleFactor(); HRESULT hr = WebKitCreateInstance(CLSID_WebView, 0, IID_IWebView, reinterpret_cast<void**>(&m_webView.GetInterfacePtr())); if (FAILED(hr)) return hr; hr = m_webView->QueryInterface(IID_IWebViewPrivate2, reinterpret_cast<void**>(&m_webViewPrivate.GetInterfacePtr())); if (FAILED(hr)) return hr; hr = WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(m_webHistory), reinterpret_cast<void**>(&m_webHistory.GetInterfacePtr())); if (FAILED(hr)) return hr; hr = WebKitCreateInstance(CLSID_WebCoreStatistics, 0, __uuidof(m_statistics), reinterpret_cast<void**>(&m_statistics.GetInterfacePtr())); if (FAILED(hr)) return hr; hr = WebKitCreateInstance(CLSID_WebCache, 0, __uuidof(m_webCache), reinterpret_cast<void**>(&m_webCache.GetInterfacePtr())); return hr; }