Chromium Code Reviews| Index: third_party/WebKit/Source/core/page/FrameTree.cpp |
| diff --git a/third_party/WebKit/Source/core/page/FrameTree.cpp b/third_party/WebKit/Source/core/page/FrameTree.cpp |
| index a4816ad06203d02d9e3da21a00efa598bef03ea6..2d8e357331c0b0fd3f4784fe37b7bf42e046fb27 100644 |
| --- a/third_party/WebKit/Source/core/page/FrameTree.cpp |
| +++ b/third_party/WebKit/Source/core/page/FrameTree.cpp |
| @@ -59,7 +59,7 @@ void FrameTree::setName(const AtomicString& name, const AtomicString& fallbackNa |
| return; |
| } |
| m_uniqueName = AtomicString(); // Remove our old frame name so it's not considered in uniqueChildName. |
|
alexmos
2016/02/10 00:46:46
Update function name in comment?
Łukasz Anforowicz
2016/02/10 22:10:51
Ooops - thanks for catching this. Done.
|
| - m_uniqueName = parent()->tree().uniqueChildName(name.isEmpty() ? fallbackName : name); |
| + m_uniqueName = parent()->tree().calculateUniqueNameForChildFrame(true, name, fallbackName); |
| } |
| void FrameTree::setNameForReplacementFrame(const AtomicString& name, const AtomicString& uniqueName) |
| @@ -123,8 +123,20 @@ bool FrameTree::uniqueNameExists(const AtomicString& name) const |
| return false; |
| } |
| -AtomicString FrameTree::uniqueChildName(const AtomicString& requestedName) const |
| +AtomicString FrameTree::calculateUniqueNameForNewChildFrame( |
| + const AtomicString& name, |
| + const AtomicString& fallbackName) const |
| { |
| + return calculateUniqueNameForChildFrame(false, name, fallbackName); |
| +} |
| + |
| +AtomicString FrameTree::calculateUniqueNameForChildFrame( |
| + bool existingChildFrame, |
| + const AtomicString& originalRequestedName, |
| + const AtomicString& fallbackName) const |
| +{ |
| + const AtomicString& requestedName = |
| + originalRequestedName.isEmpty() ? fallbackName : originalRequestedName; |
| if (!requestedName.isEmpty() && !uniqueNameExists(requestedName) && requestedName != "_blank") |
| return requestedName; |
| @@ -160,7 +172,7 @@ AtomicString FrameTree::uniqueChildName(const AtomicString& requestedName) const |
| } |
| name.appendLiteral("/<!--frame"); |
| - name.appendNumber(childCount() - 1); |
| + name.appendNumber(childCount() - (existingChildFrame ? 1 : 0)); |
| name.appendLiteral("-->-->"); |
| return name.toAtomicString(); |