| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 | 28 |
| 29 #include "core/html/canvas/Canvas2DContextAttributes.h" | 29 #include "core/html/canvas/Canvas2DContextAttributes.h" |
| 30 | 30 |
| 31 #include "wtf/text/WTFString.h" | 31 #include "wtf/text/WTFString.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 Canvas2DContextAttributes::Canvas2DContextAttributes() | 35 Canvas2DContextAttributes::Canvas2DContextAttributes() |
| 36 : m_alpha(true) | 36 : m_storage(PersistentStorage) |
| 37 , m_storage(PersistentStorage) | |
| 38 { | 37 { |
| 39 } | 38 } |
| 40 | 39 |
| 41 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(Canvas2DContextAttributes); | 40 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(Canvas2DContextAttributes); |
| 42 | 41 |
| 43 PassRefPtr<Canvas2DContextAttributes> Canvas2DContextAttributes::create() | 42 PassRefPtr<Canvas2DContextAttributes> Canvas2DContextAttributes::create() |
| 44 { | 43 { |
| 45 return adoptRef(new Canvas2DContextAttributes()); | 44 return adoptRef(new Canvas2DContextAttributes()); |
| 46 } | 45 } |
| 47 | 46 |
| 48 bool Canvas2DContextAttributes::alpha() const | |
| 49 { | |
| 50 return m_alpha; | |
| 51 } | |
| 52 | |
| 53 void Canvas2DContextAttributes::setAlpha(bool alpha) | |
| 54 { | |
| 55 m_alpha = alpha; | |
| 56 } | |
| 57 | |
| 58 String Canvas2DContextAttributes::storage() const | 47 String Canvas2DContextAttributes::storage() const |
| 59 { | 48 { |
| 60 return m_storage == PersistentStorage ? "persistent" : "discardable"; | 49 return m_storage == PersistentStorage ? "persistent" : "discardable"; |
| 61 } | 50 } |
| 62 | 51 |
| 63 void Canvas2DContextAttributes::setStorage(const String& storage) | 52 void Canvas2DContextAttributes::setStorage(const String& storage) |
| 64 { | 53 { |
| 65 if (storage == "persistent") | 54 if (storage == "persistent") |
| 66 m_storage = PersistentStorage; | 55 m_storage = PersistentStorage; |
| 67 else if (storage == "discardable") | 56 else if (storage == "discardable") |
| 68 m_storage = DiscardableStorage; | 57 m_storage = DiscardableStorage; |
| 69 } | 58 } |
| 70 | 59 |
| 71 Canvas2DContextStorage Canvas2DContextAttributes::parsedStorage() const | 60 Canvas2DContextStorage Canvas2DContextAttributes::parsedStorage() const |
| 72 { | 61 { |
| 73 return m_storage; | 62 return m_storage; |
| 74 } | 63 } |
| 75 | 64 |
| 76 } // namespace blink | 65 } // namespace blink |
| OLD | NEW |