Commit 526a338d authored by weinig@apple.com's avatar weinig@apple.com

More PlatformEvent cleanup

https://bugs.webkit.org/show_bug.cgi?id=74831

Reviewed by Dan Bernstein.

../WebCore: 

* platform/PlatformMouseEvent.h:
(WebCore::PlatformMouseEvent::position):
Rename pos -> position(). Remove x() and y() accessors.

(WebCore::PlatformMouseEvent::globalPosition):
Added. Replaces globalX() and globalY() accessors.

(WebCore::PlatformMouseEvent::movementDelta):
Added. Replaces movementX() and movementY() accessors.

* platform/PlatformWheelEvent.h:
(WebCore::PlatformWheelEvent::position):
Renamed pos -> position().

(WebCore::PlatformWheelEvent::globalPosition):
Renamed globalPos -> globalPosition().

* dom/MouseEvent.cpp:
(WebCore::MouseEvent::create):
* dom/WheelEvent.cpp:
(WebCore::WheelEventDispatchMediator::WheelEventDispatchMediator):
* page/DragController.cpp:
(WebCore::DragController::startDrag):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEventSingleClick):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::eventMayStartDrag):
(WebCore::EventHandler::handleMouseReleaseEvent):
(WebCore::EventHandler::selectCursor):
(WebCore::EventHandler::handleMouseDoubleClickEvent):
(WebCore::EventHandler::handleMouseMoveEvent):
(WebCore::EventHandler::dispatchDragEvent):
(WebCore::EventHandler::prepareMouseEvent):
(WebCore::EventHandler::dispatchMouseEvent):
(WebCore::EventHandler::handleWheelEvent):
(WebCore::EventHandler::sendContextMenuEvent):
(WebCore::EventHandler::handleDrag):
(WebCore::EventHandler::handleTouchEvent):
* page/chromium/EventHandlerChromium.cpp:
(WebCore::EventHandler::passMousePressEventToSubframe):
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::mouseMoved):
(WebCore::Scrollbar::mouseDown):
* platform/ScrollbarThemeComposite.cpp:
(WebCore::ScrollbarThemeComposite::hitTest):
* platform/chromium/PopupContainer.cpp:
(WebCore::constructRelativeMouseEvent):
(WebCore::constructRelativeWheelEvent):
* platform/chromium/PopupListBox.cpp:
(WebCore::PopupListBox::handleMouseDownEvent):
(WebCore::PopupListBox::handleMouseMoveEvent):
(WebCore::PopupListBox::handleMouseReleaseEvent):
(WebCore::PopupListBox::handleWheelEvent):
* platform/chromium/ScrollbarThemeChromiumWin.cpp:
(WebCore::ScrollbarThemeChromiumWin::shouldSnapBackToDragOrigin):
* platform/qt/ScrollbarQt.cpp:
(WebCore::Scrollbar::contextMenu):
* platform/qt/ScrollbarThemeQt.cpp:
(WebCore::ScrollbarThemeQt::hitTest):
* platform/win/ScrollbarThemeWin.cpp:
(WebCore::ScrollbarThemeWin::shouldSnapBackToDragOrigin):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::resize):
Update to use new names, access style.

../WebKit/chromium: 

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::mouseContextMenu):
Update to use new names, access style.

../WebKit/gtk: 

* webkit/webkitwebview.cpp:
(webkit_web_view_forward_context_menu_event):
(webkit_web_view_get_hit_test_result):
Update to use new names, access style.

../WebKit/qt: 

* Api/qwebpage.cpp:
(QWebPage::swallowContextMenuEvent):
Update to use new names, access style.

../WebKit/win: 

* WebView.cpp:
(WebView::handleMouseEvent):
Update to use new names, access style.

../WebKit/wince: 

* WebView.cpp:
(WebView::handleMouseEvent):
Update to use new names, access style.

../WebKit2: 

* WebProcess/WebPage/WebPage.cpp:
(WebKit::handleContextMenuEvent):
Update to use new names, access style.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3e1e12b9
2011-12-19 Sam Weinig <sam@webkit.org>
More PlatformEvent cleanup
https://bugs.webkit.org/show_bug.cgi?id=74831
Reviewed by Dan Bernstein.
* platform/PlatformMouseEvent.h:
(WebCore::PlatformMouseEvent::position):
Rename pos -> position(). Remove x() and y() accessors.
(WebCore::PlatformMouseEvent::globalPosition):
Added. Replaces globalX() and globalY() accessors.
(WebCore::PlatformMouseEvent::movementDelta):
Added. Replaces movementX() and movementY() accessors.
* platform/PlatformWheelEvent.h:
(WebCore::PlatformWheelEvent::position):
Renamed pos -> position().
(WebCore::PlatformWheelEvent::globalPosition):
Renamed globalPos -> globalPosition().
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::create):
* dom/WheelEvent.cpp:
(WebCore::WheelEventDispatchMediator::WheelEventDispatchMediator):
* page/DragController.cpp:
(WebCore::DragController::startDrag):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEventSingleClick):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::eventMayStartDrag):
(WebCore::EventHandler::handleMouseReleaseEvent):
(WebCore::EventHandler::selectCursor):
(WebCore::EventHandler::handleMouseDoubleClickEvent):
(WebCore::EventHandler::handleMouseMoveEvent):
(WebCore::EventHandler::dispatchDragEvent):
(WebCore::EventHandler::prepareMouseEvent):
(WebCore::EventHandler::dispatchMouseEvent):
(WebCore::EventHandler::handleWheelEvent):
(WebCore::EventHandler::sendContextMenuEvent):
(WebCore::EventHandler::handleDrag):
(WebCore::EventHandler::handleTouchEvent):
* page/chromium/EventHandlerChromium.cpp:
(WebCore::EventHandler::passMousePressEventToSubframe):
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::mouseMoved):
(WebCore::Scrollbar::mouseDown):
* platform/ScrollbarThemeComposite.cpp:
(WebCore::ScrollbarThemeComposite::hitTest):
* platform/chromium/PopupContainer.cpp:
(WebCore::constructRelativeMouseEvent):
(WebCore::constructRelativeWheelEvent):
* platform/chromium/PopupListBox.cpp:
(WebCore::PopupListBox::handleMouseDownEvent):
(WebCore::PopupListBox::handleMouseMoveEvent):
(WebCore::PopupListBox::handleMouseReleaseEvent):
(WebCore::PopupListBox::handleWheelEvent):
* platform/chromium/ScrollbarThemeChromiumWin.cpp:
(WebCore::ScrollbarThemeChromiumWin::shouldSnapBackToDragOrigin):
* platform/qt/ScrollbarQt.cpp:
(WebCore::Scrollbar::contextMenu):
* platform/qt/ScrollbarThemeQt.cpp:
(WebCore::ScrollbarThemeQt::hitTest):
* platform/win/ScrollbarThemeWin.cpp:
(WebCore::ScrollbarThemeWin::shouldSnapBackToDragOrigin):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::resize):
Update to use new names, access style.
2011-12-19 Adam Klein <adamk@chromium.org>
Remove unused ExceptionCode& argument from Element::setAttribute(QualifiedName)
......@@ -38,9 +38,9 @@ PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRef
bool isCancelable = eventType != eventNames().mousemoveEvent;
return MouseEvent::create(eventType, true, isCancelable, view,
detail, event.globalX(), event.globalY(), event.x(), event.y(),
detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
#if ENABLE(POINTER_LOCK)
event.movementX(), event.movementY(),
event.movementDelta().x(), event.movementDelta().y(),
#endif
event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
relatedTarget, 0, false);
......
......@@ -108,7 +108,7 @@ WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent&
return;
setEvent(WheelEvent::create(FloatPoint(event.wheelTicksX(), event.wheelTicksY()), FloatPoint(event.deltaX(), event.deltaY()),
granularity(event), view, event.globalPos(), event.pos(),
granularity(event), view, event.globalPosition(), event.position(),
event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.directionInvertedFromDevice()));
}
......
......@@ -719,7 +719,7 @@ bool DragController::startDrag(Frame* src, const DragState& state, DragOperation
KURL linkURL = hitTestResult.absoluteLinkURL();
KURL imageURL = hitTestResult.absoluteImageURL();
IntPoint mouseDraggedPoint = src->view()->windowToContents(dragEvent.pos());
IntPoint mouseDraggedPoint = src->view()->windowToContents(dragEvent.position());
m_draggingImageURL = KURL();
m_sourceDragOperation = srcOp;
......
......@@ -402,7 +402,7 @@ bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestR
// 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()) {
LayoutPoint vPoint = view->windowToContents(event.event().pos());
LayoutPoint vPoint = view->windowToContents(event.event().position());
if (!extendSelection && m_frame->selection()->contains(vPoint)) {
m_mouseDownWasSingleClickInSelection = true;
return false;
......@@ -464,7 +464,7 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
cancelFakeMouseMoveEvent();
if (ScrollView* scrollView = m_frame->view()) {
if (scrollView->isPointInScrollbarCorner(event.event().pos()))
if (scrollView->isPointInScrollbarCorner(event.event().position()))
return false;
}
......@@ -491,7 +491,7 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
&& static_cast<SVGDocument*>(m_frame->document())->zoomAndPanEnabled()) {
if (event.event().shiftKey() && singleClick) {
m_svgPan = true;
static_cast<SVGDocument*>(m_frame->document())->startPan(m_frame->view()->windowToContents(event.event().pos()));
static_cast<SVGDocument*>(m_frame->document())->startPan(m_frame->view()->windowToContents(event.event().position()));
return true;
}
}
......@@ -506,7 +506,7 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
m_mousePressNode = innerNode;
#if ENABLE(DRAG_SUPPORT)
m_dragStartPos = event.event().pos();
m_dragStartPos = event.event().position();
#endif
bool swallowEvent = false;
......@@ -626,7 +626,7 @@ bool EventHandler::eventMayStartDrag(const PlatformMouseEvent& event) const
updateDragSourceActionsAllowed();
HitTestRequest request(HitTestRequest::ReadOnly);
HitTestResult result(view->windowToContents(event.pos()));
HitTestResult result(view->windowToContents(event.position()));
m_frame->contentRenderer()->layer()->hitTest(request, result);
DragState state;
return result.innerNode() && page->dragController()->draggableNode(m_frame, result.innerNode(), result.point(), state);
......@@ -765,7 +765,7 @@ bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& e
// editing, place the caret.
if (m_mouseDownWasSingleClickInSelection && m_selectionInitiationState != ExtendedSelection
#if ENABLE(DRAG_SUPPORT)
&& m_dragStartPos == event.event().pos()
&& m_dragStartPos == event.event().position()
#endif
&& m_frame->selection()->isRange()
&& event.event().button() != RightButton) {
......@@ -1261,7 +1261,7 @@ OptionalCursor EventHandler::selectCursor(const MouseEventWithHitTestResults& ev
if (renderer) {
if (RenderLayer* layer = renderer->enclosingLayer()) {
if (FrameView* view = m_frame->view())
inResizer = layer->isPointInResizeControl(view->windowToContents(event.event().pos()));
inResizer = layer->isPointInResizeControl(view->windowToContents(event.event().position()));
}
}
if ((editable || (renderer && renderer->isText() && node->canStartSelection())) && !inResizer && !scrollbar)
......@@ -1383,7 +1383,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
cancelFakeMouseMoveEvent();
m_mousePressed = true;
m_capturesDragging = true;
m_currentMousePosition = mouseEvent.pos();
m_currentMousePosition = mouseEvent.position();
m_mouseDownTimestamp = mouseEvent.timestamp();
#if ENABLE(DRAG_SUPPORT)
m_mouseDownMayStartDrag = false;
......@@ -1391,7 +1391,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
m_mouseDownMayStartSelect = false;
m_mouseDownMayStartAutoscroll = false;
if (FrameView* view = m_frame->view())
m_mouseDownPos = view->windowToContents(mouseEvent.pos());
m_mouseDownPos = view->windowToContents(mouseEvent.position());
else {
invalidateClick();
return false;
......@@ -1401,7 +1401,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
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());
IntPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.position());
MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent);
if (!targetNode(mev)) {
......@@ -1448,7 +1448,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
if (FrameView* view = m_frame->view()) {
RenderLayer* layer = m_clickNode->renderer() ? m_clickNode->renderer()->enclosingLayer() : 0;
IntPoint p = view->windowToContents(mouseEvent.pos());
IntPoint p = view->windowToContents(mouseEvent.position());
if (layer && layer->isPointInResizeControl(p)) {
layer->setInResizeMode(true);
m_resizeLayer = layer;
......@@ -1492,7 +1492,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
}
FrameView* view = m_frame->view();
Scrollbar* scrollbar = view ? view->scrollbarAtPoint(mouseEvent.pos()) : 0;
Scrollbar* scrollbar = view ? view->scrollbarAtPoint(mouseEvent.position()) : 0;
if (!scrollbar)
scrollbar = mev.scrollbar();
......@@ -1516,7 +1516,7 @@ bool EventHandler::handleMouseDoubleClickEvent(const PlatformMouseEvent& mouseEv
// We get this instead of a second mouse-up
m_mousePressed = false;
m_currentMousePosition = mouseEvent.pos();
m_currentMousePosition = mouseEvent.position();
HitTestRequest request(HitTestRequest::Active);
MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent);
......@@ -1594,7 +1594,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi
return false;
RefPtr<FrameView> protector(m_frame->view());
m_currentMousePosition = mouseEvent.pos();
m_currentMousePosition = mouseEvent.position();
if (m_hoverTimer.isActive())
m_hoverTimer.stop();
......@@ -1635,7 +1635,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi
m_resizeLayer->resize(mouseEvent, m_offsetFromResizeCorner);
else {
if (FrameView* view = m_frame->view())
scrollbar = view->scrollbarAtPoint(mouseEvent.pos());
scrollbar = view->scrollbarAtPoint(mouseEvent.position());
if (!scrollbar)
scrollbar = mev.scrollbar();
......@@ -1704,7 +1704,7 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
#endif
m_mousePressed = false;
m_currentMousePosition = mouseEvent.pos();
m_currentMousePosition = mouseEvent.position();
#if ENABLE(SVG)
if (m_svgPan) {
......@@ -1760,9 +1760,9 @@ bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTa
view->resetDeferredRepaintDelay();
RefPtr<MouseEvent> me = MouseEvent::create(eventType,
true, true, m_frame->document()->defaultView(),
0, event.globalX(), event.globalY(), event.x(), event.y(),
0, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
#if ENABLE(POINTER_LOCK)
event.movementX(), event.movementY(),
event.movementDelta().x(), event.movementDelta().y(),
#endif
event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
0, 0, clipboard);
......@@ -1939,7 +1939,7 @@ MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques
ASSERT(m_frame);
ASSERT(m_frame->document());
return m_frame->document()->prepareMouseEvent(request, documentPointForWindowPoint(m_frame, mev.pos()), mev);
return m_frame->document()->prepareMouseEvent(request, documentPointForWindowPoint(m_frame, mev.position()), mev);
}
#if ENABLE(SVG)
......@@ -2078,7 +2078,7 @@ bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
// If clicking on a frame scrollbar, do not mess up with content focus.
if (FrameView* view = m_frame->view()) {
if (view->scrollbarAtPoint(mouseEvent.pos()))
if (view->scrollbarAtPoint(mouseEvent.position()))
return false;
}
......@@ -2146,7 +2146,7 @@ bool EventHandler::handleWheelEvent(const PlatformWheelEvent& e)
if (!view)
return false;
setFrameWasScrolledByUser();
LayoutPoint vPoint = view->windowToContents(e.pos());
LayoutPoint vPoint = view->windowToContents(e.position());
Node* node;
bool isOverWidget;
......@@ -2283,7 +2283,7 @@ bool EventHandler::sendContextMenuEvent(const PlatformMouseEvent& event)
return false;
bool swallowEvent;
LayoutPoint viewportPos = v->windowToContents(event.pos());
LayoutPoint viewportPos = v->windowToContents(event.position());
HitTestRequest request(HitTestRequest::Active);
MouseEventWithHitTestResults mev = doc->prepareMouseEvent(request, viewportPos, event);
......@@ -2869,7 +2869,7 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event)
view->setCursor(pointerCursor());
}
if (!dragHysteresisExceeded(event.event().pos()))
if (!dragHysteresisExceeded(event.event().position()))
return true;
// Once we're past the hysteresis point, we don't want to treat this gesture as a click
......
......@@ -58,7 +58,7 @@ bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& m
// greyed out even though we're clicking on the selection. This looks
// really strange (having the whole frame be greyed out), so we deselect the
// selection.
IntPoint p = m_frame->view()->windowToContents(mev.event().pos());
IntPoint p = m_frame->view()->windowToContents(mev.event().position());
if (m_frame->selection()->contains(p)) {
VisiblePosition visiblePos(
targetNode(mev)->renderer()->positionForPoint(mev.localPoint()));
......
......@@ -94,14 +94,10 @@ namespace WebCore {
{
}
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 IntPoint& position() const { return m_position; }
const IntPoint& globalPosition() const { return m_globalPosition; }
#if ENABLE(POINTER_LOCK)
int movementX() const { return m_movementDelta.x(); }
int movementY() const { return m_movementDelta.y(); }
const IntPoint& movementDelta() const { return m_movementDelta; }
#endif
MouseButton button() const { return m_button; }
......
......@@ -133,8 +133,8 @@ namespace WebCore {
return copy;
}
const IntPoint& pos() const { return m_position; } // PlatformWindow coordinates.
const IntPoint& globalPos() const { return m_globalPosition; } // Screen coordinates.
const IntPoint& position() const { return m_position; } // PlatformWindow coordinates.
const IntPoint& globalPosition() const { return m_globalPosition; } // Screen coordinates.
float deltaX() const { return m_deltaX; }
float deltaY() const { return m_deltaY; }
......
......@@ -337,14 +337,14 @@ bool Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin);
} else {
moveThumb(m_orientation == HorizontalScrollbar ?
convertFromContainingWindow(evt.pos()).x() :
convertFromContainingWindow(evt.pos()).y(), theme()->shouldDragDocumentInsteadOfThumb(this, evt));
convertFromContainingWindow(evt.position()).x() :
convertFromContainingWindow(evt.position()).y(), theme()->shouldDragDocumentInsteadOfThumb(this, evt));
}
return true;
}
if (m_pressedPart != NoPart)
m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.pos()).x() : convertFromContainingWindow(evt.pos()).y());
m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());
ScrollbarPart part = theme()->hitTest(this, evt);
if (part != m_hoveredPart) {
......@@ -410,7 +410,7 @@ bool Scrollbar::mouseDown(const PlatformMouseEvent& evt)
return true; // FIXME: Handled as context menu by Qt right now. Should just avoid even calling this method on a right click though.
setPressedPart(theme()->hitTest(this, evt));
int pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.pos()).x() : convertFromContainingWindow(evt.pos()).y());
int pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());
if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && theme()->shouldCenterOnThumb(this, evt)) {
setHoveredPart(ThumbPart);
......
......@@ -122,7 +122,7 @@ ScrollbarPart ScrollbarThemeComposite::hitTest(Scrollbar* scrollbar, const Platf
if (!scrollbar->enabled())
return result;
IntPoint mousePosition = scrollbar->convertFromContainingWindow(evt.pos());
IntPoint mousePosition = scrollbar->convertFromContainingWindow(evt.position());
mousePosition.move(scrollbar->x(), scrollbar->y());
if (!scrollbar->frameRect().contains(mousePosition))
......
......@@ -68,11 +68,11 @@ static PlatformMouseEvent constructRelativeMouseEvent(const PlatformMouseEvent&
FramelessScrollView* parent,
FramelessScrollView* child)
{
IntPoint pos = parent->convertSelfToChild(child, e.pos());
IntPoint pos = parent->convertSelfToChild(child, e.position());
// FIXME: This is a horrible hack since PlatformMouseEvent has no setters for x/y.
PlatformMouseEvent relativeEvent = e;
IntPoint& relativePos = const_cast<IntPoint&>(relativeEvent.pos());
IntPoint& relativePos = const_cast<IntPoint&>(relativeEvent.position());
relativePos.setX(pos.x());
relativePos.setY(pos.y());
return relativeEvent;
......@@ -82,11 +82,11 @@ static PlatformWheelEvent constructRelativeWheelEvent(const PlatformWheelEvent&
FramelessScrollView* parent,
FramelessScrollView* child)
{
IntPoint pos = parent->convertSelfToChild(child, e.pos());
IntPoint pos = parent->convertSelfToChild(child, e.position());
// FIXME: This is a horrible hack since PlatformWheelEvent has no setters for x/y.
PlatformWheelEvent relativeEvent = e;
IntPoint& relativePos = const_cast<IntPoint&>(relativeEvent.pos());
IntPoint& relativePos = const_cast<IntPoint&>(relativeEvent.position());
relativePos.setX(pos.x());
relativePos.setY(pos.y());
return relativeEvent;
......
......@@ -83,14 +83,14 @@ PopupListBox::PopupListBox(PopupMenuClient* client, const PopupContainerSettings
bool PopupListBox::handleMouseDownEvent(const PlatformMouseEvent& event)
{
Scrollbar* scrollbar = scrollbarAtPoint(event.pos());
Scrollbar* scrollbar = scrollbarAtPoint(event.position());
if (scrollbar) {
m_capturingScrollbar = scrollbar;
m_capturingScrollbar->mouseDown(event);
return true;
}
if (!isPointInBounds(event.pos()))
if (!isPointInBounds(event.position()))
abandon();
return true;
......@@ -103,7 +103,7 @@ bool PopupListBox::handleMouseMoveEvent(const PlatformMouseEvent& event)
return true;
}
Scrollbar* scrollbar = scrollbarAtPoint(event.pos());
Scrollbar* scrollbar = scrollbarAtPoint(event.position());
if (m_lastScrollbarUnderMouse != scrollbar) {
// Send mouse exited to the old scrollbar.
if (m_lastScrollbarUnderMouse)
......@@ -116,10 +116,10 @@ bool PopupListBox::handleMouseMoveEvent(const PlatformMouseEvent& event)
return true;
}
if (!isPointInBounds(event.pos()))
if (!isPointInBounds(event.position()))
return false;
selectIndex(pointToRowIndex(event.pos()));
selectIndex(pointToRowIndex(event.position()));
return true;
}
......@@ -131,12 +131,12 @@ bool PopupListBox::handleMouseReleaseEvent(const PlatformMouseEvent& event)
return true;
}
if (!isPointInBounds(event.pos()))
if (!isPointInBounds(event.position()))
return true;
// Need to check before calling acceptIndex(), because m_popupClient might be removed in acceptIndex() calling because of event handler.
bool isSelectPopup = m_popupClient->menuStyle().menuType() == PopupMenuStyle::SelectPopup;
if (acceptIndex(pointToRowIndex(event.pos())) && m_focusedNode && isSelectPopup) {
if (acceptIndex(pointToRowIndex(event.position())) && m_focusedNode && isSelectPopup) {
m_focusedNode->dispatchMouseEvent(event, eventNames().mouseupEvent);
m_focusedNode->dispatchMouseEvent(event, eventNames().clickEvent);
......@@ -149,7 +149,7 @@ bool PopupListBox::handleMouseReleaseEvent(const PlatformMouseEvent& event)
bool PopupListBox::handleWheelEvent(const PlatformWheelEvent& event)
{
if (!isPointInBounds(event.pos())) {
if (!isPointInBounds(event.position())) {
abandon();
return true;
}
......
......@@ -84,7 +84,7 @@ bool ScrollbarThemeChromiumWin::shouldSnapBackToDragOrigin(Scrollbar* scrollbar,
rect.inflateY((horz ? kOffSideMultiplier : kOffEndMultiplier) * thickness);
// Convert the event to local coordinates.
IntPoint mousePosition = scrollbar->convertFromContainingWindow(evt.pos());
IntPoint mousePosition = scrollbar->convertFromContainingWindow(evt.position());
mousePosition.move(scrollbar->x(), scrollbar->y());
// We should snap iff the event is outside our calculated rect.
......
......@@ -70,7 +70,7 @@ bool Scrollbar::contextMenu(const PlatformMouseEvent& event)
QAction* actScrollUp = menu.addAction(horizontal ? QCoreApplication::translate("QWebPage", "Scroll left") : QCoreApplication::translate("QWebPage", "Scroll up"));
QAction* actScrollDown = menu.addAction(horizontal ? QCoreApplication::translate("QWebPage", "Scroll right") : QCoreApplication::translate("QWebPage", "Scroll down"));
const QPoint globalPos = QPoint(event.globalX(), event.globalY());
const QPoint globalPos = QPoint(event.globalPosition().x(), event.globalPosition().y());
QAction* actionSelected = menu.exec(globalPos);
if (actionSelected == actScrollHere) {
......@@ -79,7 +79,7 @@ bool Scrollbar::contextMenu(const PlatformMouseEvent& event)
// thumb to the new position
int position = theme()->trackPosition(this) + theme()->thumbPosition(this) + theme()->thumbLength(this) / 2;
setPressedPos(position);
const QPoint pos = convertFromContainingWindow(event.pos());
const QPoint pos = convertFromContainingWindow(event.position());
moveThumb(horizontal ? pos.x() : pos.y());
} else if (actionSelected == actScrollTop)
scrollableArea()->scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByDocument);
......
......@@ -196,7 +196,7 @@ bool ScrollbarThemeQt::paint(Scrollbar* scrollbar, GraphicsContext* graphicsCont
ScrollbarPart ScrollbarThemeQt::hitTest(Scrollbar* scrollbar, const PlatformMouseEvent& evt)
{
QStyleOptionSlider* opt = styleOptionSlider(scrollbar);
const QPoint pos = scrollbar->convertFromContainingWindow(evt.pos());
const QPoint pos = scrollbar->convertFromContainingWindow(evt.position());
opt->rect.moveTo(QPoint(0, 0));
QStyle::SubControl sc = style()->hitTestComplexControl(QStyle::CC_ScrollBar, opt, pos, 0);
return scrollbarPart(sc);
......
......@@ -204,7 +204,7 @@ bool ScrollbarThemeWin::shouldSnapBackToDragOrigin(Scrollbar* scrollbar, const P
rect.inflateY((horz ? kOffSideMultiplier : kOffEndMultiplier) * thickness);
// Convert the event to local coordinates.
IntPoint mousePosition = scrollbar->convertFromContainingWindow(evt.pos());
IntPoint mousePosition = scrollbar->convertFromContainingWindow(evt.position());
mousePosition.move(scrollbar->x(), scrollbar->y());
// We should snap iff the event is outside our calculated rect.
......
......@@ -1693,7 +1693,7 @@ void RenderLayer::resize(const PlatformMouseEvent& evt, const LayoutSize& oldOff
float zoomFactor = renderer->style()->effectiveZoom();
LayoutSize newOffset = offsetFromResizeCorner(document->view()->windowToContents(evt.pos()));
LayoutSize newOffset = offsetFromResizeCorner(document->view()->windowToContents(evt.position()));
newOffset.setWidth(newOffset.width() / zoomFactor);
newOffset.setHeight(newOffset.height() / zoomFactor);
......
2011-12-19 Sam Weinig <sam@webkit.org>
More PlatformEvent cleanup
https://bugs.webkit.org/show_bug.cgi?id=74831
Reviewed by Dan Bernstein.
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::mouseContextMenu):
Update to use new names, access style.
2011-12-19 James Robinson <jamesr@chromium.org>
[chromium] CCLayerDelegate and WebLayerClient do not need notifySyncRequired
......
......@@ -537,7 +537,7 @@ void WebViewImpl::mouseContextMenu(const WebMouseEvent& event)
PlatformMouseEventBuilder pme(mainFrameImpl()->frameView(), event);
// Find the right target frame. See issue 1186900.
HitTestResult result = hitTestResultForWindowPos(pme.pos());
HitTestResult result = hitTestResultForWindowPos(pme.position());
Frame* targetFrame;
if (result.innerNonSharedNode())
targetFrame = result.innerNonSharedNode()->document()->frame();
......
2011-12-19 Sam Weinig <sam@webkit.org>
More PlatformEvent cleanup
https://bugs.webkit.org/show_bug.cgi?id=74831
Reviewed by Dan Bernstein.
* webkit/webkitwebview.cpp:
(webkit_web_view_forward_context_menu_event):
(webkit_web_view_get_hit_test_result):
Update to use new names, access style.
2011-12-16 Ryosuke Niwa <rniwa@webkit.org>
Rename registerCommandFor(Undo|Redo) to register(Undo|Redo)Step
......
......@@ -326,7 +326,7 @@ static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webVie
mainFrame->view()->setCursor(pointerCursor());
if (page->frameCount()) {
HitTestRequest request(HitTestRequest::Active);
IntPoint point = mainFrame->view()->windowToContents(event.pos());
IntPoint point = mainFrame->view()->windowToContents(event.position());
MouseEventWithHitTestResults mev = mainFrame->document()->prepareMouseEvent(request, point, event);
Frame* targetFrame = EventHandler::subframeForHitTestResult(mev);
......@@ -384,8 +384,8 @@ static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webVie
WebKitWebViewPrivate* priv = webView->priv;
priv->currentMenu = menu;
priv->lastPopupXPosition = event.globalX();
priv->lastPopupYPosition = event.globalY();
priv->lastPopupXPosition = event.globalPosition().x();
priv->lastPopupYPosition = event.globalPosition().y();
gtk_menu_popup(menu, 0, 0, &PopupMenuPositionFunc, webView, event.button() + 1, gtk_get_current_event_time());
return TRUE;
......@@ -4785,7 +4785,7 @@ WebKitHitTestResult* webkit_web_view_get_hit_test_result(WebKitWebView* webView,
PlatformMouseEvent mouseEvent = PlatformMouseEvent(event);
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
HitTestRequest request(HitTestRequest::Active);
IntPoint documentPoint = documentPointForWindowPoint(frame, mouseEvent.pos());
IntPoint documentPoint = documentPointForWindowPoint(frame, mouseEvent.position());
MouseEventWithHitTestResults mev = frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent);
return kit(mev.hitTestResult());
......
......@@ -3273,7 +3273,7 @@ bool QWebPage::swallowContextMenuEvent(QContextMenuEvent *event)
if (!RenderThemeQt::useMobileTheme()) {
if (QWebFrame* webFrame = frameAt(event->pos())) {
Frame* frame = QWebFramePrivate::core(webFrame);
if (Scrollbar* scrollbar = frame->view()->scrollbarAtPoint(PlatformMouseEvent(event, 1).pos()))
if (Scrollbar* scrollbar = frame->view()->scrollbarAtPoint(PlatformMouseEvent(event, 1).position()))
return scrollbar->contextMenu(PlatformMouseEvent(event, 1));
}
}
......
2011-12-19 Sam Weinig <sam@webkit.org>
More PlatformEvent cleanup
https://bugs.webkit.org/show_bug.cgi?id=74831
Reviewed by Dan Bernstein.
* Api/qwebpage.cpp:
(QWebPage::swallowContextMenuEvent):
Update to use new names, access style.
2011-12-19 Alexander Færøy <ahf@0x90.dk>
[Qt] Cleanup QTM_NAMESPACE usage in DeviceOrientationProviderQt
......
2011-12-19 Sam Weinig <sam@webkit.org>
More PlatformEvent cleanup
https://bugs.webkit.org/show_bug.cgi?id=74831
Reviewed by Dan Bernstein.
* WebView.cpp:
(WebView::handleMouseEvent):
Update to use new names, access style.
2011-12-16 Ryosuke Niwa <rniwa@webkit.org>
Rename registerCommandFor(Undo|Redo) to register(Undo|Redo)Step
......
......@@ -1465,8 +1465,8 @@ bool WebView::handleMouseEvent(UINT message, WPARAM wParam, LPARAM lParam)
setMouseActivated(false);
bool insideThreshold = abs(globalPrevPoint.x() - mouseEvent.pos().x()) < ::GetSystemMetrics(SM_CXDOUBLECLK) &&
abs(globalPrevPoint.y() - mouseEvent.pos().y()) < ::GetSystemMetrics(SM_CYDOUBLECLK);
bool insideThreshold = abs(globalPrevPoint.x() - mouseEvent.position().x()) < ::GetSystemMetrics(SM_CXDOUBLECLK) &&
abs(globalPrevPoint.y() - mouseEvent.position().y()) < ::GetSystemMetrics(SM_CYDOUBLECLK);
LONG messageTime = ::GetMessageTime();
bool handled = false;
......@@ -1489,7 +1489,7 @@ bool WebView::handleMouseEvent(UINT message, WPARAM wParam, LPARAM lParam)