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

Side by Side Diff: sky/engine/core/events/MouseRelatedEvent.h

Issue 873963003: Remove more mouse-specific code (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Build fixes Created 5 years, 10 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
« no previous file with comments | « sky/engine/core/events/EventTypeNames.in ('k') | sky/engine/core/events/MouseRelatedEvent.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 */
23
24 #ifndef SKY_ENGINE_CORE_EVENTS_MOUSERELATEDEVENT_H_
25 #define SKY_ENGINE_CORE_EVENTS_MOUSERELATEDEVENT_H_
26
27 #include "sky/engine/core/events/UIEventWithKeyState.h"
28 #include "sky/engine/platform/geometry/LayoutPoint.h"
29
30 namespace blink {
31
32 // Internal only: Helper class for what's common between mouse and wheel eve nts.
33 class MouseRelatedEvent : public UIEventWithKeyState {
34 public:
35 int screenX() const { return m_screenLocation.x(); }
36 int screenY() const { return m_screenLocation.y(); }
37 const IntPoint& screenLocation() const { return m_screenLocation; }
38 int clientX() const { return m_clientLocation.x(); }
39 int clientY() const { return m_clientLocation.y(); }
40 int movementX() const { return m_movementDelta.x(); }
41 int movementY() const { return m_movementDelta.y(); }
42 const LayoutPoint& clientLocation() const { return m_clientLocation; }
43 virtual int layerX() override final;
44 virtual int layerY() override final;
45 int offsetX();
46 int offsetY();
47 // FIXME: rename isSimulated to fromKeyboard() and replace m_isSimulated with a new value
48 // in PlatformMouseEvent::SyntheticEventType. isSimulated() is only true for synthetic
49 // mouse events that derive from keyboard input, which do not have a pos ition.
50 bool isSimulated() const { return m_isSimulated; }
51 virtual int pageX() const override final;
52 virtual int pageY() const override final;
53 int x() const;
54 int y() const;
55
56 // Page point in "absolute" coordinates (i.e. page-relative coords,
57 // usable with RenderObject::absoluteToLocal).
58 const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; }
59 void setAbsoluteLocation(const LayoutPoint& p) { m_absoluteLocation = p; }
60
61 protected:
62 MouseRelatedEvent();
63 MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancela ble,
64 PassRefPtr<AbstractView>, int detail, const IntPoint& screenLocation ,
65 const IntPoint& windowLocation, const IntPoint& movementDelta, bool ctrlKey, bool altKey,
66 bool shiftKey, bool metaKey, bool isSimulated = false);
67
68 void initCoordinates();
69 void initCoordinates(const LayoutPoint& clientLocation);
70 virtual void receivedTarget() override final;
71
72 void computePageLocation();
73 void computeRelativePosition();
74
75 // Expose these so MouseEvent::initMouseEvent can set them.
76 IntPoint m_screenLocation;
77 LayoutPoint m_clientLocation;
78 LayoutPoint m_movementDelta;
79
80 private:
81 LayoutPoint m_pageLocation;
82 LayoutPoint m_layerLocation;
83 LayoutPoint m_offsetLocation;
84 LayoutPoint m_absoluteLocation;
85 bool m_isSimulated;
86 bool m_hasCachedRelativePosition;
87 };
88
89 } // namespace blink
90
91 #endif // SKY_ENGINE_CORE_EVENTS_MOUSERELATEDEVENT_H_
OLDNEW
« no previous file with comments | « sky/engine/core/events/EventTypeNames.in ('k') | sky/engine/core/events/MouseRelatedEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698