Commit 9044cf36 authored by akling@apple.com's avatar akling@apple.com

EventHandler::m_frame should be a Frame&.

<https://webkit.org/b/120580>

Reviewed by Darin Adler.

EventHandler is tied to the lifetime of its frame, so let m_frame be a Frame&.
A handful of null checks and assertions removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154947 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8174b98e
2013-09-01 Andreas Kling <akling@apple.com>
EventHandler::m_frame should be a Frame&.
<https://webkit.org/b/120580>
Reviewed by Darin Adler.
EventHandler is tied to the lifetime of its frame, so let m_frame be a Frame&.
A handful of null checks and assertions removed.
2013-09-01 Darin Adler <darin@apple.com>
Fix a mistake in my recent pasteboard/editor refactoring that was causing tests to fail.
This diff is collapsed.
/*
* Copyright (C) 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2006, 2007, 2009, 2010, 2011, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -101,7 +101,7 @@ enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis };
class EventHandler {
WTF_MAKE_NONCOPYABLE(EventHandler);
public:
explicit EventHandler(Frame*);
explicit EventHandler(Frame&);
~EventHandler();
void clear();
......@@ -409,7 +409,7 @@ private:
void autoHideCursorTimerFired(Timer<EventHandler>*);
#endif
Frame* m_frame;
Frame& m_frame;
bool m_mousePressed;
bool m_capturesDragging;
......
......@@ -160,7 +160,7 @@ inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoader
, m_script(adoptPtr(new ScriptController(this)))
, m_editor(Editor::create(*this))
, m_selection(adoptPtr(new FrameSelection(this)))
, m_eventHandler(adoptPtr(new EventHandler(this)))
, m_eventHandler(adoptPtr(new EventHandler(*this)))
, m_animationController(adoptPtr(new AnimationController(this)))
, m_pageZoomFactor(parentPageZoomFactor(this))
, m_textZoomFactor(parentTextZoomFactor(this))
......
......@@ -56,8 +56,8 @@ bool EventHandler::tabsToAllFormControls(KeyboardEvent*) const
void EventHandler::focusDocumentView()
{
if (Page* page = m_frame->page())
page->focusController().setFocusedFrame(m_frame);
if (Page* page = m_frame.page())
page->focusController().setFocusedFrame(&m_frame);
}
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
......
......@@ -52,8 +52,8 @@ bool EventHandler::tabsToAllFormControls(KeyboardEvent* event) const
void EventHandler::focusDocumentView()
{
if (Page* page = m_frame->page())
page->focusController().setFocusedFrame(m_frame);
if (Page* page = m_frame.page())
page->focusController().setFocusedFrame(&m_frame);
}
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
......
......@@ -99,7 +99,7 @@ inline CurrentEventScope::~CurrentEventScope()
bool EventHandler::wheelEvent(NSEvent *event)
{
Page* page = m_frame->page();
Page* page = m_frame.page();
if (!page)
return false;
......@@ -123,16 +123,16 @@ bool EventHandler::keyEvent(NSEvent *event)
void EventHandler::focusDocumentView()
{
Page* page = m_frame->page();
Page* page = m_frame.page();
if (!page)
return;
if (FrameView* frameView = m_frame->view()) {
if (FrameView* frameView = m_frame.view()) {
if (NSView *documentView = frameView->documentView())
page->chrome().focusNSView(documentView);
}
page->focusController().setFocusedFrame(m_frame);
page->focusController().setFocusedFrame(&m_frame);
}
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
......@@ -199,7 +199,7 @@ bool EventHandler::passMouseDownEventToWidget(Widget* pWidget)
return true;
}
Page* page = m_frame->page();
Page* page = m_frame.page();
if (!page)
return true;
......@@ -278,7 +278,7 @@ NSView *EventHandler::mouseDownViewIfStillGood()
if (!mouseDownView) {
return nil;
}
FrameView* topFrameView = m_frame->view();
FrameView* topFrameView = m_frame.view();
NSView *topView = topFrameView ? topFrameView->platformWidget() : nil;
if (!topView || !findViewInSubviews(topView, mouseDownView)) {
m_mouseDownView = nil;
......@@ -461,7 +461,7 @@ bool EventHandler::passWheelEventToWidget(const PlatformWheelEvent& wheelEvent,
void EventHandler::mouseDown(NSEvent *event)
{
FrameView* v = m_frame->view();
FrameView* v = m_frame.view();
if (!v || m_sendingEventToSubview)
return;
......@@ -478,7 +478,7 @@ void EventHandler::mouseDown(NSEvent *event)
void EventHandler::mouseDragged(NSEvent *event)
{
FrameView* v = m_frame->view();
FrameView* v = m_frame.view();
if (!v || m_sendingEventToSubview)
return;
......@@ -492,7 +492,7 @@ void EventHandler::mouseDragged(NSEvent *event)
void EventHandler::mouseUp(NSEvent *event)
{
FrameView* v = m_frame->view();
FrameView* v = m_frame.view();
if (!v || m_sendingEventToSubview)
return;
......@@ -529,7 +529,7 @@ void EventHandler::mouseUp(NSEvent *event)
*/
void EventHandler::sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent)
{
FrameView* view = m_frame->view();
FrameView* view = m_frame.view();
if (!view)
return;
......@@ -586,7 +586,7 @@ void EventHandler::mouseMoved(NSEvent *event)
{
// Reject a mouse moved if the button is down - screws up tracking during autoscroll
// These happen because WebKit sometimes has to fake up moved events.
if (!m_frame->view() || m_mousePressed || m_sendingEventToSubview)
if (!m_frame.view() || m_mousePressed || m_sendingEventToSubview)
return;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
......@@ -599,7 +599,7 @@ void EventHandler::passMouseMovedEventToScrollbars(NSEvent *event)
{
// Reject a mouse moved if the button is down - screws up tracking during autoscroll
// These happen because WebKit sometimes has to fake up moved events.
if (!m_frame->view() || m_mousePressed || m_sendingEventToSubview)
if (!m_frame.view() || m_mousePressed || m_sendingEventToSubview)
return;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
......@@ -608,9 +608,9 @@ void EventHandler::passMouseMovedEventToScrollbars(NSEvent *event)
END_BLOCK_OBJC_EXCEPTIONS;
}
static bool frameHasPlatformWidget(Frame* frame)
static bool frameHasPlatformWidget(const Frame& frame)
{
if (FrameView* frameView = frame->view()) {
if (FrameView* frameView = frame.view()) {
if (frameView->platformWidget())
return true;
}
......@@ -659,7 +659,7 @@ bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults&
PlatformMouseEvent EventHandler::currentPlatformMouseEvent() const
{
NSView *windowView = nil;
if (Page* page = m_frame->page())
if (Page* page = m_frame.page())
windowView = page->chrome().platformPageClient();
return PlatformEventFactory::createPlatformMouseEvent(currentNSEvent(), windowView);
}
......@@ -684,7 +684,7 @@ PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
bool EventHandler::tabsToAllFormControls(KeyboardEvent* event) const
{
Page* page = m_frame->page();
Page* page = m_frame.page();
if (!page)
return false;
......@@ -709,11 +709,11 @@ bool EventHandler::tabsToAllFormControls(KeyboardEvent* event) const
bool EventHandler::needsKeyboardEventDisambiguationQuirks() const
{
#if ENABLE(DASHBOARD_SUPPORT)
if (m_frame->settings().usesDashboardBackwardCompatibilityMode())
if (m_frame.settings().usesDashboardBackwardCompatibilityMode())
return true;
#endif
if (m_frame->settings().needsKeyboardEventDisambiguationQuirks())
if (m_frame.settings().needsKeyboardEventDisambiguationQuirks())
return true;
return false;
......
......@@ -65,10 +65,10 @@ bool EventHandler::tabsToAllFormControls(KeyboardEvent* event) const
void EventHandler::focusDocumentView()
{
Page* page = m_frame->page();
Page* page = m_frame.page();
if (!page)
return;
page->focusController().setFocusedFrame(m_frame);
page->focusController().setFocusedFrame(&m_frame);
}
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults&)
......
......@@ -104,10 +104,10 @@ PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
void EventHandler::focusDocumentView()
{
Page* page = m_frame->page();
Page* page = m_frame.page();
if (!page)
return;
page->focusController().setFocusedFrame(m_frame);
page->focusController().setFocusedFrame(&m_frame);
}
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults&)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment