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

Side by Side Diff: third_party/WebKit/Source/core/dom/Touch.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 2008, The Android Open Source Project 2 * Copyright 2008, The Android Open Source Project
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 24 matching lines...) Expand all
35 { 35 {
36 if (!frame) 36 if (!frame)
37 return FloatPoint(); 37 return FloatPoint();
38 FrameView* frameView = frame->view(); 38 FrameView* frameView = frame->view();
39 if (!frameView) 39 if (!frameView)
40 return FloatPoint(); 40 return FloatPoint();
41 float scale = 1.0f / frame->pageZoomFactor(); 41 float scale = 1.0f / frame->pageZoomFactor();
42 return FloatPoint(frameView->scrollPosition()).scaledBy(scale); 42 return FloatPoint(frameView->scrollPosition()).scaledBy(scale);
43 } 43 }
44 44
45 Touch::Touch(LocalFrame* frame, EventTarget* target, int identifier, const Float Point& screenPos, const FloatPoint& pagePos, const FloatSize& radius, float rota tionAngle, float force) 45 Touch::Touch(LocalFrame* frame, EventTarget* target, int identifier, const Float Point& screenPos, const FloatPoint& pagePos, const FloatSize& radius, float rota tionAngle, float force, String region)
46 : m_target(target) 46 : m_target(target)
47 , m_identifier(identifier) 47 , m_identifier(identifier)
48 , m_clientPos(pagePos - contentsOffset(frame)) 48 , m_clientPos(pagePos - contentsOffset(frame))
49 , m_screenPos(screenPos) 49 , m_screenPos(screenPos)
50 , m_pagePos(pagePos) 50 , m_pagePos(pagePos)
51 , m_radius(radius) 51 , m_radius(radius)
52 , m_rotationAngle(rotationAngle) 52 , m_rotationAngle(rotationAngle)
53 , m_force(force) 53 , m_force(force)
54 , m_region(region)
54 { 55 {
55 float scaleFactor = frame ? frame->pageZoomFactor() : 1.0f; 56 float scaleFactor = frame ? frame->pageZoomFactor() : 1.0f;
56 m_absoluteLocation = roundedLayoutPoint(pagePos.scaledBy(scaleFactor)); 57 m_absoluteLocation = roundedLayoutPoint(pagePos.scaledBy(scaleFactor));
57 } 58 }
58 59
59 Touch::Touch(EventTarget* target, int identifier, const FloatPoint& clientPos, c onst FloatPoint& screenPos, const FloatPoint& pagePos, const FloatSize& radius, float rotationAngle, float force, LayoutPoint absoluteLocation) 60 Touch::Touch(EventTarget* target, int identifier, const FloatPoint& clientPos, c onst FloatPoint& screenPos, const FloatPoint& pagePos, const FloatSize& radius, float rotationAngle, float force, String region, LayoutPoint absoluteLocation)
60 : m_target(target) 61 : m_target(target)
61 , m_identifier(identifier) 62 , m_identifier(identifier)
62 , m_clientPos(clientPos) 63 , m_clientPos(clientPos)
63 , m_screenPos(screenPos) 64 , m_screenPos(screenPos)
64 , m_pagePos(pagePos) 65 , m_pagePos(pagePos)
65 , m_radius(radius) 66 , m_radius(radius)
66 , m_rotationAngle(rotationAngle) 67 , m_rotationAngle(rotationAngle)
67 , m_force(force) 68 , m_force(force)
69 , m_region(region)
68 , m_absoluteLocation(absoluteLocation) 70 , m_absoluteLocation(absoluteLocation)
69 { 71 {
70 } 72 }
71 73
72 Touch::Touch(LocalFrame* frame, const TouchInit& initializer) 74 Touch::Touch(LocalFrame* frame, const TouchInit& initializer)
73 : m_target(initializer.target()) 75 : m_target(initializer.target())
74 , m_identifier(initializer.identifier()) 76 , m_identifier(initializer.identifier())
75 , m_clientPos(FloatPoint(initializer.clientX(), initializer.clientY())) 77 , m_clientPos(FloatPoint(initializer.clientX(), initializer.clientY()))
76 , m_screenPos(FloatPoint(initializer.screenX(), initializer.screenY())) 78 , m_screenPos(FloatPoint(initializer.screenX(), initializer.screenY()))
77 , m_pagePos(FloatPoint(initializer.pageX(), initializer.pageY())) 79 , m_pagePos(FloatPoint(initializer.pageX(), initializer.pageY()))
78 , m_radius(FloatSize(initializer.radiusX(), initializer.radiusY())) 80 , m_radius(FloatSize(initializer.radiusX(), initializer.radiusY()))
79 , m_rotationAngle(initializer.rotationAngle()) 81 , m_rotationAngle(initializer.rotationAngle())
80 , m_force(initializer.force()) 82 , m_force(initializer.force())
83 , m_region(initializer.region())
81 { 84 {
82 float scaleFactor = frame ? frame->pageZoomFactor() : 1.0f; 85 float scaleFactor = frame ? frame->pageZoomFactor() : 1.0f;
83 m_absoluteLocation = roundedLayoutPoint(m_pagePos.scaledBy(scaleFactor)); 86 m_absoluteLocation = roundedLayoutPoint(m_pagePos.scaledBy(scaleFactor));
84 } 87 }
85 88
86 PassRefPtrWillBeRawPtr<Touch> Touch::cloneWithNewTarget(EventTarget* eventTarget ) const 89 PassRefPtrWillBeRawPtr<Touch> Touch::cloneWithNewTarget(EventTarget* eventTarget ) const
87 { 90 {
88 return adoptRefWillBeNoop(new Touch(eventTarget, m_identifier, m_clientPos, m_screenPos, m_pagePos, m_radius, m_rotationAngle, m_force, m_absoluteLocation)) ; 91 return adoptRefWillBeNoop(new Touch(eventTarget, m_identifier, m_clientPos, m_screenPos, m_pagePos, m_radius, m_rotationAngle, m_force, m_region, m_absolute Location));
89 } 92 }
90 93
91 DEFINE_TRACE(Touch) 94 DEFINE_TRACE(Touch)
92 { 95 {
93 visitor->trace(m_target); 96 visitor->trace(m_target);
94 } 97 }
95 98
96 } // namespace blink 99 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698