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

Side by Side Diff: Source/core/page/EventHandler.cpp

Issue 23717008: Remove useless null checks from Node::document() call sites (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/page/Chrome.cpp ('k') | Source/core/page/FocusController.cpp » ('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) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
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 3624 matching lines...) Expand 10 before | Expand all | Expand 10 after
3635 // Touch events should not go to text nodes 3635 // Touch events should not go to text nodes
3636 if (node->isTextNode()) 3636 if (node->isTextNode())
3637 node = EventPathWalker::parent(node); 3637 node = EventPathWalker::parent(node);
3638 3638
3639 Document* doc = node->document(); 3639 Document* doc = node->document();
3640 // Record the originating touch document even if it does not have a touch listener. 3640 // Record the originating touch document even if it does not have a touch listener.
3641 if (freshTouchEvents) { 3641 if (freshTouchEvents) {
3642 m_originatingTouchPointDocument = doc; 3642 m_originatingTouchPointDocument = doc;
3643 freshTouchEvents = false; 3643 freshTouchEvents = false;
3644 } 3644 }
3645 if (!doc)
3646 continue;
3647 if (!doc->hasTouchEventHandlers()) 3645 if (!doc->hasTouchEventHandlers())
3648 continue; 3646 continue;
3649 m_originatingTouchPointTargets.set(touchPointTargetKey, node); 3647 m_originatingTouchPointTargets.set(touchPointTargetKey, node);
3650 touchTarget = node; 3648 touchTarget = node;
3651 } else if (pointState == PlatformTouchPoint::TouchReleased || pointState == PlatformTouchPoint::TouchCancelled) { 3649 } else if (pointState == PlatformTouchPoint::TouchReleased || pointState == PlatformTouchPoint::TouchCancelled) {
3652 // We only perform a hittest on release or cancel to unset :active o r :hover state. 3650 // We only perform a hittest on release or cancel to unset :active o r :hover state.
3653 if (touchPointTargetKey == m_originatingTouchPointTargetKey) { 3651 if (touchPointTargetKey == m_originatingTouchPointTargetKey) {
3654 hitTestResultAtPoint(pagePoint, hitType); 3652 hitTestResultAtPoint(pagePoint, hitType);
3655 m_originatingTouchPointTargetKey = 0; 3653 m_originatingTouchPointTargetKey = 0;
3656 } else if (m_originatingTouchPointDocument.get() && m_originatingTou chPointDocument->frame()) { 3654 } else if (m_originatingTouchPointDocument.get() && m_originatingTou chPointDocument->frame()) {
3657 LayoutPoint pagePointInOriginatingDocument = documentPointForWin dowPoint(m_originatingTouchPointDocument->frame(), point.pos()); 3655 LayoutPoint pagePointInOriginatingDocument = documentPointForWin dowPoint(m_originatingTouchPointDocument->frame(), point.pos());
3658 hitTestResultInFrame(m_originatingTouchPointDocument->frame(), p agePointInOriginatingDocument, hitType); 3656 hitTestResultInFrame(m_originatingTouchPointDocument->frame(), p agePointInOriginatingDocument, hitType);
3659 } 3657 }
3660 // The target should be the original target for this touch, so get i t from the hashmap. As it's a release or cancel 3658 // The target should be the original target for this touch, so get i t from the hashmap. As it's a release or cancel
3661 // we also remove it from the map. 3659 // we also remove it from the map.
3662 touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKe y); 3660 touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKe y);
3663 } else 3661 } else
3664 // No hittest is performed on move or stationary, since the target i s not allowed to change anyway. 3662 // No hittest is performed on move or stationary, since the target i s not allowed to change anyway.
3665 touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey ); 3663 touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey );
3666 3664
3667 if (!touchTarget.get()) 3665 if (!touchTarget.get())
3668 continue; 3666 continue;
3669 Document* doc = touchTarget->toNode()->document(); 3667 Document* doc = touchTarget->toNode()->document();
3670 if (!doc)
3671 continue;
3672 if (!doc->hasTouchEventHandlers()) 3668 if (!doc->hasTouchEventHandlers())
3673 continue; 3669 continue;
3674 Frame* targetFrame = doc->frame(); 3670 Frame* targetFrame = doc->frame();
3675 if (!targetFrame) 3671 if (!targetFrame)
3676 continue; 3672 continue;
3677 3673
3678 if (m_frame != targetFrame) { 3674 if (m_frame != targetFrame) {
3679 // pagePoint should always be relative to the target elements contai ning frame. 3675 // pagePoint should always be relative to the target elements contai ning frame.
3680 pagePoint = documentPointForWindowPoint(targetFrame, point.pos()); 3676 pagePoint = documentPointForWindowPoint(targetFrame, point.pos());
3681 } 3677 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
3852 unsigned EventHandler::accessKeyModifiers() 3848 unsigned EventHandler::accessKeyModifiers()
3853 { 3849 {
3854 #if OS(DARWIN) 3850 #if OS(DARWIN)
3855 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3851 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3856 #else 3852 #else
3857 return PlatformEvent::AltKey; 3853 return PlatformEvent::AltKey;
3858 #endif 3854 #endif
3859 } 3855 }
3860 3856
3861 } // namespace WebCore 3857 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/Chrome.cpp ('k') | Source/core/page/FocusController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698