| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // before creating a new 2D context. Vice versa when requesting a WebGL canv
as. Requesting a | 164 // before creating a new 2D context. Vice versa when requesting a WebGL canv
as. Requesting a |
| 165 // context with any other type string will destroy any existing context. | 165 // context with any other type string will destroy any existing context. |
| 166 | 166 |
| 167 // FIXME - The code depends on the context not going away once created, to p
revent JS from | 167 // FIXME - The code depends on the context not going away once created, to p
revent JS from |
| 168 // seeing a dangling pointer. So for now we will disallow the context from b
eing changed | 168 // seeing a dangling pointer. So for now we will disallow the context from b
eing changed |
| 169 // once it is created. | 169 // once it is created. |
| 170 if (type == "2d") { | 170 if (type == "2d") { |
| 171 if (m_context && !m_context->is2d()) | 171 if (m_context && !m_context->is2d()) |
| 172 return 0; | 172 return 0; |
| 173 if (!m_context) { | 173 if (!m_context) { |
| 174 bool usesDashbardCompatibilityMode = false; | 174 m_context = CanvasRenderingContext2D::create(this, document()->inQui
rksMode()); |
| 175 #if ENABLE(DASHBOARD_SUPPORT) | |
| 176 if (Settings* settings = document()->settings()) | |
| 177 usesDashbardCompatibilityMode = settings->usesDashboardBackwardC
ompatibilityMode(); | |
| 178 #endif | |
| 179 m_context = CanvasRenderingContext2D::create(this, document()->inQui
rksMode(), usesDashbardCompatibilityMode); | |
| 180 #if USE(IOSURFACE_CANVAS_BACKING_STORE) || (ENABLE(ACCELERATED_2D_CANVAS) && USE
(ACCELERATED_COMPOSITING)) | 175 #if USE(IOSURFACE_CANVAS_BACKING_STORE) || (ENABLE(ACCELERATED_2D_CANVAS) && USE
(ACCELERATED_COMPOSITING)) |
| 181 if (m_context) { | 176 if (m_context) { |
| 182 // Need to make sure a RenderLayer and compositing layer get cre
ated for the Canvas | 177 // Need to make sure a RenderLayer and compositing layer get cre
ated for the Canvas |
| 183 setNeedsStyleRecalc(SyntheticStyleChange); | 178 setNeedsStyleRecalc(SyntheticStyleChange); |
| 184 } | 179 } |
| 185 #endif | 180 #endif |
| 186 } | 181 } |
| 187 return m_context.get(); | 182 return m_context.get(); |
| 188 } | 183 } |
| 189 #if ENABLE(WEBGL) | 184 #if ENABLE(WEBGL) |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 HTMLElement::reportMemoryUsage(memoryObjectInfo); | 642 HTMLElement::reportMemoryUsage(memoryObjectInfo); |
| 648 info.addMember(m_observers, "observers"); | 643 info.addMember(m_observers, "observers"); |
| 649 info.addMember(m_context, "context"); | 644 info.addMember(m_context, "context"); |
| 650 info.addMember(m_imageBuffer, "imageBuffer"); | 645 info.addMember(m_imageBuffer, "imageBuffer"); |
| 651 info.addMember(m_contextStateSaver, "contextStateSaver"); | 646 info.addMember(m_contextStateSaver, "contextStateSaver"); |
| 652 info.addMember(m_presentedImage, "presentedImage"); | 647 info.addMember(m_presentedImage, "presentedImage"); |
| 653 info.addMember(m_copiedImage, "copiedImage"); | 648 info.addMember(m_copiedImage, "copiedImage"); |
| 654 } | 649 } |
| 655 | 650 |
| 656 } | 651 } |
| OLD | NEW |