 Chromium Code Reviews
 Chromium Code Reviews Issue 1654653002:
  Canvas2d: Implement rerouting event by hit region's control.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1654653002:
  Canvas2d: Implement rerouting event by hit region's control.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp | 
| diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp | 
| index 6fa3c4bcab02e1a7227a1e76db7dd89befcd5435..740ceffcd90f20cdb1ae5831561ac22ea4570a5d 100644 | 
| --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp | 
| +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp | 
| @@ -33,6 +33,8 @@ | 
| #include "core/HTMLNames.h" | 
| #include "core/dom/Document.h" | 
| #include "core/dom/ExceptionCode.h" | 
| +#include "core/events/Event.h" | 
| +#include "core/events/EventDispatcher.h" | 
| #include "core/fileapi/File.h" | 
| #include "core/frame/ImageBitmap.h" | 
| #include "core/frame/LocalFrame.h" | 
| @@ -1018,4 +1020,14 @@ bool HTMLCanvasElement::isOpaque() const | 
| return m_context && !m_context->hasAlpha(); | 
| } | 
| +bool HTMLCanvasElement::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event) | 
| 
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
 | 
| +{ | 
| + Node* target = nullptr; | 
| + if (m_context && m_context->is2d() && m_context->hitRegionsCount() > 0) | 
| + 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.
 | 
| + if (!target) | 
| + 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.
 | 
| + return EventDispatcher::dispatchEvent(*target, event->createMediator()); | 
| +} | 
| + | 
| } // namespace blink |