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

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

Issue 2687623002: DevTools: Support breakpoints on canvas context creation (Closed)
Patch Set: Created 3 years, 10 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "core/html/HTMLCanvasElement.h" 28 #include "core/html/HTMLCanvasElement.h"
29 29
30 #include <math.h>
31 #include <v8.h>
32 #include <memory>
30 #include "bindings/core/v8/ExceptionMessages.h" 33 #include "bindings/core/v8/ExceptionMessages.h"
31 #include "bindings/core/v8/ExceptionState.h" 34 #include "bindings/core/v8/ExceptionState.h"
32 #include "bindings/core/v8/ScriptController.h" 35 #include "bindings/core/v8/ScriptController.h"
33 #include "core/HTMLNames.h" 36 #include "core/HTMLNames.h"
34 #include "core/InputTypeNames.h" 37 #include "core/InputTypeNames.h"
35 #include "core/dom/Document.h" 38 #include "core/dom/Document.h"
36 #include "core/dom/Element.h" 39 #include "core/dom/Element.h"
37 #include "core/dom/ElementTraversal.h" 40 #include "core/dom/ElementTraversal.h"
38 #include "core/dom/ExceptionCode.h" 41 #include "core/dom/ExceptionCode.h"
39 #include "core/dom/TaskRunnerHelper.h" 42 #include "core/dom/TaskRunnerHelper.h"
40 #include "core/fileapi/File.h" 43 #include "core/fileapi/File.h"
41 #include "core/frame/FrameHost.h" 44 #include "core/frame/FrameHost.h"
42 #include "core/frame/ImageBitmap.h" 45 #include "core/frame/ImageBitmap.h"
43 #include "core/frame/LocalFrame.h" 46 #include "core/frame/LocalFrame.h"
44 #include "core/frame/Settings.h" 47 #include "core/frame/Settings.h"
45 #include "core/frame/UseCounter.h" 48 #include "core/frame/UseCounter.h"
46 #include "core/html/HTMLImageElement.h" 49 #include "core/html/HTMLImageElement.h"
47 #include "core/html/HTMLInputElement.h" 50 #include "core/html/HTMLInputElement.h"
48 #include "core/html/HTMLSelectElement.h" 51 #include "core/html/HTMLSelectElement.h"
49 #include "core/html/ImageData.h" 52 #include "core/html/ImageData.h"
50 #include "core/html/canvas/CanvasAsyncBlobCreator.h" 53 #include "core/html/canvas/CanvasAsyncBlobCreator.h"
51 #include "core/html/canvas/CanvasContextCreationAttributes.h" 54 #include "core/html/canvas/CanvasContextCreationAttributes.h"
52 #include "core/html/canvas/CanvasFontCache.h" 55 #include "core/html/canvas/CanvasFontCache.h"
53 #include "core/html/canvas/CanvasRenderingContext.h" 56 #include "core/html/canvas/CanvasRenderingContext.h"
54 #include "core/html/canvas/CanvasRenderingContextFactory.h" 57 #include "core/html/canvas/CanvasRenderingContextFactory.h"
55 #include "core/imagebitmap/ImageBitmapOptions.h" 58 #include "core/imagebitmap/ImageBitmapOptions.h"
59 #include "core/inspector/InspectorInstrumentation.h"
56 #include "core/layout/HitTestCanvasResult.h" 60 #include "core/layout/HitTestCanvasResult.h"
57 #include "core/layout/LayoutHTMLCanvas.h" 61 #include "core/layout/LayoutHTMLCanvas.h"
58 #include "core/layout/api/LayoutViewItem.h" 62 #include "core/layout/api/LayoutViewItem.h"
59 #include "core/layout/compositing/PaintLayerCompositor.h" 63 #include "core/layout/compositing/PaintLayerCompositor.h"
60 #include "core/page/ChromeClient.h" 64 #include "core/page/ChromeClient.h"
61 #include "core/paint/PaintLayer.h" 65 #include "core/paint/PaintLayer.h"
62 #include "core/paint/PaintTiming.h" 66 #include "core/paint/PaintTiming.h"
63 #include "platform/Histogram.h" 67 #include "platform/Histogram.h"
64 #include "platform/RuntimeEnabledFeatures.h" 68 #include "platform/RuntimeEnabledFeatures.h"
65 #include "platform/graphics/Canvas2DImageBufferSurface.h" 69 #include "platform/graphics/Canvas2DImageBufferSurface.h"
66 #include "platform/graphics/CanvasMetrics.h" 70 #include "platform/graphics/CanvasMetrics.h"
67 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" 71 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
68 #include "platform/graphics/ImageBuffer.h" 72 #include "platform/graphics/ImageBuffer.h"
69 #include "platform/graphics/RecordingImageBufferSurface.h" 73 #include "platform/graphics/RecordingImageBufferSurface.h"
70 #include "platform/graphics/StaticBitmapImage.h" 74 #include "platform/graphics/StaticBitmapImage.h"
71 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 75 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
72 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" 76 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h"
73 #include "platform/graphics/paint/PaintCanvas.h" 77 #include "platform/graphics/paint/PaintCanvas.h"
74 #include "platform/image-encoders/ImageEncoderUtils.h" 78 #include "platform/image-encoders/ImageEncoderUtils.h"
75 #include "platform/transforms/AffineTransform.h" 79 #include "platform/transforms/AffineTransform.h"
76 #include "public/platform/Platform.h" 80 #include "public/platform/Platform.h"
77 #include "public/platform/WebTraceLocation.h" 81 #include "public/platform/WebTraceLocation.h"
78 #include "wtf/CheckedNumeric.h" 82 #include "wtf/CheckedNumeric.h"
79 #include "wtf/PtrUtil.h" 83 #include "wtf/PtrUtil.h"
80 #include <math.h>
81 #include <memory>
82 #include <v8.h>
83 84
84 namespace blink { 85 namespace blink {
85 86
86 using namespace HTMLNames; 87 using namespace HTMLNames;
87 88
88 namespace { 89 namespace {
89 90
90 // These values come from the WhatWG spec. 91 // These values come from the WhatWG spec.
91 const int DefaultWidth = 300; 92 const int DefaultWidth = 300;
92 const int DefaultHeight = 150; 93 const int DefaultHeight = 150;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 265
265 factory->onError(this, 266 factory->onError(this,
266 "Canvas has an existing context of a different type"); 267 "Canvas has an existing context of a different type");
267 return nullptr; 268 return nullptr;
268 } 269 }
269 270
270 m_context = factory->create(this, attributes, document()); 271 m_context = factory->create(this, attributes, document());
271 if (!m_context) 272 if (!m_context)
272 return nullptr; 273 return nullptr;
273 274
275 InspectorInstrumentation::didCreateCanvasContext(&document());
Justin Novosad 2017/02/09 20:23:03 You need to do the same thing in OffscreenCanvas::
276
274 if (m_context->is3d()) { 277 if (m_context->is3d()) {
275 updateExternallyAllocatedMemory(); 278 updateExternallyAllocatedMemory();
276 } 279 }
277 280
278 LayoutObject* layoutObject = this->layoutObject(); 281 LayoutObject* layoutObject = this->layoutObject();
279 if (layoutObject && m_context->is2d() && 282 if (layoutObject && m_context->is2d() &&
280 !m_context->creationAttributes().alpha()) { 283 !m_context->creationAttributes().alpha()) {
281 // In the alpha false case, canvas is initially opaque even though there is 284 // In the alpha false case, canvas is initially opaque even though there is
282 // no ImageBuffer, so we need to trigger an invalidation. 285 // no ImageBuffer, so we need to trigger an invalidation.
283 didDraw(FloatRect(0, 0, size().width(), size().height())); 286 didDraw(FloatRect(0, 0, size().width(), size().height()));
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 // Creates a placeholder layer first before Surface is created. 1444 // Creates a placeholder layer first before Surface is created.
1442 m_surfaceLayerBridge->createSolidColorLayer(); 1445 m_surfaceLayerBridge->createSolidColorLayer();
1443 } 1446 }
1444 } 1447 }
1445 1448
1446 void HTMLCanvasElement::OnWebLayerReplaced() { 1449 void HTMLCanvasElement::OnWebLayerReplaced() {
1447 setNeedsCompositingUpdate(); 1450 setNeedsCompositingUpdate();
1448 } 1451 }
1449 1452
1450 } // namespace blink 1453 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698