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

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

Issue 1198193005: Fixed memory issues with EventHandler::TouchInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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) 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 3522 matching lines...) Expand 10 before | Expand all | Expand 10 after
3533 for (unsigned i = 0; i < touchInfos.size(); ++i) { 3533 for (unsigned i = 0; i < touchInfos.size(); ++i) {
3534 const TouchInfo& touchInfo = touchInfos[i]; 3534 const TouchInfo& touchInfo = touchInfos[i];
3535 const PlatformTouchPoint& point = touchInfo.point; 3535 const PlatformTouchPoint& point = touchInfo.point;
3536 PlatformTouchPoint::State pointState = point.state(); 3536 PlatformTouchPoint::State pointState = point.state();
3537 3537
3538 if (touchInfo.consumed) 3538 if (touchInfo.consumed)
3539 continue; 3539 continue;
3540 3540
3541 RefPtrWillBeRawPtr<Touch> touch = Touch::create( 3541 RefPtrWillBeRawPtr<Touch> touch = Touch::create(
3542 touchInfo.targetFrame, 3542 touchInfo.targetFrame,
3543 touchInfo.touchTarget, 3543 touchInfo.touchTarget.get(),
3544 point.id(), 3544 point.id(),
3545 point.screenPos(), 3545 point.screenPos(),
3546 touchInfo.adjustedPagePoint, 3546 touchInfo.adjustedPagePoint,
3547 touchInfo.adjustedRadius, 3547 touchInfo.adjustedRadius,
3548 point.rotationAngle(), 3548 point.rotationAngle(),
3549 point.force()); 3549 point.force());
3550 3550
3551 // Ensure this target's touch list exists, even if it ends up empty, so 3551 // Ensure this target's touch list exists, even if it ends up empty, so
3552 // it can always be passed to TouchEvent::Create below. 3552 // it can always be passed to TouchEvent::Create below.
3553 TargetTouchesHeapMap::iterator targetTouchesIterator = touchesByTarget.f ind(touchInfo.touchTarget); 3553 TargetTouchesHeapMap::iterator targetTouchesIterator = touchesByTarget.f ind(touchInfo.touchTarget.get());
3554 if (targetTouchesIterator == touchesByTarget.end()) { 3554 if (targetTouchesIterator == touchesByTarget.end()) {
3555 touchesByTarget.set(touchInfo.touchTarget, TouchList::create()); 3555 touchesByTarget.set(touchInfo.touchTarget.get(), TouchList::create() );
3556 targetTouchesIterator = touchesByTarget.find(touchInfo.touchTarget); 3556 targetTouchesIterator = touchesByTarget.find(touchInfo.touchTarget.g et());
3557 } 3557 }
3558 3558
3559 // touches and targetTouches should only contain information about 3559 // touches and targetTouches should only contain information about
3560 // touches still on the screen, so if this point is released or 3560 // touches still on the screen, so if this point is released or
3561 // cancelled it will only appear in the changedTouches list. 3561 // cancelled it will only appear in the changedTouches list.
3562 if (pointState != PlatformTouchPoint::TouchReleased && pointState != Pla tformTouchPoint::TouchCancelled) { 3562 if (pointState != PlatformTouchPoint::TouchReleased && pointState != Pla tformTouchPoint::TouchCancelled) {
3563 touches->append(touch); 3563 touches->append(touch);
3564 targetTouchesIterator->value->append(touch); 3564 targetTouchesIterator->value->append(touch);
3565 } 3565 }
3566 3566
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
3759 targetFrame = m_touchSequenceDocument->frame(); 3759 targetFrame = m_touchSequenceDocument->frame();
3760 } 3760 }
3761 ASSERT(targetFrame); 3761 ASSERT(targetFrame);
3762 3762
3763 // pagePoint should always be in the target element's document coordinat es. 3763 // pagePoint should always be in the target element's document coordinat es.
3764 FloatPoint pagePoint = targetFrame->view()->rootFrameToContents(point.po s()); 3764 FloatPoint pagePoint = targetFrame->view()->rootFrameToContents(point.po s());
3765 float scaleFactor = 1.0f / targetFrame->pageZoomFactor(); 3765 float scaleFactor = 1.0f / targetFrame->pageZoomFactor();
3766 3766
3767 TouchInfo& touchInfo = touchInfos[i]; 3767 TouchInfo& touchInfo = touchInfos[i];
3768 touchInfo.point = point; 3768 touchInfo.point = point;
3769 touchInfo.touchTarget = touchTarget.get(); 3769 touchInfo.touchTarget = touchTarget;
3770 touchInfo.targetFrame = targetFrame; 3770 touchInfo.targetFrame = targetFrame;
3771 touchInfo.adjustedPagePoint = pagePoint.scaledBy(scaleFactor); 3771 touchInfo.adjustedPagePoint = pagePoint.scaledBy(scaleFactor);
3772 touchInfo.adjustedRadius = point.radius().scaledBy(scaleFactor); 3772 touchInfo.adjustedRadius = point.radius().scaledBy(scaleFactor);
3773 touchInfo.knownTarget = knownTarget; 3773 touchInfo.knownTarget = knownTarget;
3774 touchInfo.consumed = false; 3774 touchInfo.consumed = false;
3775 } 3775 }
3776 3776
3777 if (RuntimeEnabledFeatures::pointerEventEnabled()) { 3777 if (RuntimeEnabledFeatures::pointerEventEnabled()) {
3778 dispatchPointerEventsForTouchEvent(event, touchInfos); 3778 dispatchPointerEventsForTouchEvent(event, touchInfos);
3779 // TODO(mustaq): This needs attention. 3779 // TODO(mustaq): This needs attention.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
3890 unsigned EventHandler::accessKeyModifiers() 3890 unsigned EventHandler::accessKeyModifiers()
3891 { 3891 {
3892 #if OS(MACOSX) 3892 #if OS(MACOSX)
3893 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3893 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3894 #else 3894 #else
3895 return PlatformEvent::AltKey; 3895 return PlatformEvent::AltKey;
3896 #endif 3896 #endif
3897 } 3897 }
3898 3898
3899 } // namespace blink 3899 } // namespace blink
OLDNEW
« Source/core/input/EventHandler.h ('K') | « Source/core/input/EventHandler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698