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

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: 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 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after
3209 // See also the similar code in EventHandler::hitTestResultAtPoint. 3209 // See also the similar code in EventHandler::hitTestResultAtPoint.
3210 if (!layoutView() || !view() || !view()->didFirstLayout()) 3210 if (!layoutView() || !view() || !view()->didFirstLayout())
3211 return MouseEventWithHitTestResults(event, HitTestResult(request, Layout Point())); 3211 return MouseEventWithHitTestResults(event, HitTestResult(request, Layout Point()));
3212 3212
3213 HitTestResult result(request, documentPoint); 3213 HitTestResult result(request, documentPoint);
3214 layoutView()->hitTest(result); 3214 layoutView()->hitTest(result);
3215 3215
3216 if (!request.readOnly()) 3216 if (!request.readOnly())
3217 updateHoverActiveState(request, result.innerElement()); 3217 updateHoverActiveState(request, result.innerElement());
3218 3218
3219 if (isHTMLCanvasElement(result.innerNode())) {
3220 PlatformMouseEvent eventWithRegion = event;
3221 std::pair<Element*, String> regionInfo = toHTMLCanvasElement(result.inne rNode())->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame());
3222 if (regionInfo.first)
3223 result.setInnerNode(regionInfo.first);
3224 eventWithRegion.setRegion(regionInfo.second);
3225 return MouseEventWithHitTestResults(eventWithRegion, result);
3226 }
3227
3219 return MouseEventWithHitTestResults(event, result); 3228 return MouseEventWithHitTestResults(event, result);
3220 } 3229 }
3221 3230
3222 // DOM Section 1.1.1 3231 // DOM Section 1.1.1
3223 bool Document::childTypeAllowed(NodeType type) const 3232 bool Document::childTypeAllowed(NodeType type) const
3224 { 3233 {
3225 switch (type) { 3234 switch (type) {
3226 case ATTRIBUTE_NODE: 3235 case ATTRIBUTE_NODE:
3227 case CDATA_SECTION_NODE: 3236 case CDATA_SECTION_NODE:
3228 case DOCUMENT_FRAGMENT_NODE: 3237 case DOCUMENT_FRAGMENT_NODE:
(...skipping 2192 matching lines...) Expand 10 before | Expand all | Expand 10 after
5421 if (!std::isfinite(rotationAngle)) 5430 if (!std::isfinite(rotationAngle))
5422 rotationAngle = 0; 5431 rotationAngle = 0;
5423 if (!std::isfinite(force)) 5432 if (!std::isfinite(force))
5424 force = 0; 5433 force = 0;
5425 5434
5426 // FIXME: It's not clear from the documentation at 5435 // FIXME: It's not clear from the documentation at
5427 // http://developer.apple.com/library/safari/#documentation/UserExperience/R eference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html 5436 // http://developer.apple.com/library/safari/#documentation/UserExperience/R eference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
5428 // 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 // 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
5429 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781 9 5438 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781 9
5430 LocalFrame* frame = window && window->isLocalDOMWindow() ? toLocalDOMWindow( window)->frame() : this->frame(); 5439 LocalFrame* frame = window && window->isLocalDOMWindow() ? toLocalDOMWindow( window)->frame() : this->frame();
5431 return Touch::create(frame, target, identifier, FloatPoint(screenX, screenY) , FloatPoint(pageX, pageY), FloatSize(radiusX, radiusY), rotationAngle, force); 5440 return Touch::create(frame, target, identifier, FloatPoint(screenX, screenY) , FloatPoint(pageX, pageY), FloatSize(radiusX, radiusY), rotationAngle, force, S tring());
5432 } 5441 }
5433 5442
5434 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref PtrWillBeMember<Touch>>& touches) const 5443 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref PtrWillBeMember<Touch>>& touches) const
5435 { 5444 {
5436 return TouchList::adopt(touches); 5445 return TouchList::adopt(touches);
5437 } 5446 }
5438 5447
5439 DocumentLoader* Document::loader() const 5448 DocumentLoader* Document::loader() const
5440 { 5449 {
5441 if (!m_frame) 5450 if (!m_frame)
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
5988 #ifndef NDEBUG 5997 #ifndef NDEBUG
5989 using namespace blink; 5998 using namespace blink;
5990 void showLiveDocumentInstances() 5999 void showLiveDocumentInstances()
5991 { 6000 {
5992 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 6001 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5993 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6002 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5994 for (Document* document : set) 6003 for (Document* document : set)
5995 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6004 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
5996 } 6005 }
5997 #endif 6006 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698