| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 static long long GenerateSequenceNumber() { | 37 static long long GenerateSequenceNumber() { |
| 38 // Initialize to the current time to reduce the likelihood of generating | 38 // Initialize to the current time to reduce the likelihood of generating |
| 39 // identifiers that overlap with those from past/future browser sessions. | 39 // identifiers that overlap with those from past/future browser sessions. |
| 40 static long long next = static_cast<long long>(CurrentTime() * 1000000.0); | 40 static long long next = static_cast<long long>(CurrentTime() * 1000000.0); |
| 41 return ++next; | 41 return ++next; |
| 42 } | 42 } |
| 43 | 43 |
| 44 HistoryItem::HistoryItem() | 44 HistoryItem::HistoryItem() |
| 45 : did_save_scroll_or_scale_state_(false), | 45 : page_scale_factor_(0), |
| 46 page_scale_factor_(0), | |
| 47 item_sequence_number_(GenerateSequenceNumber()), | 46 item_sequence_number_(GenerateSequenceNumber()), |
| 48 document_sequence_number_(GenerateSequenceNumber()), | 47 document_sequence_number_(GenerateSequenceNumber()), |
| 49 scroll_restoration_type_(kScrollRestorationAuto) {} | 48 scroll_restoration_type_(kScrollRestorationAuto) {} |
| 50 | 49 |
| 51 HistoryItem::~HistoryItem() {} | 50 HistoryItem::~HistoryItem() {} |
| 52 | 51 |
| 53 const String& HistoryItem::UrlString() const { | 52 const String& HistoryItem::UrlString() const { |
| 54 return url_string_; | 53 return url_string_; |
| 55 } | 54 } |
| 56 | 55 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 76 referrer_ = SecurityPolicy::GenerateReferrer(referrer.referrer_policy, Url(), | 75 referrer_ = SecurityPolicy::GenerateReferrer(referrer.referrer_policy, Url(), |
| 77 referrer.referrer); | 76 referrer.referrer); |
| 78 } | 77 } |
| 79 | 78 |
| 80 const ScrollOffset& HistoryItem::VisualViewportScrollOffset() const { | 79 const ScrollOffset& HistoryItem::VisualViewportScrollOffset() const { |
| 81 return visual_viewport_scroll_offset_; | 80 return visual_viewport_scroll_offset_; |
| 82 } | 81 } |
| 83 | 82 |
| 84 void HistoryItem::SetVisualViewportScrollOffset(const ScrollOffset& offset) { | 83 void HistoryItem::SetVisualViewportScrollOffset(const ScrollOffset& offset) { |
| 85 visual_viewport_scroll_offset_ = offset; | 84 visual_viewport_scroll_offset_ = offset; |
| 86 SetDidSaveScrollOrScaleState(true); | |
| 87 } | 85 } |
| 88 | 86 |
| 89 const ScrollOffset& HistoryItem::GetScrollOffset() const { | 87 const ScrollOffset& HistoryItem::GetScrollOffset() const { |
| 90 return scroll_offset_; | 88 return scroll_offset_; |
| 91 } | 89 } |
| 92 | 90 |
| 93 void HistoryItem::SetScrollOffset(const ScrollOffset& offset) { | 91 void HistoryItem::SetScrollOffset(const ScrollOffset& offset) { |
| 94 scroll_offset_ = offset; | 92 scroll_offset_ = offset; |
| 95 SetDidSaveScrollOrScaleState(true); | |
| 96 } | 93 } |
| 97 | 94 |
| 98 float HistoryItem::PageScaleFactor() const { | 95 float HistoryItem::PageScaleFactor() const { |
| 99 return page_scale_factor_; | 96 return page_scale_factor_; |
| 100 } | 97 } |
| 101 | 98 |
| 102 void HistoryItem::SetPageScaleFactor(float scale_factor) { | 99 void HistoryItem::SetPageScaleFactor(float scale_factor) { |
| 103 page_scale_factor_ = scale_factor; | 100 page_scale_factor_ = scale_factor; |
| 104 SetDidSaveScrollOrScaleState(true); | |
| 105 } | 101 } |
| 106 | 102 |
| 107 void HistoryItem::SetDocumentState(const Vector<String>& state) { | 103 void HistoryItem::SetDocumentState(const Vector<String>& state) { |
| 108 DCHECK(!document_state_); | 104 DCHECK(!document_state_); |
| 109 document_state_vector_ = state; | 105 document_state_vector_ = state; |
| 110 } | 106 } |
| 111 | 107 |
| 112 void HistoryItem::SetDocumentState(DocumentState* state) { | 108 void HistoryItem::SetDocumentState(DocumentState* state) { |
| 113 document_state_ = state; | 109 document_state_ = state; |
| 114 } | 110 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 request.AddHTTPOriginIfNeeded(referrer_.referrer); | 169 request.AddHTTPOriginIfNeeded(referrer_.referrer); |
| 174 } | 170 } |
| 175 return request; | 171 return request; |
| 176 } | 172 } |
| 177 | 173 |
| 178 DEFINE_TRACE(HistoryItem) { | 174 DEFINE_TRACE(HistoryItem) { |
| 179 visitor->Trace(document_state_); | 175 visitor->Trace(document_state_); |
| 180 } | 176 } |
| 181 | 177 |
| 182 } // namespace blink | 178 } // namespace blink |
| OLD | NEW |