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

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

Issue 1654653002: Canvas2d: Implement rerouting event by hit region's control. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 15 matching lines...) Expand all
26 */ 26 */
27 27
28 #include "core/html/HTMLCanvasElement.h" 28 #include "core/html/HTMLCanvasElement.h"
29 29
30 #include "bindings/core/v8/ExceptionMessages.h" 30 #include "bindings/core/v8/ExceptionMessages.h"
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/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/dom/ExceptionCode.h" 35 #include "core/dom/ExceptionCode.h"
36 #include "core/events/Event.h"
37 #include "core/events/EventDispatcher.h"
36 #include "core/fileapi/File.h" 38 #include "core/fileapi/File.h"
37 #include "core/frame/ImageBitmap.h" 39 #include "core/frame/ImageBitmap.h"
38 #include "core/frame/LocalFrame.h" 40 #include "core/frame/LocalFrame.h"
39 #include "core/frame/Settings.h" 41 #include "core/frame/Settings.h"
40 #include "core/html/ImageData.h" 42 #include "core/html/ImageData.h"
41 #include "core/html/canvas/CanvasAsyncBlobCreator.h" 43 #include "core/html/canvas/CanvasAsyncBlobCreator.h"
42 #include "core/html/canvas/CanvasContextCreationAttributes.h" 44 #include "core/html/canvas/CanvasContextCreationAttributes.h"
43 #include "core/html/canvas/CanvasFontCache.h" 45 #include "core/html/canvas/CanvasFontCache.h"
44 #include "core/html/canvas/CanvasRenderingContext.h" 46 #include "core/html/canvas/CanvasRenderingContext.h"
45 #include "core/html/canvas/CanvasRenderingContextFactory.h" 47 #include "core/html/canvas/CanvasRenderingContextFactory.h"
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 return ScriptPromise(); 1013 return ScriptPromise();
1012 } 1014 }
1013 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr); 1015 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr);
1014 } 1016 }
1015 1017
1016 bool HTMLCanvasElement::isOpaque() const 1018 bool HTMLCanvasElement::isOpaque() const
1017 { 1019 {
1018 return m_context && !m_context->hasAlpha(); 1020 return m_context && !m_context->hasAlpha();
1019 } 1021 }
1020 1022
1023 bool HTMLCanvasElement::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> even t)
philipj_slow 2016/02/01 04:05:19 Will this happen for both UA-created and script-cr
zino 2016/02/05 06:59:48 In the new patch set, I filtered script-created ev
1024 {
1025 Node* target = nullptr;
1026 if (m_context && m_context->is2d() && m_context->hitRegionsCount() > 0)
1027 target = m_context->getControlAndUpdateEvent(*event);
philipj_slow 2016/02/01 04:05:19 Might it be more clear to just return the target h
zino 2016/02/05 06:59:48 I agree with you but performance is also important
philipj_slow 2016/02/05 07:30:06 Ack, std::pair looks like a nice fit.
1028 if (!target)
1029 target = this;
philipj_slow 2016/02/01 04:05:19 Shouldn't this fall back to the parent class's dis
zino 2016/02/05 06:59:48 Sure! Thank you. Done.
1030 return EventDispatcher::dispatchEvent(*target, event->createMediator());
1031 }
1032
1021 } // namespace blink 1033 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698