Changeset 99014 in webkit
- Timestamp:
- Nov 1, 2011 5:08:04 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r99013 r99014 1 2011-11-01 Emil A Eklund <eae@chromium.org> 2 3 Use IntPoint for screen coordinates in MouseEvent 4 https://bugs.webkit.org/show_bug.cgi?id=71327 5 6 Reviewed by Darin Adler. 7 8 Change mouse events to use int/IntPoint for screen/window coordinates and 9 LayoutUnit/LayoutPoint for coordinates adjusted for zooming. 10 11 No new tests. 12 13 * dom/MouseRelatedEvent.cpp: 14 (WebCore::MouseRelatedEvent::MouseRelatedEvent): 15 (WebCore::MouseRelatedEvent::computeRelativePosition): 16 * dom/MouseRelatedEvent.h: 17 (WebCore::MouseRelatedEvent::screenLocation): 18 Revert screenLocation and windowLocation back to int. 19 20 * page/DragController.cpp: 21 (WebCore::elementUnderMouse): 22 Change elementUnderMouse to use a LayoutPoint for hit testing. 23 24 * page/EventHandler.cpp: 25 (WebCore::EventHandler::clear): 26 (WebCore::EventHandler::currentMousePosition): 27 (WebCore::documentPointForWindowPoint): 28 (WebCore::EventHandler::fakeMouseMoveEventTimerFired): 29 * page/EventHandler.h: 30 Revert m_currentMousePosition to IntPoint as it represents a 31 screen coordinate. 32 33 * platform/PlatformMouseEvent.h: 34 (WebCore::PlatformMouseEvent::PlatformMouseEvent): 35 (WebCore::PlatformMouseEvent::pos): 36 (WebCore::PlatformMouseEvent::x): 37 (WebCore::PlatformMouseEvent::y): 38 (WebCore::PlatformMouseEvent::globalX): 39 (WebCore::PlatformMouseEvent::globalY): 40 * platform/mac/PlatformMouseEventMac.mm: 41 (WebCore::globalPoint): 42 (WebCore::pointForEvent): 43 (WebCore::globalPointForEvent): 44 Revert PlatformMouseEvent to int/IntPoint as it represents a screen 45 coordinate. 46 1 47 2011-11-01 Tony Chang <tony@chromium.org> 2 48 -
trunk/Source/WebCore/dom/MouseRelatedEvent.cpp
r97380 r99014 54 54 55 55 MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<AbstractView> abstractView, 56 int detail, const LayoutPoint& screenLocation, const LayoutPoint& windowLocation,56 int detail, const IntPoint& screenLocation, const IntPoint& windowLocation, 57 57 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated) 58 58 : UIEventWithKeyState(eventType, canBubble, cancelable, abstractView, detail, ctrlKey, altKey, shiftKey, metaKey) … … 81 81 } 82 82 83 m_clientLocation = adjustedPageLocation - to Size(scrollPosition);83 m_clientLocation = adjustedPageLocation - toLayoutSize(scrollPosition); 84 84 m_pageLocation = adjustedPageLocation; 85 85 … … 182 182 layer->updateLayerPosition(); 183 183 for (; layer; layer = layer->parent()) { 184 m_layerLocation -= to Size(layer->location());184 m_layerLocation -= toLayoutSize(layer->location()); 185 185 } 186 186 } -
trunk/Source/WebCore/dom/MouseRelatedEvent.h
r93053 r99014 37 37 int screenX() const { return m_screenLocation.x(); } 38 38 int screenY() const { return m_screenLocation.y(); } 39 const LayoutPoint& screenLocation() const { return m_screenLocation; }39 const IntPoint& screenLocation() const { return m_screenLocation; } 40 40 int clientX() const { return m_clientLocation.x(); } 41 41 int clientY() const { return m_clientLocation.y(); } … … 60 60 MouseRelatedEvent(); 61 61 MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, 62 int detail, const LayoutPoint& screenLocation, const LayoutPoint& windowLocation,62 int detail, const IntPoint& screenLocation, const IntPoint& windowLocation, 63 63 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated = false); 64 64 … … 71 71 72 72 // Expose these so MouseEvent::initMouseEvent can set them. 73 LayoutPoint m_screenLocation;73 IntPoint m_screenLocation; 74 74 LayoutPoint m_clientLocation; 75 75 -
trunk/Source/WebCore/page/DragController.cpp
r97878 r99014 270 270 Frame* frame = documentUnderMouse->frame(); 271 271 float zoomFactor = frame ? frame->pageZoomFactor() : 1; 272 IntPoint point = roundedIntPoint(FloatPoint(p.x() * zoomFactor, p.y() * zoomFactor));272 LayoutPoint point = roundedLayoutPoint(FloatPoint(p.x() * zoomFactor, p.y() * zoomFactor)); 273 273 274 274 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); -
trunk/Source/WebCore/page/EventHandler.cpp
r98788 r99014 258 258 m_shouldOnlyFireDragOverEvent = false; 259 259 #endif 260 m_currentMousePosition = LayoutPoint();260 m_currentMousePosition = IntPoint(); 261 261 m_mousePressNode = 0; 262 262 m_mousePressed = false; … … 1127 1127 } 1128 1128 1129 LayoutPoint EventHandler::currentMousePosition() const1129 IntPoint EventHandler::currentMousePosition() const 1130 1130 { 1131 1131 return m_currentMousePosition; … … 1335 1335 } 1336 1336 1337 static LayoutPoint documentPointForWindowPoint(Frame* frame, const LayoutPoint& windowPoint)1337 static LayoutPoint documentPointForWindowPoint(Frame* frame, const IntPoint& windowPoint) 1338 1338 { 1339 1339 FrameView* view = frame->view(); … … 2407 2407 bool metaKey; 2408 2408 PlatformKeyboardEvent::getCurrentModifierState(shiftKey, ctrlKey, altKey, metaKey); 2409 LayoutPoint globalPoint = view->contentsToScreen(LayoutRect(view->windowToContents(m_currentMousePosition), LayoutSize())).location();2409 IntPoint globalPoint = view->contentsToScreen(IntRect(view->windowToContents(m_currentMousePosition), IntSize())).location(); 2410 2410 PlatformMouseEvent fakeMouseMoveEvent(m_currentMousePosition, globalPoint, NoButton, MouseEventMoved, 0, shiftKey, ctrlKey, altKey, metaKey, currentTime()); 2411 2411 mouseMoved(fakeMouseMoveEvent); -
trunk/Source/WebCore/page/EventHandler.h
r96566 r99014 137 137 void resizeLayerDestroyed(); 138 138 139 LayoutPoint currentMousePosition() const;139 IntPoint currentMousePosition() const; 140 140 141 141 static Frame* subframeForTargetNode(Node*); … … 401 401 LayoutSize m_offsetFromResizeCorner; // In the coords of m_resizeLayer. 402 402 403 LayoutPoint m_currentMousePosition;403 IntPoint m_currentMousePosition; 404 404 LayoutPoint m_mouseDownPos; // In our view's coords. 405 405 double m_mouseDownTimestamp; -
trunk/Source/WebCore/platform/PlatformMouseEvent.h
r95922 r99014 27 27 #define PlatformMouseEvent_h 28 28 29 #include " LayoutTypes.h"29 #include "IntPoint.h" 30 30 31 31 #if PLATFORM(GTK) … … 84 84 } 85 85 86 PlatformMouseEvent(const LayoutPoint& position, const LayoutPoint& globalPosition, MouseButton button, MouseEventType eventType,86 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, MouseEventType eventType, 87 87 int clickCount, bool shift, bool ctrl, bool alt, bool meta, double timestamp) 88 88 : m_position(position) … … 105 105 } 106 106 107 const LayoutPoint& pos() const { return m_position; }108 LayoutUnit x() const { return m_position.x(); }109 LayoutUnit y() const { return m_position.y(); }110 LayoutUnit globalX() const { return m_globalPosition.x(); }111 LayoutUnit globalY() const { return m_globalPosition.y(); }107 const IntPoint& pos() const { return m_position; } 108 int x() const { return m_position.x(); } 109 int y() const { return m_position.y(); } 110 int globalX() const { return m_globalPosition.x(); } 111 int globalY() const { return m_globalPosition.y(); } 112 112 MouseButton button() const { return m_button; } 113 113 MouseEventType eventType() const { return m_eventType; } … … 161 161 162 162 protected: 163 LayoutPoint m_position;164 LayoutPoint m_globalPosition;163 IntPoint m_position; 164 IntPoint m_globalPosition; 165 165 MouseButton m_button; 166 166 MouseEventType m_eventType; … … 181 181 182 182 #if PLATFORM(MAC) && defined(__OBJC__) 183 LayoutPoint globalPoint(const NSPoint& windowPoint, NSWindow *);184 LayoutPoint pointForEvent(NSEvent *, NSView *windowView);185 LayoutPoint globalPointForEvent(NSEvent *);183 IntPoint globalPoint(const NSPoint& windowPoint, NSWindow *); 184 IntPoint pointForEvent(NSEvent *, NSView *windowView); 185 IntPoint globalPointForEvent(NSEvent *); 186 186 #endif 187 187 -
trunk/Source/WebCore/platform/mac/PlatformMouseEventMac.mm
r93053 r99014 69 69 } 70 70 71 LayoutPoint globalPoint(const NSPoint& windowPoint, NSWindow *window)71 IntPoint globalPoint(const NSPoint& windowPoint, NSWindow *window) 72 72 { 73 return LayoutPoint(flipScreenPoint([window convertBaseToScreen:windowPoint], screenForWindow(window)));73 return IntPoint(flipScreenPoint([window convertBaseToScreen:windowPoint], screenForWindow(window))); 74 74 } 75 75 76 LayoutPoint pointForEvent(NSEvent *event, NSView *windowView)76 IntPoint pointForEvent(NSEvent *event, NSView *windowView) 77 77 { 78 78 switch ([event type]) { … … 93 93 if (windowView) 94 94 location = [windowView convertPoint:location fromView:nil]; 95 return LayoutPoint(location);95 return IntPoint(location); 96 96 } 97 97 default: 98 return LayoutPoint();98 return IntPoint(); 99 99 } 100 100 } 101 101 102 LayoutPoint globalPointForEvent(NSEvent *event)102 IntPoint globalPointForEvent(NSEvent *event) 103 103 { 104 104 switch ([event type]) { … … 116 116 return globalPoint([event locationInWindow], [event window]); 117 117 default: 118 return LayoutPoint();118 return IntPoint(); 119 119 } 120 120 }
Note: See TracChangeset
for help on using the changeset viewer.