mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1145903 - Use CSS to shrinkToFit instead of a racy set of width/height on the image frame. r=tnikkel
MozReview-Commit-ID: GnBcPLMGKDS --HG-- extra : rebase_source : 665ac8fd0cf60745dff19940ddd1201a6cd5145f
This commit is contained in:
parent
1d1fd489f5
commit
222f9bc8c4
@ -339,12 +339,6 @@ ImageDocument::ShrinkToFit()
|
||||
return;
|
||||
}
|
||||
|
||||
// Keep image content alive while changing the attributes.
|
||||
nsCOMPtr<nsIContent> imageContent = mImageContent;
|
||||
nsCOMPtr<nsIDOMHTMLImageElement> image = do_QueryInterface(mImageContent);
|
||||
image->SetWidth(std::max(1, NSToCoordFloor(GetRatio() * mImageWidth)));
|
||||
image->SetHeight(std::max(1, NSToCoordFloor(GetRatio() * mImageHeight)));
|
||||
|
||||
// The view might have been scrolled when zooming in, scroll back to the
|
||||
// origin now that we're showing a shrunk-to-window version.
|
||||
ScrollImageTo(0, 0, false);
|
||||
|
@ -114,6 +114,9 @@ protected:
|
||||
|
||||
float mVisibleWidth;
|
||||
float mVisibleHeight;
|
||||
// XXX: The image width/height isn't invalidated to reflect the up-to-date
|
||||
// width/height of the image frame. In particular when the
|
||||
// StyleVisibility orientation changes this value isn't updated.
|
||||
int32_t mImageWidth;
|
||||
int32_t mImageHeight;
|
||||
|
||||
|
@ -15,6 +15,9 @@
|
||||
|
||||
.shrinkToFit {
|
||||
cursor: zoom-in;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user