Backed out 3 changesets (bug 1680387) for causing browser chrome failures on browser_bug592641.js. CLOSED TREE

Backed out changeset 65616921e520 (bug 1680387)
Backed out changeset 51531850a9a2 (bug 1680387)
Backed out changeset 0c1c5e1f901b (bug 1680387)
This commit is contained in:
Iulian Moraru
2021-05-04 16:28:17 +03:00
parent 42c3df8006
commit 8facca1839
64 changed files with 350 additions and 674 deletions

View File

@@ -710,33 +710,28 @@ uint32_t HTMLImageElement::Height() { return GetWidthHeightForImage().height; }
uint32_t HTMLImageElement::Width() { return GetWidthHeightForImage().width; }
nsIntSize HTMLImageElement::NaturalSize() {
if (!mCurrentRequest) {
return {};
}
uint32_t HTMLImageElement::NaturalHeight() {
uint32_t height = nsImageLoadingContent::NaturalHeight();
nsCOMPtr<imgIContainer> image;
mCurrentRequest->GetImage(getter_AddRefs(image));
if (!image) {
return {};
}
nsIntSize size;
Unused << image->GetHeight(&size.height);
Unused << image->GetWidth(&size.width);
ImageResolution resolution = image->GetResolution();
// NOTE(emilio): What we implement here matches the image-set() spec, but it's
// unclear whether this is the right thing to do, see
// https://github.com/whatwg/html/pull/5574#issuecomment-826335244.
if (mResponsiveSelector) {
float density = mResponsiveSelector->GetSelectedImageDensity();
double density = mResponsiveSelector->GetSelectedImageDensity();
MOZ_ASSERT(density >= 0.0);
resolution.ScaleBy(density);
height = NSToIntRound(double(height) / density);
}
resolution.ApplyTo(size.width, size.height);
return size;
return height;
}
uint32_t HTMLImageElement::NaturalWidth() {
uint32_t width = nsImageLoadingContent::NaturalWidth();
if (mResponsiveSelector) {
double density = mResponsiveSelector->GetSelectedImageDensity();
MOZ_ASSERT(density >= 0.0);
width = NSToIntRound(double(width) / density);
}
return width;
}
nsresult HTMLImageElement::CopyInnerTo(HTMLImageElement* aDest) {