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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.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: fix bot errors Created 4 years, 9 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 3200 matching lines...) Expand 10 before | Expand all | Expand 10 after
3211 // See also the similar code in EventHandler::hitTestResultAtPoint. 3211 // See also the similar code in EventHandler::hitTestResultAtPoint.
3212 if (!layoutView() || !view() || !view()->didFirstLayout()) 3212 if (!layoutView() || !view() || !view()->didFirstLayout())
3213 return MouseEventWithHitTestResults(event, HitTestResult(request, Layout Point())); 3213 return MouseEventWithHitTestResults(event, HitTestResult(request, Layout Point()));
3214 3214
3215 HitTestResult result(request, documentPoint); 3215 HitTestResult result(request, documentPoint);
3216 layoutView()->hitTest(result); 3216 layoutView()->hitTest(result);
3217 3217
3218 if (!request.readOnly()) 3218 if (!request.readOnly())
3219 updateHoverActiveState(request, result.innerElement()); 3219 updateHoverActiveState(request, result.innerElement());
3220 3220
3221 if (isHTMLCanvasElement(result.innerNode())) {
3222 PlatformMouseEvent eventWithRegion = event;
3223 std::pair<Element*, String> regionInfo = toHTMLCanvasElement(result.inne rNode())->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame());
3224 if (regionInfo.first)
3225 result.setInnerNode(regionInfo.first);
3226 eventWithRegion.setRegion(regionInfo.second);
3227 return MouseEventWithHitTestResults(eventWithRegion, result);
3228 }
3229
3221 return MouseEventWithHitTestResults(event, result); 3230 return MouseEventWithHitTestResults(event, result);
3222 } 3231 }
3223 3232
3224 // DOM Section 1.1.1 3233 // DOM Section 1.1.1
3225 bool Document::childTypeAllowed(NodeType type) const 3234 bool Document::childTypeAllowed(NodeType type) const
3226 { 3235 {
3227 switch (type) { 3236 switch (type) {
3228 case ATTRIBUTE_NODE: 3237 case ATTRIBUTE_NODE:
3229 case CDATA_SECTION_NODE: 3238 case CDATA_SECTION_NODE:
3230 case DOCUMENT_FRAGMENT_NODE: 3239 case DOCUMENT_FRAGMENT_NODE:
(...skipping 2198 matching lines...) Expand 10 before | Expand all | Expand 10 after
5429 if (!std::isfinite(rotationAngle)) 5438 if (!std::isfinite(rotationAngle))
5430 rotationAngle = 0; 5439 rotationAngle = 0;
5431 if (!std::isfinite(force)) 5440 if (!std::isfinite(force))
5432 force = 0; 5441 force = 0;
5433 5442
5434 // FIXME: It's not clear from the documentation at 5443 // FIXME: It's not clear from the documentation at
5435 // http://developer.apple.com/library/safari/#documentation/UserExperience/R eference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html 5444 // http://developer.apple.com/library/safari/#documentation/UserExperience/R eference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
5436 // when this method should throw and nor is it by inspection of iOS behavior . It would be nice to verify any cases where it throws under iOS 5445 // when this method should throw and nor is it by inspection of iOS behavior . It would be nice to verify any cases where it throws under iOS
5437 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781 9 5446 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781 9
5438 LocalFrame* frame = window && window->isLocalDOMWindow() ? toLocalDOMWindow( window)->frame() : this->frame(); 5447 LocalFrame* frame = window && window->isLocalDOMWindow() ? toLocalDOMWindow( window)->frame() : this->frame();
5439 return Touch::create(frame, target, identifier, FloatPoint(screenX, screenY) , FloatPoint(pageX, pageY), FloatSize(radiusX, radiusY), rotationAngle, force); 5448 return Touch::create(frame, target, identifier, FloatPoint(screenX, screenY) , FloatPoint(pageX, pageY), FloatSize(radiusX, radiusY), rotationAngle, force, S tring());
5440 } 5449 }
5441 5450
5442 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref PtrWillBeMember<Touch>>& touches) const 5451 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref PtrWillBeMember<Touch>>& touches) const
5443 { 5452 {
5444 return TouchList::adopt(touches); 5453 return TouchList::adopt(touches);
5445 } 5454 }
5446 5455
5447 DocumentLoader* Document::loader() const 5456 DocumentLoader* Document::loader() const
5448 { 5457 {
5449 if (!m_frame) 5458 if (!m_frame)
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
5996 #ifndef NDEBUG 6005 #ifndef NDEBUG
5997 using namespace blink; 6006 using namespace blink;
5998 void showLiveDocumentInstances() 6007 void showLiveDocumentInstances()
5999 { 6008 {
6000 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 6009 Document::WeakDocumentSet& set = Document::liveDocumentSet();
6001 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6010 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6002 for (Document* document : set) 6011 for (Document* document : set)
6003 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6012 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6004 } 6013 }
6005 #endif 6014 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698