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

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

Issue 207143002: Make FrameTree::uniqueName() more unique. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use name() instead of uniqueName() for find() Created 6 years, 9 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/FrameTree.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/FrameTree.cpp
diff --git a/Source/core/page/FrameTree.cpp b/Source/core/page/FrameTree.cpp
index eb283341c28667bb661977067de491ae0abcf974..ba484fed8f5815e721338fb61f635661cfb2fd31 100644
--- a/Source/core/page/FrameTree.cpp
+++ b/Source/core/page/FrameTree.cpp
@@ -116,9 +116,18 @@ LocalFrame* FrameTree::lastChild() const
return toLocalFrame(m_thisFrame->loader().client()->lastChild());
}
+bool FrameTree::uniqueNameExists(const AtomicString& name) const
+{
+ for (LocalFrame* frame = top(); frame; frame = frame->tree().traverseNext()) {
+ if (frame->tree().uniqueName() == name)
+ return true;
+ }
+ return false;
+}
+
AtomicString FrameTree::uniqueChildName(const AtomicString& requestedName) const
{
- if (!requestedName.isEmpty() && !child(requestedName) && requestedName != "_blank")
+ if (!requestedName.isEmpty() && !uniqueNameExists(requestedName) && requestedName != "_blank")
return requestedName;
// Create a repeatable name for a child about to be added to us. The name must be
@@ -184,7 +193,7 @@ LocalFrame* FrameTree::scopedChild(const AtomicString& name) const
return 0;
for (LocalFrame* child = firstChild(); child; child = child->tree().nextSibling())
- if (child->tree().uniqueName() == name && child->inScope(scope))
+ if (child->tree().name() == name && child->inScope(scope))
return child;
return 0;
}
@@ -226,7 +235,7 @@ unsigned FrameTree::childCount() const
LocalFrame* FrameTree::child(const AtomicString& name) const
{
for (LocalFrame* child = firstChild(); child; child = child->tree().nextSibling())
- if (child->tree().uniqueName() == name)
+ if (child->tree().name() == name)
return child;
return 0;
}
@@ -248,7 +257,7 @@ LocalFrame* FrameTree::find(const AtomicString& name) const
// Search subtree starting with this frame first.
for (LocalFrame* frame = m_thisFrame; frame; frame = frame->tree().traverseNext(m_thisFrame))
- if (frame->tree().uniqueName() == name)
+ if (frame->tree().name() == name)
return frame;
// Search the entire tree for this page next.
@@ -259,7 +268,7 @@ LocalFrame* FrameTree::find(const AtomicString& name) const
return 0;
for (LocalFrame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext())
- if (frame->tree().uniqueName() == name)
+ if (frame->tree().name() == name)
return frame;
// Search the entire tree of each of the other pages in this namespace.
@@ -270,7 +279,7 @@ LocalFrame* FrameTree::find(const AtomicString& name) const
Page* otherPage = *it;
if (otherPage != page) {
for (LocalFrame* frame = otherPage->mainFrame(); frame; frame = frame->tree().traverseNext()) {
- if (frame->tree().uniqueName() == name)
+ if (frame->tree().name() == name)
return frame;
}
}
« no previous file with comments | « Source/core/page/FrameTree.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698