Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: third_party/WebKit/Source/core/html/ImageDocument.h

Issue 2319863006: Change image document zooming logic. (Closed)
Patch Set: enforce Desktop mode Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/ImageDocument.h
diff --git a/third_party/WebKit/Source/core/html/ImageDocument.h b/third_party/WebKit/Source/core/html/ImageDocument.h
index 7602b27aa0aa303a57768f0ffcff90bb2315d6c0..035c4e625034b9dad846dea8c70bfead63ecf82c 100644
--- a/third_party/WebKit/Source/core/html/ImageDocument.h
+++ b/third_party/WebKit/Source/core/html/ImageDocument.h
@@ -40,15 +40,10 @@ public:
return new ImageDocument(initializer);
}
- enum ScaleType {
- ScaleZoomedDocument,
- ScaleOnlyUnzoomedDocument
- };
-
ImageResource* cachedImage();
HTMLImageElement* imageElement() const { return m_imageElement.get(); }
- void windowSizeChanged(ScaleType);
+ void windowSizeChanged();
void imageUpdated();
void imageClicked(int x, int y);
@@ -62,10 +57,12 @@ private:
void createDocumentStructure();
// These methods are for m_shrinkToFitMode == Desktop.
- void resizeImageToFit(ScaleType);
- void restoreImageSize(ScaleType);
+ void resizeImageToFit();
+ void restoreImageSize();
bool imageFitsInWindow() const;
bool shouldShrinkToFit() const;
+ // Calculates the image size multiplier that's needed to fit the image to
+ // the window, taking into account page zoom and device scale.
float scale() const;
Member<HTMLImageElement> m_imageElement;
@@ -84,6 +81,8 @@ private:
Desktop
};
ShrinkToFitMode m_shrinkToFitMode;
+
+ friend class ImageDocumentTest;
Nate Chapin 2016/09/16 21:48:24 I don't think is necessary? The only private membe
Bret 2016/09/16 22:24:24 Yes, but ImageDocumentTest is setting m_imageEleme
Nate Chapin 2016/09/16 22:28:12 Hrm, I can live with this, but I'd like to be cert
Bret 2016/09/16 23:00:01 I took a second look and found I can use ImageDocu
Bret 2016/09/16 23:29:23 Oh hey, that works.
};
DEFINE_DOCUMENT_TYPE_CASTS(ImageDocument);

Powered by Google App Engine
This is Rietveld 408576698