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

Side by Side Diff: third_party/WebKit/Source/core/html/ImageDocument.h

Issue 2647633004: [Blink] Don't center images in Android WebViews (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/ImageDocument.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 ImageResource* cachedImage(); 44 ImageResource* cachedImage();
45 HTMLImageElement* imageElement() const { return m_imageElement.get(); } 45 HTMLImageElement* imageElement() const { return m_imageElement.get(); }
46 46
47 void windowSizeChanged(); 47 void windowSizeChanged();
48 void imageUpdated(); 48 void imageUpdated();
49 void imageClicked(int x, int y); 49 void imageClicked(int x, int y);
50 void imageLoaded(); 50 void imageLoaded();
51 void updateImageStyle(); 51 void updateImageStyle();
52 bool shouldShrinkToFit() const;
52 53
53 DECLARE_VIRTUAL_TRACE(); 54 DECLARE_VIRTUAL_TRACE();
54 55
55 private: 56 private:
56 explicit ImageDocument(const DocumentInit&); 57 explicit ImageDocument(const DocumentInit&);
57 58
58 DocumentParser* createParser() override; 59 DocumentParser* createParser() override;
59 60
60 void createDocumentStructure(); 61 void createDocumentStructure();
61 62
62 // Calculates how large the div needs to be to properly center the image. 63 // Calculates how large the div needs to be to properly center the image.
63 int calculateDivWidth(); 64 int calculateDivWidth();
64 65
65 // These methods are for m_shrinkToFitMode == Desktop. 66 // These methods are for m_shrinkToFitMode == Desktop.
66 void resizeImageToFit(); 67 void resizeImageToFit();
67 void restoreImageSize(); 68 void restoreImageSize();
68 bool imageFitsInWindow() const; 69 bool imageFitsInWindow() const;
69 bool shouldShrinkToFit() const;
70 // Calculates the image size multiplier that's needed to fit the image to 70 // Calculates the image size multiplier that's needed to fit the image to
71 // the window, taking into account page zoom and device scale. 71 // the window, taking into account page zoom and device scale.
72 float scale() const; 72 float scale() const;
73 73
74 Member<HTMLDivElement> m_divElement; 74 Member<HTMLDivElement> m_divElement;
75 Member<HTMLImageElement> m_imageElement; 75 Member<HTMLImageElement> m_imageElement;
76 76
77 // Whether enough of the image has been loaded to determine its size 77 // Whether enough of the image has been loaded to determine its size
78 bool m_imageSizeIsKnown; 78 bool m_imageSizeIsKnown;
79 79
(...skipping 15 matching lines...) Expand all
95 95
96 enum ShrinkToFitMode { Viewport, Desktop }; 96 enum ShrinkToFitMode { Viewport, Desktop };
97 ShrinkToFitMode m_shrinkToFitMode; 97 ShrinkToFitMode m_shrinkToFitMode;
98 }; 98 };
99 99
100 DEFINE_DOCUMENT_TYPE_CASTS(ImageDocument); 100 DEFINE_DOCUMENT_TYPE_CASTS(ImageDocument);
101 101
102 } // namespace blink 102 } // namespace blink
103 103
104 #endif // ImageDocument_h 104 #endif // ImageDocument_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/ImageDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698