Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(738)

Unified Diff: Source/core/dom/WheelController.cpp

Issue 171333003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/WheelController.cpp
diff --git a/Source/core/dom/WheelController.cpp b/Source/core/dom/WheelController.cpp
index 68d5b18b2e5076f8afa0212cca5321b5aba27e0a..132445e94c29bb55cb28a28d524e6dd6f7cd5cb9 100644
--- a/Source/core/dom/WheelController.cpp
+++ b/Source/core/dom/WheelController.cpp
@@ -35,8 +35,8 @@
namespace WebCore {
-WheelController::WheelController(Document* document)
- : DOMWindowLifecycleObserver(document->domWindow())
+WheelController::WheelController(Document& document)
+ : DOMWindowLifecycleObserver(document.domWindow())
, m_wheelEventHandlerCount(0)
{
}
@@ -50,7 +50,7 @@ const char* WheelController::supplementName()
return "WheelController";
}
-WheelController* WheelController::from(Document* document)
+WheelController* WheelController::from(Document& document)
{
WheelController* controller = static_cast<WheelController*>(DocumentSupplement::from(document, supplementName()));
if (!controller) {
@@ -60,9 +60,9 @@ WheelController* WheelController::from(Document* document)
return controller;
}
-static void wheelEventHandlerCountChanged(Document* document)
+static void wheelEventHandlerCountChanged(Document& document)
{
- Page* page = document->page();
+ Page* page = document.page();
if (!page)
return;
@@ -70,17 +70,17 @@ static void wheelEventHandlerCountChanged(Document* document)
if (!scrollingCoordinator)
return;
- FrameView* frameView = document->view();
+ FrameView* frameView = document.view();
if (!frameView)
return;
scrollingCoordinator->frameViewWheelEventHandlerCountChanged(frameView);
}
-void WheelController::didAddWheelEventHandler(Document* document)
+void WheelController::didAddWheelEventHandler(Document& document)
{
++m_wheelEventHandlerCount;
- Page* page = document->page();
+ Page* page = document.page();
Frame* mainFrame = page ? page->mainFrame() : 0;
if (mainFrame)
mainFrame->notifyChromeClientWheelEventHandlerCountChanged();
@@ -88,11 +88,11 @@ void WheelController::didAddWheelEventHandler(Document* document)
wheelEventHandlerCountChanged(document);
}
-void WheelController::didRemoveWheelEventHandler(Document* document)
+void WheelController::didRemoveWheelEventHandler(Document& document)
{
ASSERT(m_wheelEventHandlerCount > 0);
--m_wheelEventHandlerCount;
- Page* page = document->page();
+ Page* page = document.page();
Frame* mainFrame = page ? page->mainFrame() : 0;
if (mainFrame)
mainFrame->notifyChromeClientWheelEventHandlerCountChanged();
@@ -106,7 +106,8 @@ void WheelController::didAddEventListener(DOMWindow* window, const AtomicString&
return;
Document* document = window->document();
- didAddWheelEventHandler(document);
+ ASSERT(document);
+ didAddWheelEventHandler(*document);
}
void WheelController::didRemoveEventListener(DOMWindow* window, const AtomicString& eventType)
@@ -115,7 +116,8 @@ void WheelController::didRemoveEventListener(DOMWindow* window, const AtomicStri
return;
Document* document = window->document();
- didRemoveWheelEventHandler(document);
+ ASSERT(document);
+ didRemoveWheelEventHandler(*document);
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698