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

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

Issue 2646663002: [Blink] Don't center images in Android WebViews (Closed)
Patch Set: Update test 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // TODO(hiroshige): Remove this. 46 // TODO(hiroshige): Remove this.
47 ImageResource* cachedImageResourceDeprecated(); 47 ImageResource* cachedImageResourceDeprecated();
48 48
49 HTMLImageElement* imageElement() const { return m_imageElement.get(); } 49 HTMLImageElement* imageElement() const { return m_imageElement.get(); }
50 50
51 void windowSizeChanged(); 51 void windowSizeChanged();
52 void imageUpdated(); 52 void imageUpdated();
53 void imageClicked(int x, int y); 53 void imageClicked(int x, int y);
54 void imageLoaded(); 54 void imageLoaded();
55 void updateImageStyle(); 55 void updateImageStyle();
56 bool shouldShrinkToFit() const;
56 57
57 DECLARE_VIRTUAL_TRACE(); 58 DECLARE_VIRTUAL_TRACE();
58 59
59 private: 60 private:
60 explicit ImageDocument(const DocumentInit&); 61 explicit ImageDocument(const DocumentInit&);
61 62
62 DocumentParser* createParser() override; 63 DocumentParser* createParser() override;
63 64
64 void createDocumentStructure(); 65 void createDocumentStructure();
65 66
66 // Calculates how large the div needs to be to properly center the image. 67 // Calculates how large the div needs to be to properly center the image.
67 int calculateDivWidth(); 68 int calculateDivWidth();
68 69
69 // These methods are for m_shrinkToFitMode == Desktop. 70 // These methods are for m_shrinkToFitMode == Desktop.
70 void resizeImageToFit(); 71 void resizeImageToFit();
71 void restoreImageSize(); 72 void restoreImageSize();
72 bool imageFitsInWindow() const; 73 bool imageFitsInWindow() const;
73 bool shouldShrinkToFit() const;
74 // Calculates the image size multiplier that's needed to fit the image to 74 // Calculates the image size multiplier that's needed to fit the image to
75 // the window, taking into account page zoom and device scale. 75 // the window, taking into account page zoom and device scale.
76 float scale() const; 76 float scale() const;
77 77
78 Member<HTMLDivElement> m_divElement; 78 Member<HTMLDivElement> m_divElement;
79 Member<HTMLImageElement> m_imageElement; 79 Member<HTMLImageElement> m_imageElement;
80 80
81 // Whether enough of the image has been loaded to determine its size 81 // Whether enough of the image has been loaded to determine its size
82 bool m_imageSizeIsKnown; 82 bool m_imageSizeIsKnown;
83 83
(...skipping 15 matching lines...) Expand all
99 99
100 enum ShrinkToFitMode { Viewport, Desktop }; 100 enum ShrinkToFitMode { Viewport, Desktop };
101 ShrinkToFitMode m_shrinkToFitMode; 101 ShrinkToFitMode m_shrinkToFitMode;
102 }; 102 };
103 103
104 DEFINE_DOCUMENT_TYPE_CASTS(ImageDocument); 104 DEFINE_DOCUMENT_TYPE_CASTS(ImageDocument);
105 105
106 } // namespace blink 106 } // namespace blink
107 107
108 #endif // ImageDocument_h 108 #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