| 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 25 matching lines...) Expand all Loading... |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 static long long generateSequenceNumber() { | 38 static long long generateSequenceNumber() { |
| 39 // Initialize to the current time to reduce the likelihood of generating | 39 // Initialize to the current time to reduce the likelihood of generating |
| 40 // identifiers that overlap with those from past/future browser sessions. | 40 // identifiers that overlap with those from past/future browser sessions. |
| 41 static long long next = static_cast<long long>(currentTime() * 1000000.0); | 41 static long long next = static_cast<long long>(currentTime() * 1000000.0); |
| 42 return ++next; | 42 return ++next; |
| 43 } | 43 } |
| 44 | 44 |
| 45 HistoryItem::HistoryItem() | 45 HistoryItem::HistoryItem() |
| 46 : m_pageScaleFactor(0), | 46 : m_didSaveScrollOrScaleState(false), |
| 47 m_pageScaleFactor(0), |
| 47 m_itemSequenceNumber(generateSequenceNumber()), | 48 m_itemSequenceNumber(generateSequenceNumber()), |
| 48 m_documentSequenceNumber(generateSequenceNumber()), | 49 m_documentSequenceNumber(generateSequenceNumber()), |
| 49 m_scrollRestorationType(ScrollRestorationAuto) {} | 50 m_scrollRestorationType(ScrollRestorationAuto) {} |
| 50 | 51 |
| 51 HistoryItem::~HistoryItem() {} | 52 HistoryItem::~HistoryItem() {} |
| 52 | 53 |
| 53 const String& HistoryItem::urlString() const { | 54 const String& HistoryItem::urlString() const { |
| 54 return m_urlString; | 55 return m_urlString; |
| 55 } | 56 } |
| 56 | 57 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 84 void HistoryItem::setTarget(const String& target) { | 85 void HistoryItem::setTarget(const String& target) { |
| 85 m_target = target; | 86 m_target = target; |
| 86 } | 87 } |
| 87 | 88 |
| 88 const ScrollOffset& HistoryItem::visualViewportScrollOffset() const { | 89 const ScrollOffset& HistoryItem::visualViewportScrollOffset() const { |
| 89 return m_visualViewportScrollOffset; | 90 return m_visualViewportScrollOffset; |
| 90 } | 91 } |
| 91 | 92 |
| 92 void HistoryItem::setVisualViewportScrollOffset(const ScrollOffset& offset) { | 93 void HistoryItem::setVisualViewportScrollOffset(const ScrollOffset& offset) { |
| 93 m_visualViewportScrollOffset = offset; | 94 m_visualViewportScrollOffset = offset; |
| 95 setDidSaveScrollOrScaleState(true); |
| 94 } | 96 } |
| 95 | 97 |
| 96 const ScrollOffset& HistoryItem::getScrollOffset() const { | 98 const ScrollOffset& HistoryItem::getScrollOffset() const { |
| 97 return m_scrollOffset; | 99 return m_scrollOffset; |
| 98 } | 100 } |
| 99 | 101 |
| 100 void HistoryItem::setScrollOffset(const ScrollOffset& offset) { | 102 void HistoryItem::setScrollOffset(const ScrollOffset& offset) { |
| 101 m_scrollOffset = offset; | 103 m_scrollOffset = offset; |
| 104 setDidSaveScrollOrScaleState(true); |
| 102 } | 105 } |
| 103 | 106 |
| 104 float HistoryItem::pageScaleFactor() const { | 107 float HistoryItem::pageScaleFactor() const { |
| 105 return m_pageScaleFactor; | 108 return m_pageScaleFactor; |
| 106 } | 109 } |
| 107 | 110 |
| 108 void HistoryItem::setPageScaleFactor(float scaleFactor) { | 111 void HistoryItem::setPageScaleFactor(float scaleFactor) { |
| 109 m_pageScaleFactor = scaleFactor; | 112 m_pageScaleFactor = scaleFactor; |
| 113 setDidSaveScrollOrScaleState(true); |
| 110 } | 114 } |
| 111 | 115 |
| 112 void HistoryItem::setDocumentState(const Vector<String>& state) { | 116 void HistoryItem::setDocumentState(const Vector<String>& state) { |
| 113 DCHECK(!m_documentState); | 117 DCHECK(!m_documentState); |
| 114 m_documentStateVector = state; | 118 m_documentStateVector = state; |
| 115 } | 119 } |
| 116 | 120 |
| 117 void HistoryItem::setDocumentState(DocumentState* state) { | 121 void HistoryItem::setDocumentState(DocumentState* state) { |
| 118 m_documentState = state; | 122 m_documentState = state; |
| 119 } | 123 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // FIXME: We should find a better way to check if this is the current | 174 // FIXME: We should find a better way to check if this is the current |
| 171 // document. | 175 // document. |
| 172 return equalIgnoringFragmentIdentifier(url(), doc->url()); | 176 return equalIgnoringFragmentIdentifier(url(), doc->url()); |
| 173 } | 177 } |
| 174 | 178 |
| 175 DEFINE_TRACE(HistoryItem) { | 179 DEFINE_TRACE(HistoryItem) { |
| 176 visitor->trace(m_documentState); | 180 visitor->trace(m_documentState); |
| 177 } | 181 } |
| 178 | 182 |
| 179 } // namespace blink | 183 } // namespace blink |
| OLD | NEW |