| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * * Redistributions of source code must retain the above copyright | 7 * * 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 * * Redistributions in binary form must reproduce the above | 9 * * Redistributions in binary form must reproduce the above |
| 10 * copyright notice, this list of conditions and the following disclaimer | 10 * copyright notice, this list of conditions and the following disclaimer |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 | 28 |
| 29 #include "Canvas2DContextAttributes.h" | 29 #include "Canvas2DContextAttributes.h" |
| 30 | 30 |
| 31 #include "wtf/text/WTFString.h" |
| 32 |
| 31 namespace WebCore { | 33 namespace WebCore { |
| 32 | 34 |
| 33 Canvas2DContextAttributes::Canvas2DContextAttributes() | 35 Canvas2DContextAttributes::Canvas2DContextAttributes() |
| 34 : m_alpha(true) | 36 : m_alpha(true) |
| 37 , m_storage(PersistentStorage) |
| 35 { | 38 { |
| 36 ScriptWrappable::init(this); | 39 ScriptWrappable::init(this); |
| 37 } | 40 } |
| 38 | 41 |
| 39 Canvas2DContextAttributes::~Canvas2DContextAttributes() | 42 Canvas2DContextAttributes::~Canvas2DContextAttributes() |
| 40 { | 43 { |
| 41 } | 44 } |
| 42 | 45 |
| 43 PassRefPtr<Canvas2DContextAttributes> Canvas2DContextAttributes::create() | 46 PassRefPtr<Canvas2DContextAttributes> Canvas2DContextAttributes::create() |
| 44 { | 47 { |
| 45 return adoptRef(new Canvas2DContextAttributes()); | 48 return adoptRef(new Canvas2DContextAttributes()); |
| 46 } | 49 } |
| 47 | 50 |
| 48 bool Canvas2DContextAttributes::alpha() const | 51 bool Canvas2DContextAttributes::alpha() const |
| 49 { | 52 { |
| 50 return m_alpha; | 53 return m_alpha; |
| 51 } | 54 } |
| 52 | 55 |
| 53 void Canvas2DContextAttributes::setAlpha(bool alpha) | 56 void Canvas2DContextAttributes::setAlpha(bool alpha) |
| 54 { | 57 { |
| 55 m_alpha = alpha; | 58 m_alpha = alpha; |
| 56 } | 59 } |
| 57 | 60 |
| 61 String Canvas2DContextAttributes::storage() const |
| 62 { |
| 63 return m_storage == PersistentStorage ? "persistent" : "discardable"; |
| 64 } |
| 65 |
| 66 void Canvas2DContextAttributes::setStorage(const String& storage) |
| 67 { |
| 68 if (storage == "persistent") |
| 69 m_storage = PersistentStorage; |
| 70 else if (storage == "discardable") |
| 71 m_storage = DiscardableStorage; |
| 72 } |
| 73 |
| 74 Canvas2DContextStorage Canvas2DContextAttributes::parsedStorage() const |
| 75 { |
| 76 return m_storage; |
| 77 } |
| 78 |
| 58 } // namespace WebCore | 79 } // namespace WebCore |
| OLD | NEW |