Diff
Modified: trunk/Source/WebCore/ChangeLog (93052 => 93053)
--- trunk/Source/WebCore/ChangeLog 2011-08-15 19:30:42 UTC (rev 93052)
+++ trunk/Source/WebCore/ChangeLog 2011-08-15 19:31:06 UTC (rev 93053)
@@ -1,3 +1,56 @@
+2011-08-15 Emil A Eklund <[email protected]>
+
+ Switch mouse events to to new layout types
+ https://bugs.webkit.org/show_bug.cgi?id=66179
+
+ Reviewed by Eric Seidel.
+
+ Convert mouse events to new layout abstraction as a part of the ongoing
+ conversion work.
+
+ No new tests, no new functionality.
+
+ * dom/MouseRelatedEvent.cpp:
+ (WebCore::contentsScrollOffset):
+ (WebCore::MouseRelatedEvent::MouseRelatedEvent):
+ (WebCore::MouseRelatedEvent::initCoordinates):
+ (WebCore::MouseRelatedEvent::computePageLocation):
+ (WebCore::MouseRelatedEvent::computeRelativePosition):
+ (WebCore::MouseRelatedEvent::pageLocation):
+ * dom/MouseRelatedEvent.h:
+ (WebCore::MouseRelatedEvent::screenLocation):
+ (WebCore::MouseRelatedEvent::clientLocation):
+ (WebCore::MouseRelatedEvent::absoluteLocation):
+ (WebCore::MouseRelatedEvent::setAbsoluteLocation):
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::clear):
+ (WebCore::EventHandler::handleMousePressEventSingleClick):
+ (WebCore::selectionExtentRespectingEditingBoundary):
+ (WebCore::EventHandler::hitTestResultAtPoint):
+ (WebCore::EventHandler::currentMousePosition):
+ (WebCore::documentPointForWindowPoint):
+ (WebCore::EventHandler::handleMousePressEvent):
+ (WebCore::EventHandler::mouseMoved):
+ (WebCore::EventHandler::handleWheelEvent):
+ (WebCore::EventHandler::sendContextMenuEvent):
+ (WebCore::EventHandler::sendContextMenuEventForKey):
+ (WebCore::EventHandler::fakeMouseMoveEventTimerFired):
+ (WebCore::EventHandler::dragHysteresisExceeded):
+ (WebCore::EventHandler::handleDrag):
+ (WebCore::EventHandler::handleTouchEvent):
+ * page/EventHandler.h:
+ * platform/PlatformMouseEvent.h:
+ (WebCore::PlatformMouseEvent::PlatformMouseEvent):
+ (WebCore::PlatformMouseEvent::pos):
+ (WebCore::PlatformMouseEvent::x):
+ (WebCore::PlatformMouseEvent::y):
+ (WebCore::PlatformMouseEvent::globalX):
+ (WebCore::PlatformMouseEvent::globalY):
+ * platform/mac/PlatformMouseEventMac.mm:
+ (WebCore::globalPoint):
+ (WebCore::pointForEvent):
+ (WebCore::globalPointForEvent):
+
2011-08-15 Ryosuke Niwa <[email protected]>
webkit-indent-blockquote is unnecessary
Modified: trunk/Source/WebCore/dom/MouseRelatedEvent.cpp (93052 => 93053)
--- trunk/Source/WebCore/dom/MouseRelatedEvent.cpp 2011-08-15 19:30:42 UTC (rev 93052)
+++ trunk/Source/WebCore/dom/MouseRelatedEvent.cpp 2011-08-15 19:31:06 UTC (rev 93053)
@@ -38,29 +38,29 @@
{
}
-static IntSize contentsScrollOffset(AbstractView* abstractView)
+static LayoutSize contentsScrollOffset(AbstractView* abstractView)
{
if (!abstractView)
- return IntSize();
+ return LayoutSize();
Frame* frame = abstractView->frame();
if (!frame)
- return IntSize();
+ return LayoutSize();
FrameView* frameView = frame->view();
if (!frameView)
- return IntSize();
- return IntSize(frameView->scrollX() / frame->pageZoomFactor(),
+ return LayoutSize();
+ return LayoutSize(frameView->scrollX() / frame->pageZoomFactor(),
frameView->scrollY() / frame->pageZoomFactor());
}
MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<AbstractView> abstractView,
- int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
+ int detail, const LayoutPoint& screenLocation, const LayoutPoint& windowLocation,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated)
: UIEventWithKeyState(eventType, canBubble, cancelable, abstractView, detail, ctrlKey, altKey, shiftKey, metaKey)
, m_screenLocation(screenLocation)
, m_isSimulated(isSimulated)
{
- IntPoint adjustedPageLocation;
- IntPoint scrollPosition;
+ LayoutPoint adjustedPageLocation;
+ LayoutPoint scrollPosition;
Frame* frame = view() ? view()->frame() : 0;
if (frame && !isSimulated) {
@@ -73,7 +73,7 @@
adjustedPageLocation.scale(1 / pageZoom, 1 / pageZoom);
// FIXME: Change this to use float math and proper rounding (or
- // better yet, use IntPoint::scale).
+ // better yet, use LayoutPoint::scale).
scrollPosition.setX(scrollPosition.x() / pageZoom);
scrollPosition.setY(scrollPosition.y() / pageZoom);
}
@@ -97,7 +97,7 @@
m_hasCachedRelativePosition = false;
}
-void MouseRelatedEvent::initCoordinates(const IntPoint& clientLocation)
+void MouseRelatedEvent::initCoordinates(const LayoutPoint& clientLocation)
{
// Set up initial values for coordinates.
// Correct values are computed lazily, see computeRelativePosition.
@@ -125,7 +125,7 @@
void MouseRelatedEvent::computePageLocation()
{
float zoomFactor = pageZoomFactor(this);
- setAbsoluteLocation(roundedIntPoint(FloatPoint(pageX() * zoomFactor, pageY() * zoomFactor)));
+ setAbsoluteLocation(roundedLayoutPoint(FloatPoint(pageX() * zoomFactor, pageY() * zoomFactor)));
}
void MouseRelatedEvent::receivedTarget()
@@ -150,7 +150,7 @@
if (!isSimulated()) {
if (RenderObject* r = targetNode->renderer()) {
FloatPoint localPos = r->absoluteToLocal(absoluteLocation(), false, true);
- m_offsetLocation = roundedIntPoint(localPos);
+ m_offsetLocation = roundedLayoutPoint(localPos);
float scaleFactor = 1 / pageZoomFactor(this);
if (scaleFactor != 1.0f)
m_offsetLocation.scale(scaleFactor, scaleFactor);
@@ -215,7 +215,7 @@
return m_pageLocation.y();
}
-const IntPoint& MouseRelatedEvent::pageLocation() const
+const LayoutPoint& MouseRelatedEvent::pageLocation() const
{
return m_pageLocation;
}
Modified: trunk/Source/WebCore/dom/MouseRelatedEvent.h (93052 => 93053)
--- trunk/Source/WebCore/dom/MouseRelatedEvent.h 2011-08-15 19:30:42 UTC (rev 93052)
+++ trunk/Source/WebCore/dom/MouseRelatedEvent.h 2011-08-15 19:31:06 UTC (rev 93053)
@@ -24,7 +24,7 @@
#ifndef MouseRelatedEvent_h
#define MouseRelatedEvent_h
-#include "IntPoint.h"
+#include "LayoutTypes.h"
#include "UIEventWithKeyState.h"
namespace WebCore {
@@ -36,10 +36,10 @@
// exposed via DOM APIs are invariant under zooming.
int screenX() const { return m_screenLocation.x(); }
int screenY() const { return m_screenLocation.y(); }
- const IntPoint& screenLocation() const { return m_screenLocation; }
+ const LayoutPoint& screenLocation() const { return m_screenLocation; }
int clientX() const { return m_clientLocation.x(); }
int clientY() const { return m_clientLocation.y(); }
- const IntPoint& clientLocation() const { return m_clientLocation; }
+ const LayoutPoint& clientLocation() const { return m_clientLocation; }
int layerX();
int layerY();
int offsetX();
@@ -47,37 +47,37 @@
bool isSimulated() const { return m_isSimulated; }
virtual int pageX() const;
virtual int pageY() const;
- virtual const IntPoint& pageLocation() const;
+ virtual const LayoutPoint& pageLocation() const;
int x() const;
int y() const;
// Page point in "absolute" coordinates (i.e. post-zoomed, page-relative coords,
// usable with RenderObject::absoluteToLocal).
- const IntPoint& absoluteLocation() const { return m_absoluteLocation; }
- void setAbsoluteLocation(const IntPoint& p) { m_absoluteLocation = p; }
+ const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; }
+ void setAbsoluteLocation(const LayoutPoint& p) { m_absoluteLocation = p; }
protected:
MouseRelatedEvent();
MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
- int detail, const IntPoint& screenLocation, const IntPoint& windowLocation,
+ int detail, const LayoutPoint& screenLocation, const LayoutPoint& windowLocation,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated = false);
void initCoordinates();
- void initCoordinates(const IntPoint& clientLocation);
+ void initCoordinates(const LayoutPoint& clientLocation);
virtual void receivedTarget();
void computePageLocation();
void computeRelativePosition();
// Expose these so MouseEvent::initMouseEvent can set them.
- IntPoint m_screenLocation;
- IntPoint m_clientLocation;
+ LayoutPoint m_screenLocation;
+ LayoutPoint m_clientLocation;
private:
- IntPoint m_pageLocation;
- IntPoint m_layerLocation;
- IntPoint m_offsetLocation;
- IntPoint m_absoluteLocation;
+ LayoutPoint m_pageLocation;
+ LayoutPoint m_layerLocation;
+ LayoutPoint m_offsetLocation;
+ LayoutPoint m_absoluteLocation;
bool m_isSimulated;
bool m_hasCachedRelativePosition;
};
Modified: trunk/Source/WebCore/page/EventHandler.cpp (93052 => 93053)
--- trunk/Source/WebCore/page/EventHandler.cpp 2011-08-15 19:30:42 UTC (rev 93052)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2011-08-15 19:31:06 UTC (rev 93053)
@@ -242,7 +242,7 @@
m_dragTarget = 0;
m_shouldOnlyFireDragOverEvent = false;
#endif
- m_currentMousePosition = IntPoint();
+ m_currentMousePosition = LayoutPoint();
m_mousePressNode = 0;
m_mousePressed = false;
m_capturesDragging = false;
@@ -396,7 +396,7 @@
// Don't restart the selection when the mouse is pressed on an
// existing selection so we can allow for text dragging.
if (FrameView* view = m_frame->view()) {
- IntPoint vPoint = view->windowToContents(event.event().pos());
+ LayoutPoint vPoint = view->windowToContents(event.event().pos());
if (!extendSelection && m_frame->selection()->contains(vPoint)) {
m_mouseDownWasSingleClickInSelection = true;
return false;
@@ -640,9 +640,9 @@
updateSelectionForMouseDrag(result);
}
-static VisiblePosition selectionExtentRespectingEditingBoundary(const VisibleSelection& selection, const IntPoint& localPoint, Node* targetNode)
+static VisiblePosition selectionExtentRespectingEditingBoundary(const VisibleSelection& selection, const LayoutPoint& localPoint, Node* targetNode)
{
- IntPoint selectionEndPoint = localPoint;
+ LayoutPoint selectionEndPoint = localPoint;
Element* editableElement = selection.rootEditableElement();
if (!targetNode->renderer())
@@ -653,7 +653,7 @@
return VisiblePosition();
FloatPoint absolutePoint = targetNode->renderer()->localToAbsolute(FloatPoint(selectionEndPoint));
- selectionEndPoint = roundedIntPoint(editableElement->renderer()->absoluteToLocal(absolutePoint));
+ selectionEndPoint = roundedLayoutPoint(editableElement->renderer()->absoluteToLocal(absolutePoint));
targetNode = editableElement;
}
@@ -922,7 +922,7 @@
}
#endif // ENABLE(DRAG_SUPPORT)
-HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const IntSize& padding)
+HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const LayoutSize& padding)
{
HitTestResult result(point, padding.height(), padding.width(), padding.height(), padding.width());
if (!m_frame->contentRenderer())
@@ -943,7 +943,7 @@
if (!frame || !frame->contentRenderer())
break;
FrameView* view = static_cast<FrameView*>(widget);
- IntPoint widgetPoint(result.localPoint().x() + view->scrollX() - renderWidget->borderLeft() - renderWidget->paddingLeft(),
+ LayoutPoint widgetPoint(result.localPoint().x() + view->scrollX() - renderWidget->borderLeft() - renderWidget->paddingLeft(),
result.localPoint().y() + view->scrollY() - renderWidget->borderTop() - renderWidget->paddingTop());
HitTestResult widgetHitTestResult(widgetPoint, padding.height(), padding.width(), padding.height(), padding.width());
frame->contentRenderer()->layer()->hitTest(HitTestRequest(hitType), widgetHitTestResult);
@@ -965,8 +965,8 @@
FrameView* resultView = resultFrame->view();
FrameView* mainView = mainFrame->view();
if (resultView && mainView) {
- IntPoint windowPoint = resultView->contentsToWindow(result.point());
- IntPoint mainFramePoint = mainView->windowToContents(windowPoint);
+ LayoutPoint windowPoint = resultView->contentsToWindow(result.point());
+ LayoutPoint mainFramePoint = mainView->windowToContents(windowPoint);
result = mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, allowShadowContent, ignoreClipping, testScrollbars, hitType, padding);
}
}
@@ -1122,7 +1122,7 @@
return frame->eventHandler()->logicalScrollRecursively(direction, granularity, m_frame->ownerElement());
}
-IntPoint EventHandler::currentMousePosition() const
+LayoutPoint EventHandler::currentMousePosition() const
{
return m_currentMousePosition;
}
@@ -1318,7 +1318,7 @@
return pointerCursor();
}
-static IntPoint documentPointForWindowPoint(Frame* frame, const IntPoint& windowPoint)
+static LayoutPoint documentPointForWindowPoint(Frame* frame, const LayoutPoint& windowPoint)
{
FrameView* view = frame->view();
// FIXME: Is it really OK to use the wrong coordinates here when view is 0?
@@ -1374,7 +1374,7 @@
HitTestRequest request(HitTestRequest::Active);
// Save the document point we generate in case the window coordinate is invalidated by what happens
// when we dispatch the event.
- IntPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.pos());
+ LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.pos());
MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent);
if (!targetNode(mev)) {
@@ -1421,7 +1421,7 @@
if (FrameView* view = m_frame->view()) {
RenderLayer* layer = m_clickNode->renderer() ? m_clickNode->renderer()->enclosingLayer() : 0;
- IntPoint p = view->windowToContents(mouseEvent.pos());
+ LayoutPoint p = view->windowToContents(mouseEvent.pos());
if (layer && layer->isPointInResizeControl(p)) {
layer->setInResizeMode(true);
m_resizeLayer = layer;
@@ -1532,7 +1532,7 @@
bool EventHandler::mouseMoved(const PlatformMouseEvent& event)
{
- HitTestResult hoveredNode = HitTestResult(IntPoint());
+ HitTestResult hoveredNode = HitTestResult(LayoutPoint());
bool result = handleMouseMoveEvent(event, &hoveredNode);
Page* page = m_frame->page();
@@ -2128,7 +2128,7 @@
if (!view)
return false;
setFrameWasScrolledByUser();
- IntPoint vPoint = view->windowToContents(e.pos());
+ LayoutPoint vPoint = view->windowToContents(e.pos());
Node* node;
bool isOverWidget;
@@ -2260,7 +2260,7 @@
return false;
bool swallowEvent;
- IntPoint viewportPos = v->windowToContents(event.pos());
+ LayoutPoint viewportPos = v->windowToContents(event.pos());
HitTestRequest request(HitTestRequest::Active);
MouseEventWithHitTestResults mev = doc->prepareMouseEvent(request, viewportPos, event);
@@ -2296,7 +2296,7 @@
#else
int rightAligned = 0;
#endif
- IntPoint location;
+ LayoutPoint location;
Node* focusedNode = doc->focusedNode();
FrameSelection* selection = m_frame->selection();
@@ -2304,26 +2304,26 @@
if (start.deprecatedNode() && (selection->rootEditableElement() || selection->isRange())) {
RefPtr<Range> selectionRange = selection->toNormalizedRange();
- IntRect firstRect = m_frame->editor()->firstRectForRange(selectionRange.get());
+ LayoutRect firstRect = m_frame->editor()->firstRectForRange(selectionRange.get());
- int x = rightAligned ? firstRect.maxX() : firstRect.x();
- location = IntPoint(x, firstRect.maxY());
+ LayoutUnit x = rightAligned ? firstRect.maxX() : firstRect.x();
+ location = LayoutPoint(x, firstRect.maxY());
} else if (focusedNode) {
RenderBoxModelObject* box = focusedNode->renderBoxModelObject();
if (!box)
return false;
- IntRect clippedRect = box->absoluteClippedOverflowRect();
- location = IntPoint(clippedRect.x(), clippedRect.maxY() - 1);
+ LayoutRect clippedRect = box->absoluteClippedOverflowRect();
+ location = LayoutPoint(clippedRect.x(), clippedRect.maxY() - 1);
} else {
- location = IntPoint(
+ location = LayoutPoint(
rightAligned ? view->contentsWidth() - kContextMenuMargin : kContextMenuMargin,
kContextMenuMargin);
}
m_frame->view()->setCursor(pointerCursor());
- IntPoint position = view->contentsToWindow(location);
- IntPoint globalPosition = view->contentsToScreen(IntRect(location, IntSize())).location();
+ LayoutPoint position = view->contentsToWindow(location);
+ LayoutPoint globalPosition = view->contentsToScreen(LayoutRect(location, LayoutSize())).location();
Node* targetNode = doc->focusedNode();
if (!targetNode)
@@ -2399,7 +2399,7 @@
bool altKey;
bool metaKey;
PlatformKeyboardEvent::getCurrentModifierState(shiftKey, ctrlKey, altKey, metaKey);
- IntPoint globalPoint = view->contentsToScreen(IntRect(view->windowToContents(m_currentMousePosition), IntSize())).location();
+ LayoutPoint globalPoint = view->contentsToScreen(LayoutRect(view->windowToContents(m_currentMousePosition), LayoutSize())).location();
PlatformMouseEvent fakeMouseMoveEvent(m_currentMousePosition, globalPoint, NoButton, MouseEventMoved, 0, shiftKey, ctrlKey, altKey, metaKey, currentTime());
mouseMoved(fakeMouseMoveEvent);
}
@@ -2697,19 +2697,19 @@
}
#if ENABLE(DRAG_SUPPORT)
-bool EventHandler::dragHysteresisExceeded(const FloatPoint& floatDragViewportLocation) const
+bool EventHandler::dragHysteresisExceeded(const IntPoint& floatDragViewportLocation) const
{
- IntPoint dragViewportLocation((int)floatDragViewportLocation.x(), (int)floatDragViewportLocation.y());
+ FloatPoint dragViewportLocation(floatDragViewportLocation.x(), floatDragViewportLocation.y());
return dragHysteresisExceeded(dragViewportLocation);
}
-
-bool EventHandler::dragHysteresisExceeded(const IntPoint& dragViewportLocation) const
+
+bool EventHandler::dragHysteresisExceeded(const FloatPoint& dragViewportLocation) const
{
FrameView* view = m_frame->view();
if (!view)
return false;
- IntPoint dragLocation = view->windowToContents(dragViewportLocation);
- IntSize delta = dragLocation - m_mouseDownPos;
+ LayoutPoint dragLocation = view->windowToContents(flooredLayoutPoint(dragViewportLocation));
+ LayoutSize delta = dragLocation - m_mouseDownPos;
int threshold = GeneralDragHysteresis;
switch (dragState().m_dragType) {
@@ -2861,7 +2861,7 @@
if (RenderObject* renderer = dragState().m_dragSrc->renderer()) {
// FIXME: This doesn't work correctly with transforms.
FloatPoint absPos = renderer->localToAbsolute();
- IntSize delta = m_mouseDownPos - roundedIntPoint(absPos);
+ LayoutSize delta = m_mouseDownPos - roundedLayoutPoint(absPos);
dragState().m_dragClipboard->setDragImageElement(dragState().m_dragSrc.get(), toPoint(delta));
} else {
// The renderer has disappeared, this can happen if the onStartDrag handler has hidden
@@ -3179,7 +3179,7 @@
for (unsigned i = 0; i < points.size(); ++i) {
const PlatformTouchPoint& point = points[i];
PlatformTouchPoint::State pointState = point.state();
- IntPoint pagePoint = documentPointForWindowPoint(m_frame, point.pos());
+ LayoutPoint pagePoint = documentPointForWindowPoint(m_frame, point.pos());
HitTestRequest::HitTestRequestType hitType = HitTestRequest::Active | HitTestRequest::ReadOnly;
// The HitTestRequest types used for mouse events map quite adequately
Modified: trunk/Source/WebCore/page/EventHandler.h (93052 => 93053)
--- trunk/Source/WebCore/page/EventHandler.h 2011-08-15 19:30:42 UTC (rev 93052)
+++ trunk/Source/WebCore/page/EventHandler.h 2011-08-15 19:31:06 UTC (rev 93053)
@@ -114,10 +114,10 @@
void dispatchFakeMouseMoveEventSoon();
void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&);
- HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false,
+ HitTestResult hitTestResultAtPoint(const LayoutPoint&, bool allowShadowContent, bool ignoreClipping = false,
HitTestScrollbars scrollbars = DontHitTestScrollbars,
HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active,
- const IntSize& padding = IntSize());
+ const LayoutSize& padding = LayoutSize());
bool mousePressed() const { return m_mousePressed; }
void setMousePressed(bool pressed) { m_mousePressed = pressed; }
@@ -136,7 +136,7 @@
void resizeLayerDestroyed();
- IntPoint currentMousePosition() const;
+ LayoutPoint currentMousePosition() const;
static Frame* subframeForTargetNode(Node*);
static Frame* subframeForHitTestResult(const MouseEventWithHitTestResults&);
@@ -353,7 +353,7 @@
SelectionInitiationState m_selectionInitiationState;
#if ENABLE(DRAG_SUPPORT)
- IntPoint m_dragStartPos;
+ LayoutPoint m_dragStartPos;
#endif
IntPoint m_panScrollStartPos;
@@ -398,10 +398,10 @@
RefPtr<HTMLFrameSetElement> m_frameSetBeingResized;
- IntSize m_offsetFromResizeCorner; // in the coords of m_resizeLayer
+ LayoutSize m_offsetFromResizeCorner; // In the coords of m_resizeLayer.
- IntPoint m_currentMousePosition;
- IntPoint m_mouseDownPos; // in our view's coords
+ LayoutPoint m_currentMousePosition;
+ LayoutPoint m_mouseDownPos; // In our view's coords.
double m_mouseDownTimestamp;
PlatformMouseEvent m_mouseDown;
Modified: trunk/Source/WebCore/platform/PlatformMouseEvent.h (93052 => 93053)
--- trunk/Source/WebCore/platform/PlatformMouseEvent.h 2011-08-15 19:30:42 UTC (rev 93052)
+++ trunk/Source/WebCore/platform/PlatformMouseEvent.h 2011-08-15 19:31:06 UTC (rev 93053)
@@ -26,7 +26,7 @@
#ifndef PlatformMouseEvent_h
#define PlatformMouseEvent_h
-#include "IntPoint.h"
+#include "LayoutTypes.h"
#if PLATFORM(GTK)
typedef struct _GdkEventButton GdkEventButton;
@@ -93,7 +93,7 @@
{
}
- PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, MouseEventType eventType,
+ PlatformMouseEvent(const LayoutPoint& position, const LayoutPoint& globalPosition, MouseButton button, MouseEventType eventType,
int clickCount, bool shift, bool ctrl, bool alt, bool meta, double timestamp)
: m_position(position)
, m_globalPosition(globalPosition)
@@ -114,11 +114,11 @@
{
}
- const IntPoint& pos() const { return m_position; }
- int x() const { return m_position.x(); }
- int y() const { return m_position.y(); }
- int globalX() const { return m_globalPosition.x(); }
- int globalY() const { return m_globalPosition.y(); }
+ const LayoutPoint& pos() const { return m_position; }
+ LayoutUnit x() const { return m_position.x(); }
+ LayoutUnit y() const { return m_position.y(); }
+ LayoutUnit globalX() const { return m_globalPosition.x(); }
+ LayoutUnit globalY() const { return m_globalPosition.y(); }
MouseButton button() const { return m_button; }
MouseEventType eventType() const { return m_eventType; }
int clickCount() const { return m_clickCount; }
@@ -178,8 +178,8 @@
#endif
protected:
- IntPoint m_position;
- IntPoint m_globalPosition;
+ LayoutPoint m_position;
+ LayoutPoint m_globalPosition;
MouseButton m_button;
MouseEventType m_eventType;
int m_clickCount;
@@ -198,9 +198,9 @@
};
#if PLATFORM(MAC) && defined(__OBJC__)
- IntPoint globalPoint(const NSPoint& windowPoint, NSWindow *);
- IntPoint pointForEvent(NSEvent *, NSView *windowView);
- IntPoint globalPointForEvent(NSEvent *);
+ LayoutPoint globalPoint(const NSPoint& windowPoint, NSWindow *);
+ LayoutPoint pointForEvent(NSEvent *, NSView *windowView);
+ LayoutPoint globalPointForEvent(NSEvent *);
#endif
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mac/PlatformMouseEventMac.mm (93052 => 93053)
--- trunk/Source/WebCore/platform/mac/PlatformMouseEventMac.mm 2011-08-15 19:30:42 UTC (rev 93052)
+++ trunk/Source/WebCore/platform/mac/PlatformMouseEventMac.mm 2011-08-15 19:31:06 UTC (rev 93053)
@@ -68,12 +68,12 @@
}
}
-IntPoint globalPoint(const NSPoint& windowPoint, NSWindow *window)
+LayoutPoint globalPoint(const NSPoint& windowPoint, NSWindow *window)
{
- return IntPoint(flipScreenPoint([window convertBaseToScreen:windowPoint], screenForWindow(window)));
+ return LayoutPoint(flipScreenPoint([window convertBaseToScreen:windowPoint], screenForWindow(window)));
}
-IntPoint pointForEvent(NSEvent *event, NSView *windowView)
+LayoutPoint pointForEvent(NSEvent *event, NSView *windowView)
{
switch ([event type]) {
case NSLeftMouseDown:
@@ -92,14 +92,14 @@
NSPoint location = [event locationInWindow];
if (windowView)
location = [windowView convertPoint:location fromView:nil];
- return IntPoint(location);
+ return LayoutPoint(location);
}
default:
- return IntPoint();
+ return LayoutPoint();
}
}
-IntPoint globalPointForEvent(NSEvent *event)
+LayoutPoint globalPointForEvent(NSEvent *event)
{
switch ([event type]) {
case NSLeftMouseDown:
@@ -115,7 +115,7 @@
case NSScrollWheel:
return globalPoint([event locationInWindow], [event window]);
default:
- return IntPoint();
+ return LayoutPoint();
}
}