Bug 1631776 - Remove ImageDocument.restoreImageTo. r=smaug

Unused except for one caller that can just be inlined.

Differential Revision: https://phabricator.services.mozilla.com/D71757
This commit is contained in:
Emilio Cobos Álvarez 2020-04-21 16:51:51 +00:00
parent 36096a9aee
commit ca6c55183a
3 changed files with 6 additions and 15 deletions

View File

@ -323,7 +323,7 @@ void ImageDocument::ShrinkToFit() {
// 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);
ScrollImageTo(0, 0);
if (!mImageContent) {
// ScrollImageTo flush destroyed our content.
@ -337,12 +337,7 @@ void ImageDocument::ShrinkToFit() {
UpdateTitleAndCharset();
}
void ImageDocument::ScrollImageTo(int32_t aX, int32_t aY, bool restoreImage) {
if (restoreImage) {
RestoreImage();
FlushPendingNotifications(FlushType::Layout);
}
void ImageDocument::ScrollImageTo(int32_t aX, int32_t aY) {
RefPtr<PresShell> presShell = GetPresShell();
if (!presShell) {
return;
@ -518,7 +513,9 @@ ImageDocument::HandleEvent(Event* aEvent) {
y = event->ClientY() - img->OffsetTop();
}
mShouldResize = false;
RestoreImageTo(x, y);
RestoreImage();
FlushPendingNotifications(FlushType::Layout);
ScrollImageTo(x, y);
} else if (ImageIsOverflowing()) {
ShrinkToFit();
}

View File

@ -62,7 +62,6 @@ class ImageDocument final : public MediaDocument,
// way to mark those MOZ_CAN_RUN_SCRIPT yet.
MOZ_CAN_RUN_SCRIPT_BOUNDARY void ShrinkToFit();
void RestoreImage();
void RestoreImageTo(int32_t aX, int32_t aY) { ScrollImageTo(aX, aY, true); }
void NotifyPossibleTitleChange(bool aBoundTitleElement) override;
@ -75,7 +74,7 @@ class ImageDocument final : public MediaDocument,
void UpdateTitleAndCharset();
void ScrollImageTo(int32_t aX, int32_t aY, bool restoreImage);
void ScrollImageTo(int32_t aX, int32_t aY);
float GetRatio() {
return std::min(mVisibleWidth / mImageWidth, mVisibleHeight / mImageHeight);

View File

@ -18,9 +18,4 @@ interface ImageDocument : HTMLDocument {
/* Restore image original size. */
void restoreImage();
/* Restore the image, trying to keep a certain pixel in the same position.
* The coordinate system is that of the shrunken image.
*/
void restoreImageTo(long x, long y);
};