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

Unified Diff: Source/core/dom/TreeScope.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/dom/Text.cpp ('k') | Source/core/dom/shadow/ElementShadow.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/TreeScope.cpp
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp
index 2a4ae34d451d0f4b3edbfbf52125d305788956ba..6e7682c3c091dd630ed8383f8feae281b63632c4 100644
--- a/Source/core/dom/TreeScope.cpp
+++ b/Source/core/dom/TreeScope.cpp
@@ -209,7 +209,7 @@ HTMLMapElement* TreeScope::getImageMap(const String& url) const
return 0;
size_t hashPos = url.find('#');
String name = (hashPos == notFound ? url : url.substring(hashPos + 1)).impl();
- if (rootNode()->document()->isHTMLDocument())
+ if (rootNode()->document().isHTMLDocument())
return toHTMLMapElement(m_imageMapsByName->getElementByLowercasedMapName(AtomicString(name.lower()).impl(), this));
return toHTMLMapElement(m_imageMapsByName->getElementByMapName(AtomicString(name).impl(), this));
}
@@ -242,7 +242,7 @@ Node* nodeFromPoint(Document* document, int x, int y, LayoutPoint* localPoint)
Element* TreeScope::elementFromPoint(int x, int y) const
{
- Node* node = nodeFromPoint(rootNode()->document(), x, y);
+ Node* node = nodeFromPoint(&rootNode()->document(), x, y);
if (node && node->isTextNode())
node = node->parentNode();
ASSERT(!node || node->isElementNode() || node->isShadowRoot());
@@ -287,7 +287,7 @@ HTMLLabelElement* TreeScope::labelElementForId(const AtomicString& forAttributeV
DOMSelection* TreeScope::getSelection() const
{
- if (!rootNode()->document()->frame())
+ if (!rootNode()->document().frame())
return 0;
if (m_selection)
@@ -309,7 +309,7 @@ Element* TreeScope::findAnchor(const String& name)
for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::next(element)) {
if (isHTMLAnchorElement(element)) {
HTMLAnchorElement* anchor = toHTMLAnchorElement(element);
- if (rootNode()->document()->inQuirksMode()) {
+ if (rootNode()->document().inQuirksMode()) {
// Quirks mode, case insensitive comparison of names.
if (equalIgnoringCase(anchor->name(), name))
return anchor;
@@ -350,10 +350,10 @@ static Element* focusedFrameOwnerElement(Frame* focusedFrame, Frame* currentFram
Element* TreeScope::adjustedFocusedElement()
{
- Document* document = rootNode()->document();
- Element* element = document->focusedElement();
- if (!element && document->page())
- element = focusedFrameOwnerElement(document->page()->focusController().focusedFrame(), document->frame());
+ Document& document = rootNode()->document();
+ Element* element = document.focusedElement();
+ if (!element && document.page())
+ element = focusedFrameOwnerElement(document.page()->focusController().focusedFrame(), document.frame());
if (!element)
return 0;
Vector<Node*> targetStack;
« no previous file with comments | « Source/core/dom/Text.cpp ('k') | Source/core/dom/shadow/ElementShadow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698