Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 setHeight(newSize.height()); | 91 setHeight(newSize.height()); |
| 92 m_ignoreReset = false; | 92 m_ignoreReset = false; |
| 93 reset(); | 93 reset(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Called by Document::getCSSCanvasContext as well as above getContext(). | 96 // Called by Document::getCSSCanvasContext as well as above getContext(). |
| 97 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva sContextCreationAttributes&); | 97 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva sContextCreationAttributes&); |
| 98 | 98 |
| 99 bool isPaintable() const; | 99 bool isPaintable() const; |
| 100 | 100 |
| 101 static String toEncodingMimeType(const String& mimeType); | 101 static String toEncodingMimeType(const String& mimeType, const String& callF unctionName); |
| 102 String toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&) const; | 102 String toDataURL(const String& mimeType, const ScriptValue& qualityArgument, ExceptionState&) const; |
| 103 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con st { return toDataURL(mimeType, ScriptValue(), exceptionState); } | 103 String toDataURL(const String& mimeType, ExceptionState& exceptionState) con st { return toDataURL(mimeType, ScriptValue(), exceptionState); } |
| 104 | 104 |
| 105 void toBlob(BlobCallback*, const String& mimeType, const ScriptValue& qualit yArgument, ExceptionState&); | 105 void toBlob(BlobCallback*, const String& mimeType, const ScriptValue& qualit yArgument, ExceptionState&); |
| 106 void toBlob(BlobCallback* callback, const String& mimeType, ExceptionState& exceptionState) { return toBlob(callback, mimeType, ScriptValue(), exceptionStat e); } | 106 void toBlob(BlobCallback* callback, const String& mimeType, ExceptionState& exceptionState) { return toBlob(callback, mimeType, ScriptValue(), exceptionStat e); } |
| 107 | 107 |
| 108 // Used for canvas capture. | 108 // Used for canvas capture. |
| 109 void addListener(CanvasDrawListener*); | 109 void addListener(CanvasDrawListener*); |
| 110 void removeListener(CanvasDrawListener*); | 110 void removeListener(CanvasDrawListener*); |
| 111 | 111 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex tFactory>); | 178 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex tFactory>); |
| 179 void updateExternallyAllocatedMemory() const; | 179 void updateExternallyAllocatedMemory() const; |
| 180 | 180 |
| 181 void styleDidChange(const ComputedStyle* oldStyle, const ComputedStyle& newS tyle); | 181 void styleDidChange(const ComputedStyle* oldStyle, const ComputedStyle& newS tyle); |
| 182 | 182 |
| 183 void notifyListenersCanvasChanged(); | 183 void notifyListenersCanvasChanged(); |
| 184 | 184 |
| 185 bool isSupportedInteractiveCanvasFallback(const Element&); | 185 bool isSupportedInteractiveCanvasFallback(const Element&); |
| 186 std::pair<Element*, String> getControlAndIdIfHitRegionExists(const LayoutPoi nt&); | 186 std::pair<Element*, String> getControlAndIdIfHitRegionExists(const LayoutPoi nt&); |
| 187 | 187 |
| 188 enum CanvasReturnImageFormat { | |
|
Justin Novosad
2016/03/22 15:09:04
This does not need to be in the header. Also, why
| |
| 189 Png = 0, | |
|
Justin Novosad
2016/03/22 15:09:04
enum members should have the enum name as a prefix
| |
| 190 Jpeg = 1, | |
| 191 Webp = 2, | |
| 192 Gif = 3, | |
| 193 Bmp = 4, | |
| 194 Ico = 5, | |
| 195 Tiff = 6, | |
| 196 NumberOfImageFormats | |
|
Justin Novosad
2016/03/22 15:09:04
You should add an "Unknown" value
| |
| 197 }; | |
| 198 | |
| 188 protected: | 199 protected: |
| 189 void didMoveToNewDocument(Document& oldDocument) override; | 200 void didMoveToNewDocument(Document& oldDocument) override; |
| 190 | 201 |
| 191 private: | 202 private: |
| 192 explicit HTMLCanvasElement(Document&); | 203 explicit HTMLCanvasElement(Document&); |
| 193 | 204 |
| 194 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; | 205 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; |
| 195 static ContextFactoryVector& renderingContextFactories(); | 206 static ContextFactoryVector& renderingContextFactories(); |
| 196 static CanvasRenderingContextFactory* getRenderingContextFactory(int); | 207 static CanvasRenderingContextFactory* getRenderingContextFactory(int); |
| 197 | 208 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 mutable bool m_didFailToCreateImageBuffer; | 243 mutable bool m_didFailToCreateImageBuffer; |
| 233 bool m_imageBufferIsClear; | 244 bool m_imageBufferIsClear; |
| 234 OwnPtr<ImageBuffer> m_imageBuffer; | 245 OwnPtr<ImageBuffer> m_imageBuffer; |
| 235 | 246 |
| 236 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). | 247 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). |
| 237 }; | 248 }; |
| 238 | 249 |
| 239 } // namespace blink | 250 } // namespace blink |
| 240 | 251 |
| 241 #endif // HTMLCanvasElement_h | 252 #endif // HTMLCanvasElement_h |
| OLD | NEW |