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, ExceptionState&); | 91 void setWidth(int); |
92 void setHeight(int, ExceptionState&); | 92 void setHeight(int); |
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 } |
95 | 104 |
96 // Called by Document::getCSSCanvasContext as well as above getContext(). | 105 // Called by Document::getCSSCanvasContext as well as above getContext(). |
97 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva
sContextCreationAttributes&); | 106 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva
sContextCreationAttributes&); |
98 | 107 |
99 bool isPaintable() const; | 108 bool isPaintable() const; |
100 | 109 |
101 enum EncodeReason { | 110 enum EncodeReason { |
102 EncodeReasonToDataURL = 0, | 111 EncodeReasonToDataURL = 0, |
103 EncodeReasonToBlobCallback = 1, | 112 EncodeReasonToBlobCallback = 1, |
104 NumberOfEncodeReasons | 113 NumberOfEncodeReasons |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // Used for OffscreenCanvas that controls this HTML canvas element | 269 // Used for OffscreenCanvas that controls this HTML canvas element |
261 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; | 270 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; |
262 | 271 |
263 int m_numFramesSinceLastRenderingModeSwitch; | 272 int m_numFramesSinceLastRenderingModeSwitch; |
264 bool m_pendingRenderingModeSwitch; | 273 bool m_pendingRenderingModeSwitch; |
265 }; | 274 }; |
266 | 275 |
267 } // namespace blink | 276 } // namespace blink |
268 | 277 |
269 #endif // HTMLCanvasElement_h | 278 #endif // HTMLCanvasElement_h |
OLD | NEW |