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

Unified Diff: Source/core/page/EventHandler.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 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
« no previous file with comments | « Source/core/page/DragController.cpp ('k') | Source/core/page/FocusController.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index 1ef1a33c29ebc469d93dc881d65b2fc87697d612..e03826eec5bf1a0a4d5d01af886bbaa55c9bd788 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -444,7 +444,7 @@ void EventHandler::selectClosestMisspellingFromHitTestResult(const HitTestResult
Position start = pos.deepEquivalent();
Position end = pos.deepEquivalent();
if (pos.isNotNull()) {
- Vector<DocumentMarker*> markers = innerNode->document()->markers()->markersInRange(
+ Vector<DocumentMarker*> markers = innerNode->document().markers()->markersInRange(
makeRange(pos, pos).get(), DocumentMarker::Spelling | DocumentMarker::Grammar);
if (markers.size() == 1) {
start.moveToOffset(markers[0]->startOffset());
@@ -533,8 +533,8 @@ bool EventHandler::handleMousePressEventTripleClick(const MouseEventWithHitTestR
static int textDistance(const Position& start, const Position& end)
{
- RefPtr<Range> range = Range::create(start.anchorNode()->document(), start, end);
- return TextIterator::rangeLength(range.get(), true);
+ RefPtr<Range> range = Range::create(&start.anchorNode()->document(), start, end);
+ return TextIterator::rangeLength(range.get(), true);
}
bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestResults& event)
@@ -1965,9 +1965,9 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
RenderLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get());
Page* page = m_frame->page();
- if (m_lastNodeUnderMouse && (!m_nodeUnderMouse || m_nodeUnderMouse->document() != m_frame->document())) {
+ if (m_lastNodeUnderMouse && (!m_nodeUnderMouse || &m_nodeUnderMouse->document() != m_frame->document())) {
// The mouse has moved between frames.
- if (Frame* frame = m_lastNodeUnderMouse->document()->frame()) {
+ if (Frame* frame = m_lastNodeUnderMouse->document().frame()) {
if (FrameView* frameView = frame->view())
frameView->mouseExitedContentArea();
}
@@ -1977,9 +1977,9 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
scrollableAreaForLastNode->mouseExitedContentArea();
}
- if (m_nodeUnderMouse && (!m_lastNodeUnderMouse || m_lastNodeUnderMouse->document() != m_frame->document())) {
+ if (m_nodeUnderMouse && (!m_lastNodeUnderMouse || &m_lastNodeUnderMouse->document() != m_frame->document())) {
// The mouse has moved between frames.
- if (Frame* frame = m_nodeUnderMouse->document()->frame()) {
+ if (Frame* frame = m_nodeUnderMouse->document().frame()) {
if (FrameView* frameView = frame->view())
frameView->mouseEnteredContentArea();
}
@@ -1989,7 +1989,7 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
scrollableAreaForNodeUnderMouse->mouseEnteredContentArea();
}
- if (m_lastNodeUnderMouse && m_lastNodeUnderMouse->document() != m_frame->document()) {
+ if (m_lastNodeUnderMouse && &m_lastNodeUnderMouse->document() != m_frame->document()) {
m_lastNodeUnderMouse = 0;
m_lastScrollbarUnderMouse = 0;
m_lastInstanceUnderMouse = 0;
@@ -3636,13 +3636,13 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
if (node->isTextNode())
node = EventPathWalker::parent(node);
- Document* doc = node->document();
+ Document& doc = node->document();
// Record the originating touch document even if it does not have a touch listener.
if (freshTouchEvents) {
- m_originatingTouchPointDocument = doc;
+ m_originatingTouchPointDocument = &doc;
freshTouchEvents = false;
}
- if (!doc->hasTouchEventHandlers())
+ if (!doc.hasTouchEventHandlers())
continue;
m_originatingTouchPointTargets.set(touchPointTargetKey, node);
touchTarget = node;
@@ -3664,10 +3664,10 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
if (!touchTarget.get())
continue;
- Document* doc = touchTarget->toNode()->document();
- if (!doc->hasTouchEventHandlers())
+ Document& doc = touchTarget->toNode()->document();
+ if (!doc.hasTouchEventHandlers())
continue;
- Frame* targetFrame = doc->frame();
+ Frame* targetFrame = doc.frame();
if (!targetFrame)
continue;
@@ -3736,7 +3736,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
RefPtr<TouchEvent> touchEvent =
TouchEvent::create(effectiveTouches.get(), targetTouches.get(), changedTouches[state].m_touches.get(),
- stateName, touchEventTarget->toNode()->document()->defaultView(),
+ stateName, touchEventTarget->toNode()->document().defaultView(),
0, 0, 0, 0, event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey());
touchEventTarget->toNode()->dispatchTouchEvent(touchEvent.get());
swallowedEvent = swallowedEvent || touchEvent->defaultPrevented() || touchEvent->defaultHandled();
« no previous file with comments | « Source/core/page/DragController.cpp ('k') | Source/core/page/FocusController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698