| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) { |
| 170 blink::Platform::current()->histogramEnumeration("Canvas.ContextType
", Context2d, ContextTypeCount); | 170 blink::Platform::current()->histogramEnumeration("Canvas.ContextType
", Context2d, ContextTypeCount); |
| 171 m_context = CanvasRenderingContext2D::create(this, static_cast<Canva
s2DContextAttributes*>(attrs), document().inQuirksMode()); | 171 |
| 172 m_context = CanvasRenderingContext2D::create(this, static_cast<Canva
s2DContextAttributes*>(attrs), document()); |
| 172 setNeedsCompositingUpdate(); | 173 setNeedsCompositingUpdate(); |
| 173 } | 174 } |
| 174 return m_context.get(); | 175 return m_context.get(); |
| 175 } | 176 } |
| 176 | 177 |
| 177 // Accept the the provisional "experimental-webgl" or official "webgl" conte
xt ID. | 178 // Accept the the provisional "experimental-webgl" or official "webgl" conte
xt ID. |
| 178 if (type == "webgl" || type == "experimental-webgl") { | 179 if (type == "webgl" || type == "experimental-webgl") { |
| 179 ContextType contextType = (type == "webgl") ? ContextWebgl : ContextExpe
rimentalWebgl; | 180 ContextType contextType = (type == "webgl") ? ContextWebgl : ContextExpe
rimentalWebgl; |
| 180 if (!m_context) { | 181 if (!m_context) { |
| 181 blink::Platform::current()->histogramEnumeration("Canvas.ContextType
", contextType, ContextTypeCount); | 182 blink::Platform::current()->histogramEnumeration("Canvas.ContextType
", contextType, ContextTypeCount); |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 { | 750 { |
| 750 return !originClean(); | 751 return !originClean(); |
| 751 } | 752 } |
| 752 | 753 |
| 753 FloatSize HTMLCanvasElement::sourceSize() const | 754 FloatSize HTMLCanvasElement::sourceSize() const |
| 754 { | 755 { |
| 755 return FloatSize(width(), height()); | 756 return FloatSize(width(), height()); |
| 756 } | 757 } |
| 757 | 758 |
| 758 } | 759 } |
| OLD | NEW |