OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 class ImageResource; | 33 class ImageResource; |
34 class HTMLImageElement; | 34 class HTMLImageElement; |
35 | 35 |
36 class ImageDocument FINAL : public HTMLDocument { | 36 class ImageDocument FINAL : public HTMLDocument { |
37 public: | 37 public: |
38 static PassRefPtrWillBeRawPtr<ImageDocument> create(const DocumentInit& init
ializer = DocumentInit()) | 38 static PassRefPtrWillBeRawPtr<ImageDocument> create(const DocumentInit& init
ializer = DocumentInit()) |
39 { | 39 { |
40 return adoptRefWillBeNoop(new ImageDocument(initializer)); | 40 return adoptRefWillBeNoop(new ImageDocument(initializer)); |
41 } | 41 } |
42 | 42 |
| 43 enum ScaleType { |
| 44 ScaleZoomedDocument, |
| 45 ScaleOnlyUnzoomedDocument |
| 46 }; |
| 47 |
43 ImageResource* cachedImage(); | 48 ImageResource* cachedImage(); |
44 HTMLImageElement* imageElement() const { return m_imageElement.get(); } | 49 HTMLImageElement* imageElement() const { return m_imageElement.get(); } |
45 | 50 |
46 void windowSizeChanged(); | 51 void windowSizeChanged(ScaleType); |
47 void imageUpdated(); | 52 void imageUpdated(); |
48 void imageClicked(int x, int y); | 53 void imageClicked(int x, int y); |
49 | 54 |
50 virtual void trace(Visitor*) OVERRIDE; | 55 virtual void trace(Visitor*) OVERRIDE; |
51 | 56 |
52 private: | 57 private: |
53 explicit ImageDocument(const DocumentInit&); | 58 explicit ImageDocument(const DocumentInit&); |
54 | 59 |
55 virtual PassRefPtrWillBeRawPtr<DocumentParser> createParser() OVERRIDE; | 60 virtual PassRefPtrWillBeRawPtr<DocumentParser> createParser() OVERRIDE; |
56 #if !ENABLE(OILPAN) | 61 #if !ENABLE(OILPAN) |
57 virtual void dispose() OVERRIDE; | 62 virtual void dispose() OVERRIDE; |
58 #endif | 63 #endif |
59 | 64 |
60 void createDocumentStructure(); | 65 void createDocumentStructure(); |
61 void resizeImageToFit(); | 66 void resizeImageToFit(ScaleType); |
62 void restoreImageSize(); | 67 void restoreImageSize(ScaleType); |
63 bool imageFitsInWindow() const; | 68 bool imageFitsInWindow() const; |
64 bool shouldShrinkToFit() const; | 69 bool shouldShrinkToFit() const; |
65 float scale() const; | 70 float scale() const; |
66 | 71 |
67 RefPtrWillBeMember<HTMLImageElement> m_imageElement; | 72 RefPtrWillBeMember<HTMLImageElement> m_imageElement; |
68 | 73 |
69 // Whether enough of the image has been loaded to determine its size | 74 // Whether enough of the image has been loaded to determine its size |
70 bool m_imageSizeIsKnown; | 75 bool m_imageSizeIsKnown; |
71 | 76 |
72 // Whether the image is shrunk to fit or not | 77 // Whether the image is shrunk to fit or not |
73 bool m_didShrinkImage; | 78 bool m_didShrinkImage; |
74 | 79 |
75 // Whether the image should be shrunk or not | 80 // Whether the image should be shrunk or not |
76 bool m_shouldShrinkImage; | 81 bool m_shouldShrinkImage; |
77 }; | 82 }; |
78 | 83 |
79 DEFINE_DOCUMENT_TYPE_CASTS(ImageDocument); | 84 DEFINE_DOCUMENT_TYPE_CASTS(ImageDocument); |
80 | 85 |
81 } | 86 } |
82 | 87 |
83 #endif // ImageDocument_h | 88 #endif // ImageDocument_h |
OLD | NEW |