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 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 bool antialiasClips = false; | |
| 173 if (document().settings() && document().settings()->antialiasedClips 2dCanvasEnabled()) | |
| 174 antialiasClips = true; | |
| 175 | |
| 176 m_context = CanvasRenderingContext2D::create(this, static_cast<Canva s2DContextAttributes*>(attrs), document().inQuirksMode(), antialiasClips); | |
|
Justin Novosad
2014/10/14 14:46:43
Me wonders if we should just pass 'this' or 'docum
robertphillips
2014/10/16 13:24:18
Done - passed in document.
| |
| 172 setNeedsCompositingUpdate(); | 177 setNeedsCompositingUpdate(); |
| 173 } | 178 } |
| 174 return m_context.get(); | 179 return m_context.get(); |
| 175 } | 180 } |
| 176 | 181 |
| 177 // Accept the the provisional "experimental-webgl" or official "webgl" conte xt ID. | 182 // Accept the the provisional "experimental-webgl" or official "webgl" conte xt ID. |
| 178 if (type == "webgl" || type == "experimental-webgl") { | 183 if (type == "webgl" || type == "experimental-webgl") { |
| 179 ContextType contextType = (type == "webgl") ? ContextWebgl : ContextExpe rimentalWebgl; | 184 ContextType contextType = (type == "webgl") ? ContextWebgl : ContextExpe rimentalWebgl; |
| 180 if (!m_context) { | 185 if (!m_context) { |
| 181 blink::Platform::current()->histogramEnumeration("Canvas.ContextType ", contextType, ContextTypeCount); | 186 blink::Platform::current()->histogramEnumeration("Canvas.ContextType ", contextType, ContextTypeCount); |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 749 { | 754 { |
| 750 return !originClean(); | 755 return !originClean(); |
| 751 } | 756 } |
| 752 | 757 |
| 753 FloatSize HTMLCanvasElement::sourceSize() const | 758 FloatSize HTMLCanvasElement::sourceSize() const |
| 754 { | 759 { |
| 755 return FloatSize(width(), height()); | 760 return FloatSize(width(), height()); |
| 756 } | 761 } |
| 757 | 762 |
| 758 } | 763 } |
| OLD | NEW |