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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 DECLARE_NODE_FACTORY(HTMLCanvasElement); | 82 DECLARE_NODE_FACTORY(HTMLCanvasElement); |
83 ~HTMLCanvasElement() override; | 83 ~HTMLCanvasElement() override; |
84 | 84 |
85 // Attributes and functions exposed to script | 85 // Attributes and functions exposed to script |
86 int width() const { return size().width(); } | 86 int width() const { return size().width(); } |
87 int height() const { return size().height(); } | 87 int height() const { return size().height(); } |
88 | 88 |
89 const IntSize& size() const { return m_size; } | 89 const IntSize& size() const { return m_size; } |
90 | 90 |
91 void setWidth(int); | 91 void setWidth(int, ExceptionState&); |
92 void setHeight(int); | 92 void setHeight(int, ExceptionState&); |
93 | 93 |
94 void setSize(const IntSize& newSize) | 94 void setSize(const IntSize& newSize); |
95 { | |
96 if (newSize == size()) | |
97 return; | |
98 m_ignoreReset = true; | |
99 setWidth(newSize.width()); | |
100 setHeight(newSize.height()); | |
101 m_ignoreReset = false; | |
102 reset(); | |
103 } | |
104 | 95 |
105 // Called by Document::getCSSCanvasContext as well as above getContext(). | 96 // Called by Document::getCSSCanvasContext as well as above getContext(). |
106 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva
sContextCreationAttributes&); | 97 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva
sContextCreationAttributes&); |
107 | 98 |
108 bool isPaintable() const; | 99 bool isPaintable() const; |
109 | 100 |
110 enum EncodeReason { | 101 enum EncodeReason { |
111 EncodeReasonToDataURL = 0, | 102 EncodeReasonToDataURL = 0, |
112 EncodeReasonToBlobCallback = 1, | 103 EncodeReasonToBlobCallback = 1, |
113 NumberOfEncodeReasons | 104 NumberOfEncodeReasons |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // Used for OffscreenCanvas that controls this HTML canvas element | 260 // Used for OffscreenCanvas that controls this HTML canvas element |
270 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; | 261 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; |
271 | 262 |
272 int m_numFramesSinceLastRenderingModeSwitch; | 263 int m_numFramesSinceLastRenderingModeSwitch; |
273 bool m_pendingRenderingModeSwitch; | 264 bool m_pendingRenderingModeSwitch; |
274 }; | 265 }; |
275 | 266 |
276 } // namespace blink | 267 } // namespace blink |
277 | 268 |
278 #endif // HTMLCanvasElement_h | 269 #endif // HTMLCanvasElement_h |
OLD | NEW |