| 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 27 matching lines...) Expand all Loading... |
| 38 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
| 39 #include "core/frame/Settings.h" | 39 #include "core/frame/Settings.h" |
| 40 #include "core/html/ImageData.h" | 40 #include "core/html/ImageData.h" |
| 41 #include "core/html/canvas/Canvas2DContextAttributes.h" | 41 #include "core/html/canvas/Canvas2DContextAttributes.h" |
| 42 #include "core/html/canvas/CanvasRenderingContext2D.h" | 42 #include "core/html/canvas/CanvasRenderingContext2D.h" |
| 43 #include "core/html/canvas/WebGL2RenderingContext.h" | 43 #include "core/html/canvas/WebGL2RenderingContext.h" |
| 44 #include "core/html/canvas/WebGLContextAttributes.h" | 44 #include "core/html/canvas/WebGLContextAttributes.h" |
| 45 #include "core/html/canvas/WebGLContextEvent.h" | 45 #include "core/html/canvas/WebGLContextEvent.h" |
| 46 #include "core/html/canvas/WebGLRenderingContext.h" | 46 #include "core/html/canvas/WebGLRenderingContext.h" |
| 47 #include "core/layout/Layer.h" | 47 #include "core/layout/Layer.h" |
| 48 #include "core/rendering/RenderHTMLCanvas.h" | 48 #include "core/layout/LayoutHTMLCanvas.h" |
| 49 #include "platform/MIMETypeRegistry.h" | 49 #include "platform/MIMETypeRegistry.h" |
| 50 #include "platform/RuntimeEnabledFeatures.h" | 50 #include "platform/RuntimeEnabledFeatures.h" |
| 51 #include "platform/graphics/BitmapImage.h" | 51 #include "platform/graphics/BitmapImage.h" |
| 52 #include "platform/graphics/Canvas2DImageBufferSurface.h" | 52 #include "platform/graphics/Canvas2DImageBufferSurface.h" |
| 53 #include "platform/graphics/GraphicsContextStateSaver.h" | 53 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 54 #include "platform/graphics/ImageBuffer.h" | 54 #include "platform/graphics/ImageBuffer.h" |
| 55 #include "platform/graphics/RecordingImageBufferSurface.h" | 55 #include "platform/graphics/RecordingImageBufferSurface.h" |
| 56 #include "platform/graphics/StaticBitmapImage.h" | 56 #include "platform/graphics/StaticBitmapImage.h" |
| 57 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 57 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
| 58 #include "platform/graphics/gpu/WebGLImageBufferSurface.h" | 58 #include "platform/graphics/gpu/WebGLImageBufferSurface.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 { | 135 { |
| 136 if (name == widthAttr || name == heightAttr) | 136 if (name == widthAttr || name == heightAttr) |
| 137 reset(); | 137 reset(); |
| 138 HTMLElement::parseAttribute(name, value); | 138 HTMLElement::parseAttribute(name, value); |
| 139 } | 139 } |
| 140 | 140 |
| 141 LayoutObject* HTMLCanvasElement::createRenderer(const LayoutStyle& style) | 141 LayoutObject* HTMLCanvasElement::createRenderer(const LayoutStyle& style) |
| 142 { | 142 { |
| 143 LocalFrame* frame = document().frame(); | 143 LocalFrame* frame = document().frame(); |
| 144 if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript)) | 144 if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript)) |
| 145 return new RenderHTMLCanvas(this); | 145 return new LayoutHTMLCanvas(this); |
| 146 return HTMLElement::createRenderer(style); | 146 return HTMLElement::createRenderer(style); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void HTMLCanvasElement::didRecalcStyle(StyleRecalcChange) | 149 void HTMLCanvasElement::didRecalcStyle(StyleRecalcChange) |
| 150 { | 150 { |
| 151 SkPaint::FilterLevel filterLevel = computedStyle()->imageRendering() == Imag
eRenderingPixelated ? SkPaint::kNone_FilterLevel : SkPaint::kLow_FilterLevel; | 151 SkPaint::FilterLevel filterLevel = computedStyle()->imageRendering() == Imag
eRenderingPixelated ? SkPaint::kNone_FilterLevel : SkPaint::kLow_FilterLevel; |
| 152 if (is3D()) { | 152 if (is3D()) { |
| 153 toWebGLRenderingContext(m_context.get())->setFilterLevel(filterLevel); | 153 toWebGLRenderingContext(m_context.get())->setFilterLevel(filterLevel); |
| 154 setNeedsCompositingUpdate(); | 154 setNeedsCompositingUpdate(); |
| 155 } else if (hasImageBuffer()) { | 155 } else if (hasImageBuffer()) { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 } | 371 } |
| 372 | 372 |
| 373 setSurfaceSize(newSize); | 373 setSurfaceSize(newSize); |
| 374 | 374 |
| 375 if (m_context && m_context->is3d() && oldSize != size()) | 375 if (m_context && m_context->is3d() && oldSize != size()) |
| 376 toWebGLRenderingContext(m_context.get())->reshape(width(), height()); | 376 toWebGLRenderingContext(m_context.get())->reshape(width(), height()); |
| 377 | 377 |
| 378 if (LayoutObject* renderer = this->renderer()) { | 378 if (LayoutObject* renderer = this->renderer()) { |
| 379 if (renderer->isCanvas()) { | 379 if (renderer->isCanvas()) { |
| 380 if (oldSize != size()) { | 380 if (oldSize != size()) { |
| 381 toRenderHTMLCanvas(renderer)->canvasSizeChanged(); | 381 toLayoutHTMLCanvas(renderer)->canvasSizeChanged(); |
| 382 if (renderBox() && renderBox()->hasAcceleratedCompositing()) | 382 if (renderBox() && renderBox()->hasAcceleratedCompositing()) |
| 383 renderBox()->contentChanged(CanvasChanged); | 383 renderBox()->contentChanged(CanvasChanged); |
| 384 } | 384 } |
| 385 if (hadImageBuffer) | 385 if (hadImageBuffer) |
| 386 renderer->setShouldDoFullPaintInvalidation(); | 386 renderer->setShouldDoFullPaintInvalidation(); |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| 390 for (CanvasObserver* canvasObserver : m_observers) | 390 for (CanvasObserver* canvasObserver : m_observers) |
| 391 canvasObserver->canvasResized(this); | 391 canvasObserver->canvasResized(this); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 { | 885 { |
| 886 return FloatSize(width(), height()); | 886 return FloatSize(width(), height()); |
| 887 } | 887 } |
| 888 | 888 |
| 889 bool HTMLCanvasElement::isOpaque() const | 889 bool HTMLCanvasElement::isOpaque() const |
| 890 { | 890 { |
| 891 return m_context && !m_context->hasAlpha(); | 891 return m_context && !m_context->hasAlpha(); |
| 892 } | 892 } |
| 893 | 893 |
| 894 } // blink | 894 } // blink |
| OLD | NEW |