OLD | NEW |
---|---|
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 25 matching lines...) Expand all Loading... | |
36 return FloatPoint(); | 36 return FloatPoint(); |
37 FrameView* frameView = frame->view(); | 37 FrameView* frameView = frame->view(); |
38 if (!frameView) | 38 if (!frameView) |
39 return FloatPoint(); | 39 return FloatPoint(); |
40 float scale = 1.0f / frame->pageZoomFactor(); | 40 float scale = 1.0f / frame->pageZoomFactor(); |
41 return FloatPoint(frameView->scrollOffset()).scaledBy(scale); | 41 return FloatPoint(frameView->scrollOffset()).scaledBy(scale); |
42 } | 42 } |
43 | 43 |
44 Touch::Touch(LocalFrame* frame, | 44 Touch::Touch(LocalFrame* frame, |
45 EventTarget* target, | 45 EventTarget* target, |
46 int identifier, | |
47 const FloatPoint& screenPos, | 46 const FloatPoint& screenPos, |
48 const FloatPoint& pagePos, | 47 const FloatPoint& pagePos, |
49 const FloatSize& radius, | 48 const FloatSize& radius, |
50 float rotationAngle, | 49 float rotationAngle, |
51 float force, | 50 String region, |
52 String region) | 51 const WebPointerProperties& properties) |
53 : m_target(target), | 52 : m_target(target), |
54 m_identifier(identifier), | |
55 m_clientPos(pagePos - contentsOffset(frame)), | 53 m_clientPos(pagePos - contentsOffset(frame)), |
56 m_screenPos(screenPos), | 54 m_screenPos(screenPos), |
57 m_pagePos(pagePos), | 55 m_pagePos(pagePos), |
58 m_radius(radius), | 56 m_radius(radius), |
59 m_rotationAngle(rotationAngle), | 57 m_rotationAngle(rotationAngle), |
60 m_force(force), | 58 m_region(region), |
61 m_region(region) { | 59 m_pointerProperties(properties) { |
Navid Zolghadr
2016/11/15 18:53:37
It seems that everytime we create a WebTouchPoint
| |
62 float scaleFactor = frame ? frame->pageZoomFactor() : 1.0f; | 60 float scaleFactor = frame ? frame->pageZoomFactor() : 1.0f; |
63 m_absoluteLocation = LayoutPoint(pagePos.scaledBy(scaleFactor)); | 61 m_absoluteLocation = LayoutPoint(pagePos.scaledBy(scaleFactor)); |
64 } | 62 } |
65 | 63 |
66 Touch::Touch(EventTarget* target, | 64 Touch::Touch(EventTarget* target, |
67 int identifier, | |
68 const FloatPoint& clientPos, | 65 const FloatPoint& clientPos, |
69 const FloatPoint& screenPos, | 66 const FloatPoint& screenPos, |
70 const FloatPoint& pagePos, | 67 const FloatPoint& pagePos, |
71 const FloatSize& radius, | 68 const FloatSize& radius, |
72 float rotationAngle, | 69 float rotationAngle, |
73 float force, | |
74 String region, | 70 String region, |
71 const WebPointerProperties& properties, | |
75 LayoutPoint absoluteLocation) | 72 LayoutPoint absoluteLocation) |
76 : m_target(target), | 73 : m_target(target), |
77 m_identifier(identifier), | |
78 m_clientPos(clientPos), | 74 m_clientPos(clientPos), |
79 m_screenPos(screenPos), | 75 m_screenPos(screenPos), |
80 m_pagePos(pagePos), | 76 m_pagePos(pagePos), |
81 m_radius(radius), | 77 m_radius(radius), |
82 m_rotationAngle(rotationAngle), | 78 m_rotationAngle(rotationAngle), |
83 m_force(force), | |
84 m_region(region), | 79 m_region(region), |
85 m_absoluteLocation(absoluteLocation) {} | 80 m_absoluteLocation(absoluteLocation), |
81 m_pointerProperties(properties) {} | |
86 | 82 |
87 Touch::Touch(LocalFrame* frame, const TouchInit& initializer) | 83 Touch::Touch(LocalFrame* frame, const TouchInit& initializer) |
88 : m_target(initializer.target()), | 84 : m_target(initializer.target()), |
89 m_identifier(initializer.identifier()), | |
90 m_clientPos(FloatPoint(initializer.clientX(), initializer.clientY())), | 85 m_clientPos(FloatPoint(initializer.clientX(), initializer.clientY())), |
91 m_screenPos(FloatPoint(initializer.screenX(), initializer.screenY())), | 86 m_screenPos(FloatPoint(initializer.screenX(), initializer.screenY())), |
92 m_pagePos(FloatPoint(initializer.pageX(), initializer.pageY())), | 87 m_pagePos(FloatPoint(initializer.pageX(), initializer.pageY())), |
93 m_radius(FloatSize(initializer.radiusX(), initializer.radiusY())), | 88 m_radius(FloatSize(initializer.radiusX(), initializer.radiusY())), |
94 m_rotationAngle(initializer.rotationAngle()), | 89 m_rotationAngle(initializer.rotationAngle()), |
95 m_force(initializer.force()), | |
96 m_region(initializer.region()) { | 90 m_region(initializer.region()) { |
91 m_pointerProperties.id = initializer.identifier(); | |
92 m_pointerProperties.force = initializer.force(); | |
97 float scaleFactor = frame ? frame->pageZoomFactor() : 1.0f; | 93 float scaleFactor = frame ? frame->pageZoomFactor() : 1.0f; |
98 m_absoluteLocation = LayoutPoint(m_pagePos.scaledBy(scaleFactor)); | 94 m_absoluteLocation = LayoutPoint(m_pagePos.scaledBy(scaleFactor)); |
99 } | 95 } |
100 | 96 |
101 Touch* Touch::cloneWithNewTarget(EventTarget* eventTarget) const { | 97 Touch* Touch::cloneWithNewTarget(EventTarget* eventTarget) const { |
102 return new Touch(eventTarget, m_identifier, m_clientPos, m_screenPos, | 98 return new Touch(eventTarget, m_clientPos, m_screenPos, m_pagePos, m_radius, |
103 m_pagePos, m_radius, m_rotationAngle, m_force, m_region, | 99 m_rotationAngle, m_region, m_pointerProperties, |
104 m_absoluteLocation); | 100 m_absoluteLocation); |
105 } | 101 } |
106 | 102 |
107 DEFINE_TRACE(Touch) { | 103 DEFINE_TRACE(Touch) { |
108 visitor->trace(m_target); | 104 visitor->trace(m_target); |
109 } | 105 } |
110 | 106 |
111 } // namespace blink | 107 } // namespace blink |
OLD | NEW |