Index: third_party/WebKit/Source/core/page/FrameTree.h |
diff --git a/third_party/WebKit/Source/core/page/FrameTree.h b/third_party/WebKit/Source/core/page/FrameTree.h |
index 2314a451403eb493881dd1b741c4d27b4f07d5fc..aa3c39e8faf4d764f8c62050d592f5011a566922 100644 |
--- a/third_party/WebKit/Source/core/page/FrameTree.h |
+++ b/third_party/WebKit/Source/core/page/FrameTree.h |
@@ -37,10 +37,16 @@ public: |
~FrameTree(); |
const AtomicString& name() const { return m_name; } |
+ void setName(const AtomicString&); |
+ |
+ // Unique name of a frame (unique per page). Mainly used to identify the |
+ // frame for session history purposes, but also used in expected results |
+ // of layout tests. |
+ // |
+ // The value should be treated as an unstructured, opaque string. |
+ // The implementation details can be found in FrameTree.cpp, in a comment |
+ // inside calculateUniqueNameForChildFrame method. |
const AtomicString& uniqueName() const { return m_uniqueName; } |
- // If |name| is not empty, |fallbackName| is ignored. Otherwise, |
- // |fallbackName| is used as a source of uniqueName. |
- void setName(const AtomicString& name, const AtomicString& fallbackName = nullAtom); |
// Directly assigns both the name and uniqueName. Can be used when |
// |uniqueName| is already known (i.e. when it has been precalculated by |
@@ -77,11 +83,39 @@ public: |
private: |
Frame* deepLastChild() const; |
+ |
+ // Returns true if one of frames in the tree already has unique name equal |
+ // to |uniqueNameCandidate|. |
+ bool uniqueNameExists(const AtomicString& uniqueNameCandidate) const; |
+ |
+ // Generates a hopefully-but-not-necessarily unique name based on frame's |
+ // relative position in the tree and on unique names of ancestors. |
+ AtomicString generateUniqueNameCandidate(bool existingChildFrame) const; |
+ |
+ // Generates a hopefully-but-not-necessarily unique suffix based on |child| |
+ // absolute position in the tree. If |child| is nullptr, calculations are |
+ // made for a position that a new child of |this| would have. |
+ String generateFramePosition(Frame* child) const; |
+ |
+ // Concatenates |prefix|, |likelyUniqueSuffix| (and additional, internally |
+ // generated suffix) until the result is a unique name, that doesn't exist |
+ // elsewhere in the frame tree. Returns the unique name built in this way. |
+ AtomicString appendUniqueSuffix( |
+ const AtomicString& prefix, |
+ const String& likelyUniqueSuffix) const; |
+ |
+ // Calculates a unique name for |child| frame (which might be nullptr if the |
+ // child has not yet been created - i.e. when we need unique name for a new |
+ // frame). Tries to use the |assignedName| or |fallbackName| if possible, |
+ // otherwise falls back to generating a deterministic, |
+ // stable-across-page-reloads string based on |child| position in the tree. |
AtomicString calculateUniqueNameForChildFrame( |
- bool existingChildFrame, |
- const AtomicString& name, |
+ Frame* child, |
+ const AtomicString& assignedName, |
const AtomicString& fallbackName = nullAtom) const; |
- bool uniqueNameExists(const AtomicString& name) const; |
+ |
+ // Sets |m_uniqueName| and asserts its uniqueness. |
+ void setUniqueName(const AtomicString&); |
Member<Frame> m_thisFrame; |