Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 2584643002: Revamp OffscreenCanvas commit flow (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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/FrameView.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"
58 #include "core/layout/api/LayoutViewItem.h"
59 #include "core/layout/compositing/PaintLayerCompositor.h"
57 #include "core/paint/PaintLayer.h" 60 #include "core/paint/PaintLayer.h"
58 #include "core/paint/PaintTiming.h" 61 #include "core/paint/PaintTiming.h"
59 #include "platform/Histogram.h" 62 #include "platform/Histogram.h"
60 #include "platform/RuntimeEnabledFeatures.h" 63 #include "platform/RuntimeEnabledFeatures.h"
61 #include "platform/graphics/Canvas2DImageBufferSurface.h" 64 #include "platform/graphics/Canvas2DImageBufferSurface.h"
62 #include "platform/graphics/CanvasMetrics.h" 65 #include "platform/graphics/CanvasMetrics.h"
63 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" 66 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
64 #include "platform/graphics/ImageBuffer.h" 67 #include "platform/graphics/ImageBuffer.h"
65 #include "platform/graphics/RecordingImageBufferSurface.h" 68 #include "platform/graphics/RecordingImageBufferSurface.h"
66 #include "platform/graphics/StaticBitmapImage.h" 69 #include "platform/graphics/StaticBitmapImage.h"
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 return m_context->getControlAndIdIfHitRegionExists(location); 1393 return m_context->getControlAndIdIfHitRegionExists(location);
1391 return HitTestCanvasResult::create(String(), nullptr); 1394 return HitTestCanvasResult::create(String(), nullptr);
1392 } 1395 }
1393 1396
1394 String HTMLCanvasElement::getIdFromControl(const Element* element) { 1397 String HTMLCanvasElement::getIdFromControl(const Element* element) {
1395 if (m_context) 1398 if (m_context)
1396 return m_context->getIdFromControl(element); 1399 return m_context->getIdFromControl(element);
1397 return String(); 1400 return String();
1398 } 1401 }
1399 1402
1400 bool HTMLCanvasElement::createSurfaceLayer() { 1403 void HTMLCanvasElement::createLayer() {
1401 DCHECK(!m_surfaceLayerBridge); 1404 DCHECK(!m_surfaceLayerBridge);
1402 mojom::blink::OffscreenCanvasSurfacePtr service; 1405 mojom::blink::OffscreenCanvasSurfacePtr service;
1403 Platform::current()->interfaceProvider()->getInterface( 1406 Platform::current()->interfaceProvider()->getInterface(
1404 mojo::GetProxy(&service)); 1407 mojo::GetProxy(&service));
1405 m_surfaceLayerBridge = 1408 m_surfaceLayerBridge =
1406 WTF::wrapUnique(new CanvasSurfaceLayerBridge(std::move(service))); 1409 WTF::wrapUnique(new CanvasSurfaceLayerBridge(std::move(service), this));
1407 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), 1410 // Creates a placeholder layer first before Surface is created.
1408 this->height()); 1411 m_surfaceLayerBridge->createSolidColorLayer();
1412 }
1413
1414 void HTMLCanvasElement::OnWebLayerReplaced() {
1415 setNeedsCompositingUpdate();
1409 } 1416 }
1410 1417
1411 } // namespace blink 1418 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698