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 20 matching lines...) Expand all Loading... | |
| 31 #include "bindings/core/v8/ExceptionState.h" | 31 #include "bindings/core/v8/ExceptionState.h" |
| 32 #include "bindings/core/v8/ScriptController.h" | 32 #include "bindings/core/v8/ScriptController.h" |
| 33 #include "core/HTMLNames.h" | 33 #include "core/HTMLNames.h" |
| 34 #include "core/InputTypeNames.h" | 34 #include "core/InputTypeNames.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/dom/Element.h" | 36 #include "core/dom/Element.h" |
| 37 #include "core/dom/ElementTraversal.h" | 37 #include "core/dom/ElementTraversal.h" |
| 38 #include "core/dom/ExceptionCode.h" | 38 #include "core/dom/ExceptionCode.h" |
| 39 #include "core/dom/TaskRunnerHelper.h" | 39 #include "core/dom/TaskRunnerHelper.h" |
| 40 #include "core/fileapi/File.h" | 40 #include "core/fileapi/File.h" |
| 41 #include "core/frame/FrameHost.h" | |
| 41 #include "core/frame/ImageBitmap.h" | 42 #include "core/frame/ImageBitmap.h" |
| 42 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
| 43 #include "core/frame/Settings.h" | 44 #include "core/frame/Settings.h" |
| 44 #include "core/frame/UseCounter.h" | 45 #include "core/frame/UseCounter.h" |
| 45 #include "core/html/HTMLImageElement.h" | 46 #include "core/html/HTMLImageElement.h" |
| 46 #include "core/html/HTMLInputElement.h" | 47 #include "core/html/HTMLInputElement.h" |
| 47 #include "core/html/HTMLSelectElement.h" | 48 #include "core/html/HTMLSelectElement.h" |
| 48 #include "core/html/ImageData.h" | 49 #include "core/html/ImageData.h" |
| 49 #include "core/html/canvas/CanvasAsyncBlobCreator.h" | 50 #include "core/html/canvas/CanvasAsyncBlobCreator.h" |
| 50 #include "core/html/canvas/CanvasContextCreationAttributes.h" | 51 #include "core/html/canvas/CanvasContextCreationAttributes.h" |
| 51 #include "core/html/canvas/CanvasFontCache.h" | 52 #include "core/html/canvas/CanvasFontCache.h" |
| 52 #include "core/html/canvas/CanvasRenderingContext.h" | 53 #include "core/html/canvas/CanvasRenderingContext.h" |
| 53 #include "core/html/canvas/CanvasRenderingContextFactory.h" | 54 #include "core/html/canvas/CanvasRenderingContextFactory.h" |
| 54 #include "core/imagebitmap/ImageBitmapOptions.h" | 55 #include "core/imagebitmap/ImageBitmapOptions.h" |
| 55 #include "core/layout/HitTestCanvasResult.h" | 56 #include "core/layout/HitTestCanvasResult.h" |
| 56 #include "core/layout/LayoutHTMLCanvas.h" | 57 #include "core/layout/LayoutHTMLCanvas.h" |
| 57 #include "core/layout/api/LayoutViewItem.h" | 58 #include "core/layout/api/LayoutViewItem.h" |
| 58 #include "core/layout/compositing/PaintLayerCompositor.h" | 59 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 60 #include "core/page/ChromeClient.h" | |
| 59 #include "core/paint/PaintLayer.h" | 61 #include "core/paint/PaintLayer.h" |
| 60 #include "core/paint/PaintTiming.h" | 62 #include "core/paint/PaintTiming.h" |
| 61 #include "platform/Histogram.h" | 63 #include "platform/Histogram.h" |
| 62 #include "platform/RuntimeEnabledFeatures.h" | 64 #include "platform/RuntimeEnabledFeatures.h" |
| 63 #include "platform/graphics/Canvas2DImageBufferSurface.h" | 65 #include "platform/graphics/Canvas2DImageBufferSurface.h" |
| 64 #include "platform/graphics/CanvasMetrics.h" | 66 #include "platform/graphics/CanvasMetrics.h" |
| 65 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | 67 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
| 66 #include "platform/graphics/ImageBuffer.h" | 68 #include "platform/graphics/ImageBuffer.h" |
| 67 #include "platform/graphics/RecordingImageBufferSurface.h" | 69 #include "platform/graphics/RecordingImageBufferSurface.h" |
| 68 #include "platform/graphics/StaticBitmapImage.h" | 70 #include "platform/graphics/StaticBitmapImage.h" |
| (...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1416 } | 1418 } |
| 1417 | 1419 |
| 1418 String HTMLCanvasElement::getIdFromControl(const Element* element) { | 1420 String HTMLCanvasElement::getIdFromControl(const Element* element) { |
| 1419 if (m_context) | 1421 if (m_context) |
| 1420 return m_context->getIdFromControl(element); | 1422 return m_context->getIdFromControl(element); |
| 1421 return String(); | 1423 return String(); |
| 1422 } | 1424 } |
| 1423 | 1425 |
| 1424 void HTMLCanvasElement::createLayer() { | 1426 void HTMLCanvasElement::createLayer() { |
| 1425 DCHECK(!m_surfaceLayerBridge); | 1427 DCHECK(!m_surfaceLayerBridge); |
| 1426 m_surfaceLayerBridge = WTF::wrapUnique(new CanvasSurfaceLayerBridge(this)); | 1428 LocalFrame* frame = document().frame(); |
| 1429 WebLayerTreeView* layerTreeView = nullptr; | |
| 1430 // TODO(xlai): Ensure OffscreenCanvas commit() is still functional when a | |
| 1431 // frame-less HTML canvas's document is reparenting under another frame. | |
| 1432 // See crbug.com/683172. | |
| 1433 if (frame) { | |
| 1434 layerTreeView = frame->host()->chromeClient().getWebLayerTreeView(); | |
|
dcheng
2017/01/23 21:53:32
Sorry, one more dumb question: why do we call crea
xlai (Olivia)
2017/01/24 20:54:12
You are right, it doesn't make sense to have a lay
| |
| 1435 } | |
| 1436 | |
| 1437 m_surfaceLayerBridge = | |
| 1438 WTF::wrapUnique(new CanvasSurfaceLayerBridge(this, layerTreeView)); | |
| 1427 // Creates a placeholder layer first before Surface is created. | 1439 // Creates a placeholder layer first before Surface is created. |
| 1428 m_surfaceLayerBridge->createSolidColorLayer(); | 1440 m_surfaceLayerBridge->createSolidColorLayer(); |
| 1429 } | 1441 } |
| 1430 | 1442 |
| 1431 void HTMLCanvasElement::OnWebLayerReplaced() { | 1443 void HTMLCanvasElement::OnWebLayerReplaced() { |
| 1432 setNeedsCompositingUpdate(); | 1444 setNeedsCompositingUpdate(); |
| 1433 } | 1445 } |
| 1434 | 1446 |
| 1435 } // namespace blink | 1447 } // namespace blink |
| OLD | NEW |