TEST(ImageCandidateTest, Basic) { ImageCandidate candidate; ASSERT_EQ(candidate.density(), 1); ASSERT_EQ(candidate.getResourceWidth(), -1); ASSERT_EQ(candidate.srcOrigin(), false); }
void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidate& candidate) { m_bestFitImageURL = candidate.url(); float candidateDensity = candidate.density(); if (candidateDensity >= 0) m_imageDevicePixelRatio = 1.0 / candidateDensity; if (candidate.resourceWidth() > 0) { m_intrinsicSizingViewportDependant = true; UseCounter::count(document(), UseCounter::SrcsetWDescriptor); } else if (!candidate.srcOrigin()) { UseCounter::count(document(), UseCounter::SrcsetXDescriptor); } if (layoutObject() && layoutObject()->isImage()) toLayoutImage(layoutObject())->setImageDevicePixelRatio(m_imageDevicePixelRatio); }