Commit d18f79bb authored by akling@apple.com's avatar akling@apple.com

<https://webkit.org/b/119866> Frame::eventHandler() should return a reference.

Reviewed by Anders Carlsson.

Frame::m_eventHandler is never null.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154178 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3da11d5c
2013-08-16 Andreas Kling <akling@apple.com>
<https://webkit.org/b/119866> Frame::eventHandler() should return a reference.
Reviewed by Anders Carlsson.
Frame::m_eventHandler is never null.
2013-08-16 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r153749.
......@@ -1817,7 +1817,7 @@ void Document::recalcStyle(Style::Change change)
// detached (for example, by setting display:none in the :hover style), schedule another mouseMove event
// to check if any other elements ended up under the mouse pointer due to re-layout.
if (m_hoveredElement && !m_hoveredElement->renderer() && frame())
frame()->eventHandler()->dispatchFakeMouseMoveEventSoon();
frame()->eventHandler().dispatchFakeMouseMoveEventSoon();
}
void Document::updateStyleIfNeeded()
......@@ -3232,7 +3232,7 @@ void Document::hoveredElementDidDetach(Element* element)
while (m_hoveredElement && !m_hoveredElement->renderer())
m_hoveredElement = m_hoveredElement->parentElement();
if (frame())
frame()->eventHandler()->scheduleHoverStateUpdate();
frame()->eventHandler().scheduleHoverStateUpdate();
}
void Document::elementInActiveChainDidDetach(Element* element)
......@@ -3473,7 +3473,7 @@ void Document::nodeChildrenWillBeRemoved(ContainerNode* container)
if (Frame* frame = this->frame()) {
for (Node* n = container->firstChild(); n; n = n->nextSibling()) {
frame->eventHandler()->nodeWillBeRemoved(n);
frame->eventHandler().nodeWillBeRemoved(n);
frame->selection()->nodeWillBeRemoved(n);
frame->page()->dragCaretController()->nodeWillBeRemoved(n);
}
......@@ -3493,7 +3493,7 @@ void Document::nodeWillBeRemoved(Node* n)
}
if (Frame* frame = this->frame()) {
frame->eventHandler()->nodeWillBeRemoved(n);
frame->eventHandler().nodeWillBeRemoved(n);
frame->selection()->nodeWillBeRemoved(n);
frame->page()->dragCaretController()->nodeWillBeRemoved(n);
}
......
......@@ -180,7 +180,7 @@ int KeyboardEvent::charCode() const
// We match Firefox, unless in backward compatibility mode, where we always return the character code.
bool backwardCompatibilityMode = false;
if (view() && view()->frame())
backwardCompatibilityMode = view()->frame()->eventHandler()->needsKeyboardEventDisambiguationQuirks();
backwardCompatibilityMode = view()->frame()->eventHandler().needsKeyboardEventDisambiguationQuirks();
if (!m_keyEvent || (type() != eventNames().keypressEvent && !backwardCompatibilityMode))
return 0;
......
......@@ -2207,7 +2207,7 @@ void Node::defaultEventHandler(Event* event)
if (eventType == eventNames().keydownEvent || eventType == eventNames().keypressEvent) {
if (event->isKeyboardEvent())
if (Frame* frame = document()->frame())
frame->eventHandler()->defaultKeyboardEventHandler(static_cast<KeyboardEvent*>(event));
frame->eventHandler().defaultKeyboardEventHandler(static_cast<KeyboardEvent*>(event));
} else if (eventType == eventNames().clickEvent) {
int detail = event->isUIEvent() ? static_cast<UIEvent*>(event)->detail() : 0;
if (dispatchDOMActivateEvent(detail, event))
......@@ -2221,7 +2221,7 @@ void Node::defaultEventHandler(Event* event)
} else if (eventType == eventNames().textInputEvent) {
if (event->hasInterface(eventNames().interfaceForTextEvent))
if (Frame* frame = document()->frame())
frame->eventHandler()->defaultTextInputEventHandler(static_cast<TextEvent*>(event));
frame->eventHandler().defaultTextInputEventHandler(static_cast<TextEvent*>(event));
#if ENABLE(PAN_SCROLLING)
} else if (eventType == eventNames().mousedownEvent && event->isMouseEvent()) {
MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
......@@ -2235,7 +2235,7 @@ void Node::defaultEventHandler(Event* event)
if (renderer) {
if (Frame* frame = document()->frame())
frame->eventHandler()->startPanScrolling(renderer);
frame->eventHandler().startPanScrolling(renderer);
}
}
#endif
......@@ -2250,7 +2250,7 @@ void Node::defaultEventHandler(Event* event)
if (startNode && startNode->renderer())
if (Frame* frame = document()->frame())
frame->eventHandler()->defaultWheelEventHandler(startNode, wheelEvent);
frame->eventHandler().defaultWheelEventHandler(startNode, wheelEvent);
} else if (event->type() == eventNames().webkitEditableContentChangedEvent) {
dispatchInputEvent();
}
......
......@@ -937,12 +937,12 @@ void Editor::clear()
bool Editor::insertText(const String& text, Event* triggeringEvent)
{
return m_frame->eventHandler()->handleTextInputEvent(text, triggeringEvent);
return m_frame->eventHandler().handleTextInputEvent(text, triggeringEvent);
}
bool Editor::insertTextForConfirmedComposition(const String& text)
{
return m_frame->eventHandler()->handleTextInputEvent(text, 0, TextEventInputComposition);
return m_frame->eventHandler().handleTextInputEvent(text, 0, TextEventInputComposition);
}
bool Editor::insertDictatedText(const String& text, const Vector<DictationAlternative>& dictationAlternatives, Event* triggeringEvent)
......
......@@ -484,7 +484,7 @@ static bool executeIndent(Frame* frame, Event*, EditorCommandSource, const Strin
static bool executeInsertBacktab(Frame* frame, Event* event, EditorCommandSource, const String&)
{
return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event, TextEventInputBackTab);
return targetFrame(frame, event)->eventHandler().handleTextInputEvent("\t", event, TextEventInputBackTab);
}
static bool executeInsertHorizontalRule(Frame* frame, Event*, EditorCommandSource, const String& value)
......@@ -512,7 +512,7 @@ static bool executeInsertLineBreak(Frame* frame, Event* event, EditorCommandSour
{
switch (source) {
case CommandFromMenuOrKeyBinding:
return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\n", event, TextEventInputLineBreak);
return targetFrame(frame, event)->eventHandler().handleTextInputEvent("\n", event, TextEventInputLineBreak);
case CommandFromDOM:
case CommandFromDOMWithUserInterface:
// Doesn't scroll to make the selection visible, or modify the kill ring.
......@@ -528,7 +528,7 @@ static bool executeInsertLineBreak(Frame* frame, Event* event, EditorCommandSour
static bool executeInsertNewline(Frame* frame, Event* event, EditorCommandSource, const String&)
{
Frame* targetFrame = WebCore::targetFrame(frame, event);
return targetFrame->eventHandler()->handleTextInputEvent("\n", event, targetFrame->editor().canEditRichly() ? TextEventInputKeyboard : TextEventInputLineBreak);
return targetFrame->eventHandler().handleTextInputEvent("\n", event, targetFrame->editor().canEditRichly() ? TextEventInputKeyboard : TextEventInputLineBreak);
}
static bool executeInsertNewlineInQuotedContent(Frame* frame, Event*, EditorCommandSource, const String&)
......@@ -551,7 +551,7 @@ static bool executeInsertParagraph(Frame* frame, Event*, EditorCommandSource, co
static bool executeInsertTab(Frame* frame, Event* event, EditorCommandSource, const String&)
{
return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event);
return targetFrame(frame, event)->eventHandler().handleTextInputEvent("\t", event);
}
static bool executeInsertText(Frame* frame, Event*, EditorCommandSource, const String& value)
......@@ -975,32 +975,32 @@ static bool executeRemoveFormat(Frame* frame, Event*, EditorCommandSource, const
static bool executeScrollPageBackward(Frame* frame, Event*, EditorCommandSource, const String&)
{
return frame->eventHandler()->logicalScrollRecursively(ScrollBlockDirectionBackward, ScrollByPage);
return frame->eventHandler().logicalScrollRecursively(ScrollBlockDirectionBackward, ScrollByPage);
}
static bool executeScrollPageForward(Frame* frame, Event*, EditorCommandSource, const String&)
{
return frame->eventHandler()->logicalScrollRecursively(ScrollBlockDirectionForward, ScrollByPage);
return frame->eventHandler().logicalScrollRecursively(ScrollBlockDirectionForward, ScrollByPage);
}
static bool executeScrollLineUp(Frame* frame, Event*, EditorCommandSource, const String&)
{
return frame->eventHandler()->scrollRecursively(ScrollUp, ScrollByLine);
return frame->eventHandler().scrollRecursively(ScrollUp, ScrollByLine);
}
static bool executeScrollLineDown(Frame* frame, Event*, EditorCommandSource, const String&)
{
return frame->eventHandler()->scrollRecursively(ScrollDown, ScrollByLine);
return frame->eventHandler().scrollRecursively(ScrollDown, ScrollByLine);
}
static bool executeScrollToBeginningOfDocument(Frame* frame, Event*, EditorCommandSource, const String&)
{
return frame->eventHandler()->logicalScrollRecursively(ScrollBlockDirectionBackward, ScrollByDocument);
return frame->eventHandler().logicalScrollRecursively(ScrollBlockDirectionBackward, ScrollByDocument);
}
static bool executeScrollToEndOfDocument(Frame* frame, Event*, EditorCommandSource, const String&)
{
return frame->eventHandler()->logicalScrollRecursively(ScrollBlockDirectionForward, ScrollByDocument);
return frame->eventHandler().logicalScrollRecursively(ScrollBlockDirectionForward, ScrollByDocument);
}
static bool executeSelectAll(Frame* frame, Event*, EditorCommandSource, const String&)
......
......@@ -1720,7 +1720,7 @@ void FrameSelection::focusedOrActiveStateChanged()
setCaretVisibility(activeAndFocused ? Visible : Hidden);
// Update for caps lock state
m_frame->eventHandler()->capsLockStateMayHaveChanged();
m_frame->eventHandler().capsLockStateMayHaveChanged();
// Because StyleResolver::checkOneSelector() and
// RenderTheme::isFocused() check if the frame is active, we have to
......
......@@ -76,7 +76,7 @@ CachedFrameBase::CachedFrameBase(Frame* frame)
: m_document(frame->document())
, m_documentLoader(frame->loader().documentLoader())
, m_view(frame->view())
, m_mousePressNode(frame->eventHandler()->mousePressNode())
, m_mousePressNode(frame->eventHandler().mousePressNode())
, m_url(frame->document()->url())
, m_isMainFrame(!frame->tree()->parent())
#if USE(ACCELERATED_COMPOSITING)
......@@ -110,7 +110,7 @@ void CachedFrameBase::restore()
#endif
frame->animation()->resumeAnimationsForDocument(m_document.get());
frame->eventHandler()->setMousePressNode(m_mousePressNode.get());
frame->eventHandler().setMousePressNode(m_mousePressNode.get());
m_document->resumeActiveDOMObjects(ActiveDOMObject::DocumentWillBecomeInactive);
m_document->resumeScriptedAnimationControllerCallbacks();
......
......@@ -140,7 +140,7 @@ bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const
if (!document()->frame())
return false;
if (!document()->frame()->eventHandler()->tabsToLinks(event))
if (!document()->frame()->eventHandler().tabsToLinks(event))
return false;
if (isInCanvasSubtree())
......
......@@ -327,7 +327,7 @@ bool HTMLFormControlElement::isKeyboardFocusable(KeyboardEvent* event) const
{
if (isFocusable())
if (document()->frame())
return document()->frame()->eventHandler()->tabsToAllFormControls(event);
return document()->frame()->eventHandler().tabsToAllFormControls(event);
return false;
}
......
......@@ -99,7 +99,7 @@ void HTMLPlugInElement::detach(const AttachContext& context)
if (m_isCapturingMouseEvents) {
if (Frame* frame = document()->frame())
frame->eventHandler()->setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsNode(0);
m_isCapturingMouseEvents = false;
}
......
......@@ -1321,7 +1321,7 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event)
#endif
}
if (Frame* frame = document()->frame())
frame->eventHandler()->setMouseDownMayStartAutoscroll();
frame->eventHandler().setMouseDownMayStartAutoscroll();
event->setDefaultHandled();
}
......@@ -1349,7 +1349,7 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event)
}
event->setDefaultHandled();
}
} else if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton && document()->frame()->eventHandler()->autoscrollRenderer() != renderer()) {
} else if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton && document()->frame()->eventHandler().autoscrollRenderer() != renderer()) {
// This click or drag event was not over any of the options.
if (m_lastOnChangeSelection.isEmpty())
return;
......
......@@ -110,7 +110,7 @@ void MediaControlPanelElement::startDrag(const LayoutPoint& eventLocation)
m_lastDragEventLocation = eventLocation;
frame->eventHandler()->setCapturingMouseEventsNode(this);
frame->eventHandler().setCapturingMouseEventsNode(this);
m_isBeingDragged = true;
}
......@@ -137,7 +137,7 @@ void MediaControlPanelElement::endDrag()
if (!frame)
return;
frame->eventHandler()->setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsNode(0);
}
void MediaControlPanelElement::startTimer()
......
......@@ -130,7 +130,7 @@ void MediaControlEmbeddedPanelElement::startDrag(const LayoutPoint& eventLocatio
m_lastDragEventLocation = eventLocation;
frame->eventHandler()->setCapturingMouseEventsNode(this);
frame->eventHandler().setCapturingMouseEventsNode(this);
m_isBeingDragged = true;
}
......@@ -157,7 +157,7 @@ void MediaControlEmbeddedPanelElement::endDrag()
if (!frame)
return;
frame->eventHandler()->setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsNode(0);
}
void MediaControlEmbeddedPanelElement::startTimer()
......
......@@ -312,7 +312,7 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point)
void SliderThumbElement::startDragging()
{
if (Frame* frame = document()->frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(this);
frame->eventHandler().setCapturingMouseEventsNode(this);
m_inDragMode = true;
}
}
......@@ -323,7 +323,7 @@ void SliderThumbElement::stopDragging()
return;
if (Frame* frame = document()->frame())
frame->eventHandler()->setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsNode(0);
m_inDragMode = false;
if (renderer())
renderer()->setNeedsLayout(true);
......@@ -389,7 +389,7 @@ void SliderThumbElement::detach(const AttachContext& context)
{
if (m_inDragMode) {
if (Frame* frame = document()->frame())
frame->eventHandler()->setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsNode(0);
}
HTMLDivElement::detach(context);
}
......
......@@ -119,7 +119,7 @@ void SpinButtonElement::defaultEventHandler(Event* event)
if (box->pixelSnappedBorderBoxRect().contains(local)) {
if (!m_capturing) {
if (Frame* frame = document()->frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(this);
frame->eventHandler().setCapturingMouseEventsNode(this);
m_capturing = true;
if (Page* page = document()->page())
page->chrome().registerPopupOpeningObserver(this);
......@@ -195,7 +195,7 @@ void SpinButtonElement::releaseCapture()
stopRepeatingTimer();
if (m_capturing) {
if (Frame* frame = document()->frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsNode(0);
m_capturing = false;
if (Page* page = document()->page())
page->chrome().unregisterPopupOpeningObserver(this);
......
......@@ -199,7 +199,7 @@ void SearchFieldCancelButtonElement::detach(const AttachContext& context)
{
if (m_capturing) {
if (Frame* frame = document()->frame())
frame->eventHandler()->setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsNode(0);
}
HTMLDivElement::detach(context);
}
......@@ -218,7 +218,7 @@ void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (renderer() && renderer()->visibleToHitTesting()) {
if (Frame* frame = document()->frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(this);
frame->eventHandler().setCapturingMouseEventsNode(this);
m_capturing = true;
}
}
......@@ -229,7 +229,7 @@ void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (m_capturing) {
if (Frame* frame = document()->frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsNode(0);
m_capturing = false;
}
if (hovered()) {
......@@ -304,7 +304,7 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (renderer() && renderer()->visibleToHitTesting()) {
if (Frame* frame = document()->frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(this);
frame->eventHandler().setCapturingMouseEventsNode(this);
m_capturing = true;
}
}
......@@ -317,7 +317,7 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (m_capturing && renderer() && renderer()->visibleToHitTesting()) {
if (Frame* frame = document()->frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsNode(0);
m_capturing = false;
}
}
......@@ -416,7 +416,7 @@ void InputFieldSpeechButtonElement::detach(const AttachContext& context)
{
if (m_capturing) {
if (Frame* frame = document()->frame())
frame->eventHandler()->setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsNode(0);
}
if (m_listenerId) {
......
......@@ -90,7 +90,7 @@ void InspectorInputAgent::dispatchKeyEvent(ErrorString* error, const String& typ
isSystemKey ? *isSystemKey : false,
static_cast<PlatformEvent::Modifiers>(modifiers ? *modifiers : 0),
timestamp ? *timestamp : currentTime());
m_page->mainFrame()->eventHandler()->keyEvent(event);
m_page->mainFrame()->eventHandler().keyEvent(event);
}
void InspectorInputAgent::dispatchMouseEvent(ErrorString* error, const String& type, int x, int y, const int* modifiers, const double* timestamp, const String* button, const int* clickCount)
......@@ -140,16 +140,16 @@ void InspectorInputAgent::dispatchMouseEvent(ErrorString* error, const String& t
convertedModifiers & PlatformEvent::MetaKey,
timestamp ? *timestamp : currentTime());
EventHandler* handler = m_page->mainFrame()->eventHandler();
EventHandler& eventHandler = m_page->mainFrame()->eventHandler();
switch (convertedType) {
case PlatformEvent::MousePressed:
handler->handleMousePressEvent(event);
eventHandler.handleMousePressEvent(event);
break;
case PlatformEvent::MouseReleased:
handler->handleMouseReleaseEvent(event);
eventHandler.handleMouseReleaseEvent(event);
break;
case PlatformEvent::MouseMoved:
handler->handleMouseMoveEvent(event);
eventHandler.handleMouseMoveEvent(event);
break;
default:
*error = "Unhandled type: " + type;
......
......@@ -591,7 +591,7 @@ void FrameLoader::clear(Document* newDocument, bool clearWindowProperties, bool
}
m_frame->selection()->prepareForDestruction();
m_frame->eventHandler()->clear();
m_frame->eventHandler().clear();
if (clearFrameView && m_frame->view())
m_frame->view()->clear();
......@@ -1049,7 +1049,7 @@ void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip
// If we were in the autoscroll/panScroll mode we want to stop it before following the link to the anchor
if (hashChange)
m_frame->eventHandler()->stopAutoscrollTimer();
m_frame->eventHandler().stopAutoscrollTimer();
// It's important to model this as a load that starts and immediately finishes.
// Otherwise, the parent frame may think we never finished loading.
......
......@@ -96,10 +96,9 @@ void AutoscrollController::stopAutoscrollTimer(bool rendererIsBeingDestroyed)
return;
Frame* frame = scrollable->frame();
EventHandler* eventHandler = frame->eventHandler();
if (autoscrollInProgress() && eventHandler->mouseDownWasInSubframe()) {
if (Frame* subframe = eventHandler->subframeForTargetNode(eventHandler->mousePressNode()))
subframe->eventHandler()->stopAutoscrollTimer(rendererIsBeingDestroyed);
if (autoscrollInProgress() && frame->eventHandler().mouseDownWasInSubframe()) {
if (Frame* subframe = frame->eventHandler().subframeForTargetNode(frame->eventHandler().mousePressNode()))
subframe->eventHandler().stopAutoscrollTimer(rendererIsBeingDestroyed);
return;
}
......@@ -120,7 +119,7 @@ void AutoscrollController::stopAutoscrollTimer(bool rendererIsBeingDestroyed)
// If we're not in the top frame we notify it that we are not doing a panScroll any more.
if (Frame* mainFrame = getMainFrame(frame)) {
if (frame != mainFrame)
mainFrame->eventHandler()->didPanScrollStop();
mainFrame->eventHandler().didPanScrollStop();
}
#endif
}
......@@ -133,7 +132,7 @@ void AutoscrollController::updateAutoscrollRenderer()
RenderObject* renderer = m_autoscrollRenderer;
#if ENABLE(PAN_SCROLLING)
HitTestResult hitTest = m_autoscrollRenderer->frame()->eventHandler()->hitTestResultAtPoint(m_panScrollStartPos, HitTestRequest::ReadOnly | HitTestRequest::Active);
HitTestResult hitTest = m_autoscrollRenderer->frame()->eventHandler().hitTestResultAtPoint(m_panScrollStartPos, HitTestRequest::ReadOnly | HitTestRequest::Active);
if (Node* nodeAtPoint = hitTest.innerNode())
renderer = nodeAtPoint->renderer();
......@@ -229,7 +228,7 @@ void AutoscrollController::startPanScrolling(RenderBox* scrollable, const IntPoi
if (FrameView* view = scrollable->frame()->view())
view->addPanScrollIcon(lastKnownMousePosition);
scrollable->frame()->eventHandler()->didPanScrollStart();
scrollable->frame()->eventHandler().didPanScrollStart();
startAutoscrollTimer();
}
#else
......@@ -253,15 +252,14 @@ void AutoscrollController::autoscrollTimerFired(Timer<AutoscrollController>*)
m_autoscrollRenderer->autoscroll(m_dragAndDropAutoscrollReferencePosition);
break;
case AutoscrollForSelection: {
EventHandler* eventHandler = frame->eventHandler();
if (!eventHandler->mousePressed()) {
if (!frame->eventHandler().mousePressed()) {
stopAutoscrollTimer();
return;
}
#if ENABLE(DRAG_SUPPORT)
eventHandler->updateSelectionForMouseDrag();
frame->eventHandler().updateSelectionForMouseDrag();
#endif
m_autoscrollRenderer->autoscroll(eventHandler->lastKnownMousePosition());
m_autoscrollRenderer->autoscroll(frame->eventHandler().lastKnownMousePosition());
break;
}
case NoAutoscroll:
......@@ -271,13 +269,13 @@ void AutoscrollController::autoscrollTimerFired(Timer<AutoscrollController>*)
case AutoscrollForPan:
// we verify that the main frame hasn't received the order to stop the panScroll
if (Frame* mainFrame = getMainFrame(frame)) {
if (!mainFrame->eventHandler()->panScrollInProgress()) {
if (!mainFrame->eventHandler().panScrollInProgress()) {
stopAutoscrollTimer();
return;
}
}
if (FrameView* view = frame->view())
updatePanScrollState(view, frame->eventHandler()->lastKnownMousePosition());
updatePanScrollState(view, frame->eventHandler().lastKnownMousePosition());
m_autoscrollRenderer->panScroll(m_panScrollStartPos);
break;
#endif
......
......@@ -152,7 +152,7 @@ PassOwnPtr<ContextMenu> ContextMenuController::createContextMenu(Event* event)
HitTestResult result(mouseEvent->absoluteLocation());
if (Frame* frame = event->target()->toNode()->document()->frame())
result = frame->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation());
result = frame->eventHandler().hitTestResultAtPoint(mouseEvent->absoluteLocation());
if (!result.innerNonSharedNode())
return nullptr;
......@@ -1445,7 +1445,7 @@ void ContextMenuController::showContextMenuAt(Frame* frame, const IntPoint& clic
{
// Simulate a click in the middle of the accessibility object.
PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime());
bool handled = frame->eventHandler()->sendContextMenuEvent(mouseEvent);
bool handled = frame->eventHandler().sendContextMenuEvent(mouseEvent);
if (handled && client())
client()->showContextMenu();
}
......
......@@ -943,7 +943,7 @@ void DOMWindow::focus(ScriptExecutionContext* context)
if (focusedFrame && focusedFrame != m_frame)
focusedFrame->document()->setFocusedElement(0);
m_frame->eventHandler()->focusDocumentView();
m_frame->eventHandler().focusDocumentView();
}
void DOMWindow::blur()
......@@ -1486,7 +1486,7 @@ bool DOMWindow::allowedToChangeWindowGeometry() const
if (m_frame != page->mainFrame())
return false;
// Prevent web content from tricking the user into initiating a drag.
if (m_frame->eventHandler()->mousePressed())
if (m_frame->eventHandler().mousePressed())
return false;
return true;
}
......
......@@ -197,7 +197,7 @@ void DragController::dragExited(DragData* dragData)
ClipboardAccessPolicy policy = (!m_documentUnderMouse || m_documentUnderMouse->securityOrigin()->isLocal()) ? ClipboardReadable : ClipboardTypesReadable;
RefPtr<Clipboard> clipboard = Clipboard::create(policy, dragData, mainFrame);
clipboard->setSourceOperation(dragData->draggingSourceOperationMask());
mainFrame->eventHandler()->cancelDragAndDrop(createMouseEvent(dragData), clipboard.get());
mainFrame->eventHandler().cancelDragAndDrop(createMouseEvent(dragData), clipboard.get());
clipboard->setAccessPolicy(ClipboardNumb); // invalidate clipboard here for security
}
mouseMovedIntoDocument(0);
......@@ -223,7 +223,7 @@ bool DragController::performDrag(DragData* dragData)
// Sending an event can result in the destruction of the view and part.
RefPtr<Clipboard> clipboard = Clipboard::create(ClipboardReadable, dragData, mainFrame.get());
clipboard->setSourceOperation(dragData->draggingSourceOperationMask());
preventedDefault = mainFrame->eventHandler()->performDragAndDrop(createMouseEvent(dragData), clipboard.get());
preventedDefault = mainFrame->eventHandler().performDragAndDrop(createMouseEvent(dragData), clipboard.get());
clipboard->setAccessPolicy(ClipboardNumb); // Invalidate clipboard here for security
}
if (preventedDefault) {
......@@ -545,7 +545,7 @@ bool DragController::concludeEditDrag(DragData* dragData)
if (rootEditableElement) {
if (Frame* frame = rootEditableElement->document()->frame())
frame->eventHandler()->updateDragStateAfterEditDragIfNeeded(rootEditableElement.get());
frame->eventHandler().updateDragStateAfterEditDragIfNeeded(rootEditableElement.get());
}
return true;
......@@ -563,7 +563,7 @@ bool DragController::canProcessDrag(DragData* dragData)
if (!m_page->mainFrame()->contentRenderer())
return false;
result = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(point, HitTestRequest::ReadOnly | HitTestRequest::Active);
result = m_page->mainFrame()->eventHandler().hitTestResultAtPoint(point, HitTestRequest::ReadOnly | HitTestRequest::Active);
if (!result.innerNonSharedNode())
return false;
......@@ -618,7 +618,7 @@ bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation)
clipboard->setSourceOperation(srcOpMask);
PlatformMouseEvent event = createMouseEvent(dragData);
if (!mainFrame->eventHandler()->updateDragAndDrop(event, clipboard.get())) {
if (!mainFrame->eventHandler().updateDragAndDrop(event, clipboard.get())) {
clipboard->setAccessPolicy(ClipboardNumb); // invalidate clipboard here for security
return false;
}
......@@ -746,7 +746,7 @@ bool DragController::startDrag(Frame* src, const DragState& state, DragOperation
if (!src->view() || !src->contentRenderer())
return false;
HitTestResult hitTestResult = src->eventHandler()->hitTestResultAtPoint(dragOrigin, HitTestRequest::ReadOnly | HitTestRequest::Active);
HitTestResult hitTestResult = src->eventHandler().hitTestResultAtPoint(dragOrigin, HitTestRequest::ReadOnly | HitTestRequest::Active);
if (!state.source->contains(hitTestResult.innerNode()))
// The original node being dragged isn't under the drag origin anymore... maybe it was
// hidden or moved out from under the cursor. Regardless, we don't want to start a drag on
......
......@@ -1040,7 +1040,7 @@ HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTe
FrameView* mainView = mainFrame->view();
if (frameView && mainView) {
IntPoint mainFramePoint = mainView->rootViewToContents(frameView->contentsToRootView(roundedIntPoint(point)));
return mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, hitType, padding);
return mainFrame->eventHandler().hitTestResultAtPoint(mainFramePoint, hitType, padding);
}
}
}
......@@ -1133,7 +1133,7 @@ bool EventHandler::scrollRecursively(ScrollDirection direction, ScrollGranularit
frame = frame->tree()->parent();
if (!frame)
return false;
return frame->eventHandler()->scrollRecursively(direction, granularity, m_frame->ownerElement());
return frame->eventHandler().scrollRecursively(direction, granularity, m_frame->ownerElement());
}
bool EventHandler::logicalScrollRecursively(ScrollLogicalDirection direction, ScrollGranularity granularity, Node* startingNode)
......@@ -1162,7 +1162,7 @@ bool EventHandler::logicalScrollRecursively(ScrollLogicalDirection direction, Sc
if (!frame)