Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 } | 146 } |
| 147 | 147 |
| 148 CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, Canvas ContextAttributes* attrs) | 148 CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, Canvas ContextAttributes* attrs) |
| 149 { | 149 { |
| 150 // A Canvas can either be "2D" or "webgl" but never both. If you request a 2 D canvas and the existing | 150 // A Canvas can either be "2D" or "webgl" but never both. If you request a 2 D canvas and the existing |
| 151 // context is already 2D, just return that. If the existing context is WebGL , then destroy it | 151 // context is already 2D, just return that. If the existing context is WebGL , then destroy it |
| 152 // before creating a new 2D context. Vice versa when requesting a WebGL canv as. Requesting a | 152 // before creating a new 2D context. Vice versa when requesting a WebGL canv as. Requesting a |
| 153 // context with any other type string will destroy any existing context. | 153 // context with any other type string will destroy any existing context. |
| 154 enum ContextType { | 154 enum ContextType { |
| 155 Context2d, | 155 Context2d, |
| 156 ContextWebkit3d, | 156 // Retain the enum values 'as is' as these are used by the histograms. |
| 157 ContextExperimentalWebgl, | 157 ContextExperimentalWebgl = 2, |
|
rune
2014/08/22 12:15:50
I think it would be safer to explicitly assign a v
rune
2014/08/22 12:15:50
I think it would be safer to explicitly assign a v
| |
| 158 ContextWebgl, | 158 ContextWebgl, |
| 159 // Only add new items to the end and keep the order of existing items. | 159 // Only add new items to the end and keep the order of existing items. |
|
rune
2014/08/22 12:15:50
The comment in UseCounter for Feature looks cleare
| |
| 160 ContextTypeCount, | 160 ContextTypeCount, |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 // FIXME - The code depends on the context not going away once created, to p revent JS from | 163 // FIXME - The code depends on the context not going away once created, to p revent JS from |
| 164 // seeing a dangling pointer. So for now we will disallow the context from b eing changed | 164 // seeing a dangling pointer. So for now we will disallow the context from b eing changed |
| 165 // once it is created. | 165 // once it is created. |
| 166 if (type == "2d") { | 166 if (type == "2d") { |
| 167 if (m_context && !m_context->is2d()) | 167 if (m_context && !m_context->is2d()) |
| 168 return 0; | 168 return 0; |
| 169 if (!m_context) { | 169 if (!m_context) { |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 740 { | 740 { |
| 741 return !originClean(); | 741 return !originClean(); |
| 742 } | 742 } |
| 743 | 743 |
| 744 FloatSize HTMLCanvasElement::sourceSize() const | 744 FloatSize HTMLCanvasElement::sourceSize() const |
| 745 { | 745 { |
| 746 return FloatSize(width(), height()); | 746 return FloatSize(width(), height()); |
| 747 } | 747 } |
| 748 | 748 |
| 749 } | 749 } |
| OLD | NEW |