Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. | 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 ~HistoryItem(); | 52 ~HistoryItem(); |
| 53 | 53 |
| 54 const String& UrlString() const; | 54 const String& UrlString() const; |
| 55 KURL Url() const; | 55 KURL Url() const; |
| 56 | 56 |
| 57 const Referrer& GetReferrer() const; | 57 const Referrer& GetReferrer() const; |
| 58 | 58 |
| 59 EncodedFormData* FormData(); | 59 EncodedFormData* FormData(); |
| 60 const AtomicString& FormContentType() const; | 60 const AtomicString& FormContentType() const; |
| 61 | 61 |
| 62 void SetDidSaveScrollOrScaleState(bool did_save_scroll_or_scale_state) { | 62 class ViewState { |
| 63 did_save_scroll_or_scale_state_ = did_save_scroll_or_scale_state; | 63 public: |
| 64 ViewState() : page_scale_factor_(0) {} | |
| 65 ViewState(const ViewState&) = default; | |
| 66 | |
| 67 ScrollOffset visual_viewport_scroll_offset_; | |
| 68 ScrollOffset scroll_offset_; | |
| 69 float page_scale_factor_; | |
| 70 }; | |
| 71 | |
| 72 ViewState* GetViewState() const { return view_state_.get(); } | |
| 73 void ClearViewState() { view_state_.reset(); } | |
| 74 void CopyViewStateFrom(HistoryItem* other) { | |
| 75 if (other->view_state_) | |
| 76 view_state_ = WTF::MakeUnique<ViewState>(*other->view_state_.get()); | |
|
majidvp
2017/07/17 20:06:15
shouldn't we reset() in the nullptr case?
Nate Chapin
2017/07/17 20:38:43
That is closer to the old behavior, yes. Done.
| |
| 64 } | 77 } |
| 65 | 78 |
| 66 bool DidSaveScrollOrScaleState() const { | |
| 67 return did_save_scroll_or_scale_state_; | |
| 68 } | |
| 69 | |
| 70 const ScrollOffset& VisualViewportScrollOffset() const; | |
| 71 void SetVisualViewportScrollOffset(const ScrollOffset&); | 79 void SetVisualViewportScrollOffset(const ScrollOffset&); |
| 72 const ScrollOffset& GetScrollOffset() const; | |
| 73 void SetScrollOffset(const ScrollOffset&); | 80 void SetScrollOffset(const ScrollOffset&); |
| 74 | |
| 75 float PageScaleFactor() const; | |
| 76 void SetPageScaleFactor(float); | 81 void SetPageScaleFactor(float); |
| 77 | 82 |
| 78 Vector<String> GetReferencedFilePaths(); | 83 Vector<String> GetReferencedFilePaths(); |
| 79 const Vector<String>& GetDocumentState(); | 84 const Vector<String>& GetDocumentState(); |
| 80 void SetDocumentState(const Vector<String>&); | 85 void SetDocumentState(const Vector<String>&); |
| 81 void SetDocumentState(DocumentState*); | 86 void SetDocumentState(DocumentState*); |
| 82 void ClearDocumentState(); | 87 void ClearDocumentState(); |
| 83 | 88 |
| 84 void SetURL(const KURL&); | 89 void SetURL(const KURL&); |
| 85 void SetURLString(const String&); | 90 void SetURLString(const String&); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 112 ResourceRequest GenerateResourceRequest(WebCachePolicy); | 117 ResourceRequest GenerateResourceRequest(WebCachePolicy); |
| 113 | 118 |
| 114 DECLARE_TRACE(); | 119 DECLARE_TRACE(); |
| 115 | 120 |
| 116 private: | 121 private: |
| 117 HistoryItem(); | 122 HistoryItem(); |
| 118 | 123 |
| 119 String url_string_; | 124 String url_string_; |
| 120 Referrer referrer_; | 125 Referrer referrer_; |
| 121 | 126 |
| 122 bool did_save_scroll_or_scale_state_; | |
| 123 ScrollOffset visual_viewport_scroll_offset_; | |
| 124 ScrollOffset scroll_offset_; | |
| 125 float page_scale_factor_; | |
| 126 Vector<String> document_state_vector_; | 127 Vector<String> document_state_vector_; |
| 127 Member<DocumentState> document_state_; | 128 Member<DocumentState> document_state_; |
| 128 | 129 |
| 130 std::unique_ptr<ViewState> view_state_; | |
| 131 | |
| 129 // If two HistoryItems have the same item sequence number, then they are | 132 // If two HistoryItems have the same item sequence number, then they are |
| 130 // clones of one another. Traversing history from one such HistoryItem to | 133 // clones of one another. Traversing history from one such HistoryItem to |
| 131 // another is a no-op. HistoryItem clones are created for parent and | 134 // another is a no-op. HistoryItem clones are created for parent and |
| 132 // sibling frames when only a subframe navigates. | 135 // sibling frames when only a subframe navigates. |
| 133 int64_t item_sequence_number_; | 136 int64_t item_sequence_number_; |
| 134 | 137 |
| 135 // If two HistoryItems have the same document sequence number, then they | 138 // If two HistoryItems have the same document sequence number, then they |
| 136 // refer to the same instance of a document. Traversing history from one | 139 // refer to the same instance of a document. Traversing history from one |
| 137 // such HistoryItem to another preserves the document. | 140 // such HistoryItem to another preserves the document. |
| 138 int64_t document_sequence_number_; | 141 int64_t document_sequence_number_; |
| 139 | 142 |
| 140 // Type of the scroll restoration for the history item determines if scroll | 143 // Type of the scroll restoration for the history item determines if scroll |
| 141 // position should be restored when it is loaded during history traversal. | 144 // position should be restored when it is loaded during history traversal. |
| 142 HistoryScrollRestorationType scroll_restoration_type_; | 145 HistoryScrollRestorationType scroll_restoration_type_; |
| 143 | 146 |
| 144 // Support for HTML5 History | 147 // Support for HTML5 History |
| 145 RefPtr<SerializedScriptValue> state_object_; | 148 RefPtr<SerializedScriptValue> state_object_; |
| 146 | 149 |
| 147 // info used to repost form data | 150 // info used to repost form data |
| 148 RefPtr<EncodedFormData> form_data_; | 151 RefPtr<EncodedFormData> form_data_; |
| 149 AtomicString form_content_type_; | 152 AtomicString form_content_type_; |
| 150 }; // class HistoryItem | 153 }; // class HistoryItem |
| 151 | 154 |
| 152 } // namespace blink | 155 } // namespace blink |
| 153 | 156 |
| 154 #endif // HISTORYITEM_H | 157 #endif // HISTORYITEM_H |
| OLD | NEW |