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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 if (name == widthAttr || name == heightAttr) | 104 if (name == widthAttr || name == heightAttr) |
105 reset(); | 105 reset(); |
106 HTMLElement::parseAttribute(name, value); | 106 HTMLElement::parseAttribute(name, value); |
107 } | 107 } |
108 | 108 |
109 RenderObject* HTMLCanvasElement::createRenderer(RenderStyle* style) | 109 RenderObject* HTMLCanvasElement::createRenderer(RenderStyle* style) |
110 { | 110 { |
111 Frame* frame = document()->frame(); | 111 Frame* frame = document()->frame(); |
112 if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript)) { | 112 if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript)) { |
113 m_rendererIsCanvas = true; | 113 m_rendererIsCanvas = true; |
114 return new (document()->renderArena()) RenderHTMLCanvas(this); | 114 return new RenderHTMLCanvas(this); |
115 } | 115 } |
116 | 116 |
117 m_rendererIsCanvas = false; | 117 m_rendererIsCanvas = false; |
118 return HTMLElement::createRenderer(style); | 118 return HTMLElement::createRenderer(style); |
119 } | 119 } |
120 | 120 |
121 void HTMLCanvasElement::attach(const AttachContext& context) | 121 void HTMLCanvasElement::attach(const AttachContext& context) |
122 { | 122 { |
123 setIsInCanvasSubtree(true); | 123 setIsInCanvasSubtree(true); |
124 HTMLElement::attach(context); | 124 HTMLElement::attach(context); |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 FloatSize unscaledSize = size(); | 559 FloatSize unscaledSize = size(); |
560 FloatSize deviceSize = convertLogicalToDevice(unscaledSize); | 560 FloatSize deviceSize = convertLogicalToDevice(unscaledSize); |
561 IntSize size(deviceSize.width(), deviceSize.height()); | 561 IntSize size(deviceSize.width(), deviceSize.height()); |
562 AffineTransform transform; | 562 AffineTransform transform; |
563 if (size.width() && size.height()) | 563 if (size.width() && size.height()) |
564 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig
ht() / unscaledSize.height()); | 564 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig
ht() / unscaledSize.height()); |
565 return m_imageBuffer->baseTransform() * transform; | 565 return m_imageBuffer->baseTransform() * transform; |
566 } | 566 } |
567 | 567 |
568 } | 568 } |
OLD | NEW |