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

Unified Diff: Source/core/page/DOMSelection.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/ContextMenuController.cpp ('k') | Source/core/page/DragController.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/DOMSelection.cpp
diff --git a/Source/core/page/DOMSelection.cpp b/Source/core/page/DOMSelection.cpp
index 2bc803c05bb1612a3fe270c66354e2c65505ef97..b9a85af24cfe6f56e28b1b74f090f1bb6e1b0261 100644
--- a/Source/core/page/DOMSelection.cpp
+++ b/Source/core/page/DOMSelection.cpp
@@ -60,7 +60,7 @@ static Node* selectionShadowAncestor(Frame* frame)
}
DOMSelection::DOMSelection(const TreeScope* treeScope)
- : DOMWindowProperty(treeScope->rootNode()->document()->frame())
+ : DOMWindowProperty(treeScope->rootNode()->document().frame())
, m_treeScope(treeScope)
{
ScriptWrappable::init(this);
@@ -381,7 +381,7 @@ PassRefPtr<Range> DOMSelection::getRangeAt(int index, ExceptionState& es)
if (Node* shadowAncestor = selectionShadowAncestor(m_frame)) {
ContainerNode* container = shadowAncestor->parentNodeGuaranteedHostFree();
int offset = shadowAncestor->nodeIndex();
- return Range::create(shadowAncestor->document(), container, offset, container, offset);
+ return Range::create(&shadowAncestor->document(), container, offset, container, offset);
}
const VisibleSelection& selection = m_frame->selection()->selection();
@@ -463,7 +463,7 @@ bool DOMSelection::containsNode(const Node* n, bool allowPartial) const
FrameSelection* selection = m_frame->selection();
- if (!n || m_frame->document() != n->document() || selection->isNone())
+ if (!n || m_frame->document() != &n->document() || selection->isNone())
return false;
unsigned nodeIndex = n->nodeIndex();
@@ -545,7 +545,7 @@ bool DOMSelection::isValidForPosition(Node* node) const
ASSERT(m_frame);
if (!node)
return true;
- return node->document() == m_frame->document();
+ return &node->document() == m_frame->document();
}
} // namespace WebCore
« no previous file with comments | « Source/core/page/ContextMenuController.cpp ('k') | Source/core/page/DragController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698