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

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

Issue 2445413003: [Blink] Display images on a dark background (Closed)
Patch Set: Rebase Created 4 years, 1 month 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
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 29 matching lines...) Expand all
40 const DocumentInit& initializer = DocumentInit()) { 40 const DocumentInit& initializer = DocumentInit()) {
41 return new ImageDocument(initializer); 41 return new ImageDocument(initializer);
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();
51 void updateImageStyle();
50 52
51 DECLARE_VIRTUAL_TRACE(); 53 DECLARE_VIRTUAL_TRACE();
52 54
53 private: 55 private:
54 explicit ImageDocument(const DocumentInit&); 56 explicit ImageDocument(const DocumentInit&);
55 57
56 DocumentParser* createParser() override; 58 DocumentParser* createParser() override;
57 59
58 void createDocumentStructure(); 60 void createDocumentStructure();
59 61
62 // Calculates how large the div needs to be to properly center the image.
63 int calculateDivWidth();
64
60 // These methods are for m_shrinkToFitMode == Desktop. 65 // These methods are for m_shrinkToFitMode == Desktop.
61 void resizeImageToFit(); 66 void resizeImageToFit();
62 void restoreImageSize(); 67 void restoreImageSize();
63 bool imageFitsInWindow() const; 68 bool imageFitsInWindow() const;
64 bool shouldShrinkToFit() const; 69 bool shouldShrinkToFit() const;
65 // 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
66 // the window, taking into account page zoom and device scale. 71 // the window, taking into account page zoom and device scale.
67 float scale() const; 72 float scale() const;
68 73
69 Member<HTMLDivElement> m_divElement; 74 Member<HTMLDivElement> m_divElement;
70 Member<HTMLImageElement> m_imageElement; 75 Member<HTMLImageElement> m_imageElement;
71 76
72 // 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
73 bool m_imageSizeIsKnown; 78 bool m_imageSizeIsKnown;
74 79
75 // Whether the image is shrunk to fit or not 80 // Whether the image is shrunk to fit or not
76 bool m_didShrinkImage; 81 bool m_didShrinkImage;
77 82
78 // Whether the image should be shrunk or not 83 // Whether the image should be shrunk or not
79 bool m_shouldShrinkImage; 84 bool m_shouldShrinkImage;
80 85
86 // Whether the image has finished loading or not
87 bool m_imageIsLoaded;
88
89 // Size of the checkerboard background tiles
90 int m_checkerSize;
91
81 enum ShrinkToFitMode { Viewport, Desktop }; 92 enum ShrinkToFitMode { Viewport, Desktop };
82 ShrinkToFitMode m_shrinkToFitMode; 93 ShrinkToFitMode m_shrinkToFitMode;
83 }; 94 };
84 95
85 DEFINE_DOCUMENT_TYPE_CASTS(ImageDocument); 96 DEFINE_DOCUMENT_TYPE_CASTS(ImageDocument);
86 97
87 } // namespace blink 98 } // namespace blink
88 99
89 #endif // ImageDocument_h 100 #endif // ImageDocument_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698