mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 870021 - Part 5.2 - Ask content to compute its intrinsic size in nsImageFrame. r=roc
This commit is contained in:
parent
4835ecf8b1
commit
1e69a6e978
@ -734,9 +734,29 @@ nsImageFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
nsPresContext *presContext = PresContext();
|
||||
EnsureIntrinsicSizeAndRatio(presContext);
|
||||
|
||||
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
|
||||
NS_ASSERTION(imageLoader, "No content node??");
|
||||
mozilla::IntrinsicSize intrinsicSize(mIntrinsicSize);
|
||||
|
||||
if (intrinsicSize.width.GetUnit() == eStyleUnit_Coord) {
|
||||
uint32_t width;
|
||||
if (NS_SUCCEEDED(imageLoader->GetNaturalWidth(&width))) {
|
||||
nscoord appWidth = nsPresContext::CSSPixelsToAppUnits((int32_t)width);
|
||||
intrinsicSize.width.SetCoordValue(appWidth);
|
||||
}
|
||||
}
|
||||
|
||||
if (intrinsicSize.height.GetUnit() == eStyleUnit_Coord) {
|
||||
uint32_t height;
|
||||
if (NS_SUCCEEDED(imageLoader->GetNaturalHeight(&height))) {
|
||||
nscoord appHeight = nsPresContext::CSSPixelsToAppUnits((int32_t)height);
|
||||
intrinsicSize.height.SetCoordValue(appHeight);
|
||||
}
|
||||
}
|
||||
|
||||
return nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(
|
||||
aRenderingContext, this,
|
||||
mIntrinsicSize, mIntrinsicRatio, aCBSize,
|
||||
intrinsicSize, mIntrinsicRatio, aCBSize,
|
||||
aMargin, aBorder, aPadding);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user