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

Side by Side Diff: third_party/WebKit/Source/core/dom/Touch.h

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 25 matching lines...) Expand all
36 #include "platform/geometry/LayoutPoint.h" 36 #include "platform/geometry/LayoutPoint.h"
37 #include "platform/heap/Handle.h" 37 #include "platform/heap/Handle.h"
38 #include "wtf/PassRefPtr.h" 38 #include "wtf/PassRefPtr.h"
39 #include "wtf/RefCounted.h" 39 #include "wtf/RefCounted.h"
40 #include "wtf/RefPtr.h" 40 #include "wtf/RefPtr.h"
41 41
42 namespace blink { 42 namespace blink {
43 43
44 class LocalFrame; 44 class LocalFrame;
45 45
46 class CORE_EXPORT Touch final : public RefCountedWillBeGarbageCollected<Touch>, public ScriptWrappable { 46 class CORE_EXPORT Touch final : public RefCountedWillBeGarbageCollectedFinalized <Touch>, public ScriptWrappable {
47 DEFINE_WRAPPERTYPEINFO(); 47 DEFINE_WRAPPERTYPEINFO();
48 public: 48 public:
49 static PassRefPtrWillBeRawPtr<Touch> create(LocalFrame* frame, EventTarget* target, 49 static PassRefPtrWillBeRawPtr<Touch> create(LocalFrame* frame, EventTarget* target,
50 int identifier, const FloatPoint& screenPos, const FloatPoint& pagePos, 50 int identifier, const FloatPoint& screenPos, const FloatPoint& pagePos,
51 const FloatSize& radius, float rotationAngle, float force) 51 const FloatSize& radius, float rotationAngle, float force, String region )
52 { 52 {
53 return adoptRefWillBeNoop( 53 return adoptRefWillBeNoop(
54 new Touch(frame, target, identifier, screenPos, pagePos, radius, rot ationAngle, force)); 54 new Touch(frame, target, identifier, screenPos, pagePos, radius, rot ationAngle, force, region));
55 } 55 }
56 56
57 static PassRefPtrWillBeRawPtr<Touch> create(const Document& document, const TouchInit& initializer) 57 static PassRefPtrWillBeRawPtr<Touch> create(const Document& document, const TouchInit& initializer)
58 { 58 {
59 return adoptRefWillBeNoop(new Touch(document.frame(), initializer)); 59 return adoptRefWillBeNoop(new Touch(document.frame(), initializer));
60 } 60 }
61 61
62 // DOM Touch implementation 62 // DOM Touch implementation
63 EventTarget* target() const { return m_target.get(); } 63 EventTarget* target() const { return m_target.get(); }
64 int identifier() const { return m_identifier; } 64 int identifier() const { return m_identifier; }
65 double clientX() const { return m_clientPos.x(); } 65 double clientX() const { return m_clientPos.x(); }
66 double clientY() const { return m_clientPos.y(); } 66 double clientY() const { return m_clientPos.y(); }
67 double screenX() const { return m_screenPos.x(); } 67 double screenX() const { return m_screenPos.x(); }
68 double screenY() const { return m_screenPos.y(); } 68 double screenY() const { return m_screenPos.y(); }
69 double pageX() const { return m_pagePos.x(); } 69 double pageX() const { return m_pagePos.x(); }
70 double pageY() const { return m_pagePos.y(); } 70 double pageY() const { return m_pagePos.y(); }
71 float radiusX() const { return m_radius.width(); } 71 float radiusX() const { return m_radius.width(); }
72 float radiusY() const { return m_radius.height(); } 72 float radiusY() const { return m_radius.height(); }
73 float rotationAngle() const { return m_rotationAngle; } 73 float rotationAngle() const { return m_rotationAngle; }
74 float force() const { return m_force; } 74 float force() const { return m_force; }
75 const String& region() const { return m_region; }
75 76
76 // Blink-internal methods 77 // Blink-internal methods
77 const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; } 78 const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; }
78 const FloatPoint& screenLocation() const { return m_screenPos; } 79 const FloatPoint& screenLocation() const { return m_screenPos; }
79 PassRefPtrWillBeRawPtr<Touch> cloneWithNewTarget(EventTarget*) const; 80 PassRefPtrWillBeRawPtr<Touch> cloneWithNewTarget(EventTarget*) const;
80 81
81 DECLARE_TRACE(); 82 DECLARE_TRACE();
82 83
83 private: 84 private:
84 Touch(LocalFrame*, EventTarget*, int identifier, 85 Touch(LocalFrame*, EventTarget*, int identifier,
85 const FloatPoint& screenPos, const FloatPoint& pagePos, 86 const FloatPoint& screenPos, const FloatPoint& pagePos,
86 const FloatSize& radius, float rotationAngle, float force); 87 const FloatSize& radius, float rotationAngle, float force, String region );
87 88
88 Touch(EventTarget*, int identifier, const FloatPoint& clientPos, 89 Touch(EventTarget*, int identifier, const FloatPoint& clientPos,
89 const FloatPoint& screenPos, const FloatPoint& pagePos, 90 const FloatPoint& screenPos, const FloatPoint& pagePos,
90 const FloatSize& radius, float rotationAngle, float force, LayoutPoint a bsoluteLocation); 91 const FloatSize& radius, float rotationAngle, float force, String region , LayoutPoint absoluteLocation);
91 92
92 Touch(LocalFrame*, const TouchInit&); 93 Touch(LocalFrame*, const TouchInit&);
93 94
94 RefPtrWillBeMember<EventTarget> m_target; 95 RefPtrWillBeMember<EventTarget> m_target;
95 int m_identifier; 96 int m_identifier;
96 // Position relative to the viewport in CSS px. 97 // Position relative to the viewport in CSS px.
97 FloatPoint m_clientPos; 98 FloatPoint m_clientPos;
98 // Position relative to the screen in DIPs. 99 // Position relative to the screen in DIPs.
99 FloatPoint m_screenPos; 100 FloatPoint m_screenPos;
100 // Position relative to the page in CSS px. 101 // Position relative to the page in CSS px.
101 FloatPoint m_pagePos; 102 FloatPoint m_pagePos;
102 // Radius in CSS px. 103 // Radius in CSS px.
103 FloatSize m_radius; 104 FloatSize m_radius;
104 float m_rotationAngle; 105 float m_rotationAngle;
105 float m_force; 106 float m_force;
107 String m_region;
106 // FIXME(rbyers): Shouldn't we be able to migrate callers to relying on scre enPos, pagePos 108 // FIXME(rbyers): Shouldn't we be able to migrate callers to relying on scre enPos, pagePos
107 // or clientPos? absoluteLocation appears to be the same as pagePos but with out browser 109 // or clientPos? absoluteLocation appears to be the same as pagePos but with out browser
108 // scale applied. 110 // scale applied.
109 LayoutPoint m_absoluteLocation; 111 LayoutPoint m_absoluteLocation;
110 }; 112 };
111 113
112 } // namespace blink 114 } // namespace blink
113 115
114 #endif // Touch_h 116 #endif // Touch_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698