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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 #endif | 130 #endif |
131 } | 131 } |
132 | 132 |
133 void HTMLCanvasElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) | 133 void HTMLCanvasElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) |
134 { | 134 { |
135 if (name == widthAttr || name == heightAttr) | 135 if (name == widthAttr || name == heightAttr) |
136 reset(); | 136 reset(); |
137 HTMLElement::parseAttribute(name, value); | 137 HTMLElement::parseAttribute(name, value); |
138 } | 138 } |
139 | 139 |
140 RenderObject* HTMLCanvasElement::createRenderer(const RenderStyle& style) | 140 LayoutObject* HTMLCanvasElement::createRenderer(const RenderStyle& style) |
141 { | 141 { |
142 LocalFrame* frame = document().frame(); | 142 LocalFrame* frame = document().frame(); |
143 if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript)) | 143 if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript)) |
144 return new RenderHTMLCanvas(this); | 144 return new RenderHTMLCanvas(this); |
145 return HTMLElement::createRenderer(style); | 145 return HTMLElement::createRenderer(style); |
146 } | 146 } |
147 | 147 |
148 void HTMLCanvasElement::didRecalcStyle(StyleRecalcChange) | 148 void HTMLCanvasElement::didRecalcStyle(StyleRecalcChange) |
149 { | 149 { |
150 SkPaint::FilterLevel filterLevel = computedStyle()->imageRendering() == Imag
eRenderingPixelated ? SkPaint::kNone_FilterLevel : SkPaint::kLow_FilterLevel; | 150 SkPaint::FilterLevel filterLevel = computedStyle()->imageRendering() == Imag
eRenderingPixelated ? SkPaint::kNone_FilterLevel : SkPaint::kLow_FilterLevel; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 toCanvasRenderingContext2D(m_context.get())->clearRect(0, 0, width()
, height()); | 352 toCanvasRenderingContext2D(m_context.get())->clearRect(0, 0, width()
, height()); |
353 } | 353 } |
354 return; | 354 return; |
355 } | 355 } |
356 | 356 |
357 setSurfaceSize(newSize); | 357 setSurfaceSize(newSize); |
358 | 358 |
359 if (m_context && m_context->is3d() && oldSize != size()) | 359 if (m_context && m_context->is3d() && oldSize != size()) |
360 toWebGLRenderingContext(m_context.get())->reshape(width(), height()); | 360 toWebGLRenderingContext(m_context.get())->reshape(width(), height()); |
361 | 361 |
362 if (RenderObject* renderer = this->renderer()) { | 362 if (LayoutObject* renderer = this->renderer()) { |
363 if (renderer->isCanvas()) { | 363 if (renderer->isCanvas()) { |
364 if (oldSize != size()) { | 364 if (oldSize != size()) { |
365 toRenderHTMLCanvas(renderer)->canvasSizeChanged(); | 365 toRenderHTMLCanvas(renderer)->canvasSizeChanged(); |
366 if (renderBox() && renderBox()->hasAcceleratedCompositing()) | 366 if (renderBox() && renderBox()->hasAcceleratedCompositing()) |
367 renderBox()->contentChanged(CanvasChanged); | 367 renderBox()->contentChanged(CanvasChanged); |
368 } | 368 } |
369 if (hadImageBuffer) | 369 if (hadImageBuffer) |
370 renderer->setShouldDoFullPaintInvalidation(); | 370 renderer->setShouldDoFullPaintInvalidation(); |
371 } | 371 } |
372 } | 372 } |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 { | 836 { |
837 return !originClean(); | 837 return !originClean(); |
838 } | 838 } |
839 | 839 |
840 FloatSize HTMLCanvasElement::sourceSize() const | 840 FloatSize HTMLCanvasElement::sourceSize() const |
841 { | 841 { |
842 return FloatSize(width(), height()); | 842 return FloatSize(width(), height()); |
843 } | 843 } |
844 | 844 |
845 } | 845 } |
OLD | NEW |