Bug 1965106. Fix ClippedImage and DynamicImage GetIntrinsicSizeInAppUnits to actually be in app units. r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D249234
This commit is contained in:
Timothy Nikkel
2025-05-15 02:31:05 +00:00
committed by tnikkel@mozilla.com
parent 0d52118bbf
commit 684f118472
2 changed files with 7 additions and 4 deletions

View File

@@ -18,6 +18,7 @@
#include "gfxUtils.h" #include "gfxUtils.h"
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"
#include "mozilla/SVGImageContext.h" #include "mozilla/SVGImageContext.h"
#include "nsPresContext.h"
#include "mozilla/gfx/2D.h" #include "mozilla/gfx/2D.h"
@@ -212,8 +213,8 @@ ClippedImage::GetIntrinsicSizeInAppUnits(nsSize* aSize) {
return InnerImage()->GetIntrinsicSizeInAppUnits(aSize); return InnerImage()->GetIntrinsicSizeInAppUnits(aSize);
} }
// XXXdholbert This probably needs to be scaled; see bug 1965106. *aSize = nsSize(nsPresContext::CSSPixelsToAppUnits(mClip.Width()),
*aSize = nsSize(mClip.Width(), mClip.Height()); nsPresContext::CSSPixelsToAppUnits(mClip.Height()));
return NS_OK; return NS_OK;
} }

View File

@@ -14,6 +14,7 @@
#include "ImageRegion.h" #include "ImageRegion.h"
#include "Orientation.h" #include "Orientation.h"
#include "mozilla/image/Resolution.h" #include "mozilla/image/Resolution.h"
#include "nsPresContext.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
@@ -108,9 +109,10 @@ DynamicImage::GetIntrinsicSize(ImageIntrinsicSize* aIntrinsicSize) {
NS_IMETHODIMP NS_IMETHODIMP
DynamicImage::GetIntrinsicSizeInAppUnits(nsSize* aSize) { DynamicImage::GetIntrinsicSizeInAppUnits(nsSize* aSize) {
// XXXdholbert This probably needs to be scaled; see bug 1965106.
IntSize intSize(mDrawable->Size()); IntSize intSize(mDrawable->Size());
*aSize = nsSize(intSize.width, intSize.height);
*aSize = nsSize(nsPresContext::CSSPixelsToAppUnits(intSize.width),
nsPresContext::CSSPixelsToAppUnits(intSize.height));
return NS_OK; return NS_OK;
} }