<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[160669] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/160669">160669</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2013-12-16 15:54:09 -0800 (Mon, 16 Dec 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>[iOS] Upstream WebCore/history changes
https://bugs.webkit.org/show_bug.cgi?id=125769
Reviewed by Darin Adler.
* history/BackForwardClient.h:
* history/BackForwardList.cpp:
(WebCore::BackForwardList::current): Added; guard by PLATFORM(IOS). Also added FIXME comment.
(WebCore::BackForwardList::setCurrent): Added; guard by PLATFORM(IOS). Also added FIXME comment.
(WebCore::BackForwardList::clearAllPageCaches): Added; guarded by PLATFORM(IOS).
* history/BackForwardList.h:
* history/CachedFrame.cpp:
(WebCore::CachedFrameBase::restore): Added iOS-specific code.
(WebCore::CachedFrame::CachedFrame): Ditto.
* history/CachedPage.cpp:
(WebCore::CachedPage::restore): Ditto.
* history/HistoryItem.cpp:
(WebCore::HistoryItem::HistoryItem): Ditto.
* history/HistoryItem.h:
(WebCore::HistoryItem::scale): Added; guarded by PLATFORM(IOS).
(WebCore::HistoryItem::scaleIsInitial): Added; guarded by PLATFORM(IOS).
(WebCore::HistoryItem::setScale): Added; guarded by PLATFORM(IOS).
(WebCore::HistoryItem::viewportArguments): Added; guarded by PLATFORM(IOS).
(WebCore::HistoryItem::setViewportArguments): Added; guarded by PLATFORM(IOS).
(WebCore::HistoryItem::bookmarkID): Added; guarded by PLATFORM(IOS).
(WebCore::HistoryItem::setBookmarkID): Added; guarded by PLATFORM(IOS).
(WebCore::HistoryItem::sharedLinkUniqueIdentifier): Added; guarded by PLATFORM(IOS).
(WebCore::HistoryItem::setSharedLinkUniqueIdentifier): Added; guarded by PLATFORM(IOS).
* history/PageCache.cpp:
(WebCore::logCanCacheFrameDecision): Added iOS-specific code.
(WebCore::logCanCachePageDecision): Ditto.
(WebCore::PageCache::canCachePageContainingThisFrame): Ditto.
(WebCore::PageCache::canCache): Ditto.
(WebCore::PageCache::pruneToCapacityNow): Added.
* history/PageCache.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehistoryBackForwardClienth">trunk/Source/WebCore/history/BackForwardClient.h</a></li>
<li><a href="#trunkSourceWebCorehistoryBackForwardListcpp">trunk/Source/WebCore/history/BackForwardList.cpp</a></li>
<li><a href="#trunkSourceWebCorehistoryBackForwardListh">trunk/Source/WebCore/history/BackForwardList.h</a></li>
<li><a href="#trunkSourceWebCorehistoryCachedFramecpp">trunk/Source/WebCore/history/CachedFrame.cpp</a></li>
<li><a href="#trunkSourceWebCorehistoryCachedPagecpp">trunk/Source/WebCore/history/CachedPage.cpp</a></li>
<li><a href="#trunkSourceWebCorehistoryHistoryItemcpp">trunk/Source/WebCore/history/HistoryItem.cpp</a></li>
<li><a href="#trunkSourceWebCorehistoryHistoryItemh">trunk/Source/WebCore/history/HistoryItem.h</a></li>
<li><a href="#trunkSourceWebCorehistoryPageCachecpp">trunk/Source/WebCore/history/PageCache.cpp</a></li>
<li><a href="#trunkSourceWebCorehistoryPageCacheh">trunk/Source/WebCore/history/PageCache.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (160668 => 160669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-12-16 23:25:31 UTC (rev 160668)
+++ trunk/Source/WebCore/ChangeLog        2013-12-16 23:54:09 UTC (rev 160669)
</span><span class="lines">@@ -1,5 +1,43 @@
</span><span class="cx"> 2013-12-16 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><ins>+ [iOS] Upstream WebCore/history changes
+ https://bugs.webkit.org/show_bug.cgi?id=125769
+
+ Reviewed by Darin Adler.
+
+ * history/BackForwardClient.h:
+ * history/BackForwardList.cpp:
+ (WebCore::BackForwardList::current): Added; guard by PLATFORM(IOS). Also added FIXME comment.
+ (WebCore::BackForwardList::setCurrent): Added; guard by PLATFORM(IOS). Also added FIXME comment.
+ (WebCore::BackForwardList::clearAllPageCaches): Added; guarded by PLATFORM(IOS).
+ * history/BackForwardList.h:
+ * history/CachedFrame.cpp:
+ (WebCore::CachedFrameBase::restore): Added iOS-specific code.
+ (WebCore::CachedFrame::CachedFrame): Ditto.
+ * history/CachedPage.cpp:
+ (WebCore::CachedPage::restore): Ditto.
+ * history/HistoryItem.cpp:
+ (WebCore::HistoryItem::HistoryItem): Ditto.
+ * history/HistoryItem.h:
+ (WebCore::HistoryItem::scale): Added; guarded by PLATFORM(IOS).
+ (WebCore::HistoryItem::scaleIsInitial): Added; guarded by PLATFORM(IOS).
+ (WebCore::HistoryItem::setScale): Added; guarded by PLATFORM(IOS).
+ (WebCore::HistoryItem::viewportArguments): Added; guarded by PLATFORM(IOS).
+ (WebCore::HistoryItem::setViewportArguments): Added; guarded by PLATFORM(IOS).
+ (WebCore::HistoryItem::bookmarkID): Added; guarded by PLATFORM(IOS).
+ (WebCore::HistoryItem::setBookmarkID): Added; guarded by PLATFORM(IOS).
+ (WebCore::HistoryItem::sharedLinkUniqueIdentifier): Added; guarded by PLATFORM(IOS).
+ (WebCore::HistoryItem::setSharedLinkUniqueIdentifier): Added; guarded by PLATFORM(IOS).
+ * history/PageCache.cpp:
+ (WebCore::logCanCacheFrameDecision): Added iOS-specific code.
+ (WebCore::logCanCachePageDecision): Ditto.
+ (WebCore::PageCache::canCachePageContainingThisFrame): Ditto.
+ (WebCore::PageCache::canCache): Ditto.
+ (WebCore::PageCache::pruneToCapacityNow): Added.
+ * history/PageCache.h:
+
+2013-12-16 Daniel Bates <dabates@apple.com>
+
</ins><span class="cx"> [iOS] Upstream WebCore/svg changes
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=125784
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryBackForwardClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/BackForwardClient.h (160668 => 160669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/BackForwardClient.h        2013-12-16 23:25:31 UTC (rev 160668)
+++ trunk/Source/WebCore/history/BackForwardClient.h        2013-12-16 23:54:09 UTC (rev 160669)
</span><span class="lines">@@ -53,6 +53,15 @@
</span><span class="cx">
</span><span class="cx"> virtual void close() = 0;
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ // FIXME: These methods seem to violate the encapsulation of this class.
+ virtual unsigned current() = 0;
+ virtual void setCurrent(unsigned newCurrent) = 0;
+
+ // FIXME: Consider renaming this method once we upstream the iOS changes to WebView.mm.
+ virtual bool clearAllPageCaches() = 0;
+#endif
+
</ins><span class="cx"> // FIXME: Delete these once all callers are using BackForwardController
</span><span class="cx"> // instead of calling this directly.
</span><span class="cx"> HistoryItem* backItem() { return itemAtIndex(-1); }
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryBackForwardListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/BackForwardList.cpp (160668 => 160669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/BackForwardList.cpp        2013-12-16 23:25:31 UTC (rev 160668)
+++ trunk/Source/WebCore/history/BackForwardList.cpp        2013-12-16 23:54:09 UTC (rev 160669)
</span><span class="lines">@@ -228,6 +228,32 @@
</span><span class="cx"> return m_entries;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+unsigned BackForwardList::current()
+{
+ return m_current;
+}
+
+void BackForwardList::setCurrent(unsigned newCurrent)
+{
+ m_current = newCurrent;
+}
+
+bool BackForwardList::clearAllPageCaches()
+{
+ bool didRemoveAtLeastOneItem = false;
+ unsigned length = m_entries.size();
+ for (unsigned i = 0; i < length; ++i) {
+ HistoryItem* item = m_entries[i].get();
+ if (item->isInPageCache()) {
+ didRemoveAtLeastOneItem = true;
+ pageCache()->remove(item);
+ }
+ }
+ return didRemoveAtLeastOneItem;
+}
+#endif
+
</ins><span class="cx"> void BackForwardList::close()
</span><span class="cx"> {
</span><span class="cx"> int size = m_entries.size();
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryBackForwardListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/BackForwardList.h (160668 => 160669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/BackForwardList.h        2013-12-16 23:25:31 UTC (rev 160668)
+++ trunk/Source/WebCore/history/BackForwardList.h        2013-12-16 23:54:09 UTC (rev 160669)
</span><span class="lines">@@ -73,6 +73,13 @@
</span><span class="cx"> void removeItem(HistoryItem*);
</span><span class="cx"> HistoryItemVector& entries();
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ virtual unsigned current() OVERRIDE;
+ virtual void setCurrent(unsigned newCurrent) OVERRIDE;
+
+ virtual bool clearAllPageCaches() OVERRIDE;
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> explicit BackForwardList(Page*);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryCachedFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/CachedFrame.cpp (160668 => 160669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/CachedFrame.cpp        2013-12-16 23:25:31 UTC (rev 160668)
+++ trunk/Source/WebCore/history/CachedFrame.cpp        2013-12-16 23:54:09 UTC (rev 160669)
</span><span class="lines">@@ -131,6 +131,18 @@
</span><span class="cx"> m_childFrames[i]->open();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ if (m_isMainFrame) {
+ frame.loader().client().didRestoreFrameHierarchyForCachedFrame();
+
+ if (DOMWindow* domWindow = m_document->domWindow()) {
+ // FIXME: Add SCROLL_LISTENER to the list of event types on Document, and use m_document->hasListenerType(). See <rdar://problem/9615482>.
+ if (domWindow->scrollEventListenerCount() && frame.page())
+ frame.page()->chrome().client().setNeedsScrollNotifications(&frame, true);
+ }
+ }
+#endif
+
</ins><span class="cx"> // FIXME: update Page Visibility state here.
</span><span class="cx"> // https://bugs.webkit.org/show_bug.cgi?id=116770
</span><span class="cx"> m_document->enqueuePageshowEvent(PageshowEventPersisted);
</span><span class="lines">@@ -138,7 +150,7 @@
</span><span class="cx"> HistoryItem* historyItem = frame.loader().history().currentItem();
</span><span class="cx"> m_document->enqueuePopstateEvent(historyItem && historyItem->stateObject() ? historyItem->stateObject() : SerializedScriptValue::nullValue());
</span><span class="cx">
</span><del>-#if ENABLE(TOUCH_EVENTS)
</del><ins>+#if ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS)
</ins><span class="cx"> if (m_document->hasTouchEventHandlers())
</span><span class="cx"> m_document->page()->chrome().client().needTouchEvents(true);
</span><span class="cx"> #endif
</span><span class="lines">@@ -209,6 +221,14 @@
</span><span class="cx"> LOG(PageCache, "Finished creating CachedFrame for child frame with url '%s' and DocumentLoader %p\n", m_url.string().utf8().data(), m_documentLoader.get());
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ if (m_isMainFrame) {
+ if (DOMWindow* domWindow = m_document->domWindow()) {
+ if (domWindow->scrollEventListenerCount() && frame.page())
+ frame.page()->chrome().client().setNeedsScrollNotifications(&frame, false);
+ }
+ }
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void CachedFrame::open()
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryCachedPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/CachedPage.cpp (160668 => 160669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/CachedPage.cpp        2013-12-16 23:25:31 UTC (rev 160668)
+++ trunk/Source/WebCore/history/CachedPage.cpp        2013-12-16 23:54:09 UTC (rev 160669)
</span><span class="lines">@@ -39,6 +39,10 @@
</span><span class="cx"> #include <wtf/RefCountedLeakCounter.h>
</span><span class="cx"> #include <wtf/StdLibExtras.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#include "FrameSelection.h"
+#endif
+
</ins><span class="cx"> using namespace JSC;
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -85,8 +89,17 @@
</span><span class="cx"> // Restore the focus appearance for the focused element.
</span><span class="cx"> // FIXME: Right now we don't support pages w/ frames in the b/f cache. This may need to be tweaked when we add support for that.
</span><span class="cx"> Document* focusedDocument = page.focusController().focusedOrMainFrame().document();
</span><del>- if (Element* element = focusedDocument->focusedElement())
</del><ins>+ if (Element* element = focusedDocument->focusedElement()) {
+#if PLATFORM(IOS)
+ // We don't want focused nodes changing scroll position when restoring from the cache
+ // as it can cause ugly jumps before we manage to restore the cached position.
+ page.mainFrame().selection().suppressScrolling();
+#endif
</ins><span class="cx"> element->updateFocusAppearance(true);
</span><ins>+#if PLATFORM(IOS)
+ page.mainFrame().selection().restoreScrolling();
+#endif
+ }
</ins><span class="cx">
</span><span class="cx"> if (m_needStyleRecalcForVisitedLinks) {
</span><span class="cx"> for (Frame* frame = &page.mainFrame(); frame; frame = frame->tree().traverseNext())
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryHistoryItemcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/HistoryItem.cpp (160668 => 160669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/HistoryItem.cpp        2013-12-16 23:25:31 UTC (rev 160668)
+++ trunk/Source/WebCore/history/HistoryItem.cpp        2013-12-16 23:54:09 UTC (rev 160669)
</span><span class="lines">@@ -70,6 +70,11 @@
</span><span class="cx"> , m_documentSequenceNumber(generateSequenceNumber())
</span><span class="cx"> , m_next(0)
</span><span class="cx"> , m_prev(0)
</span><ins>+#if PLATFORM(IOS)
+ , m_scale(0)
+ , m_scaleIsInitial(false)
+ , m_bookmarkID(0)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -87,6 +92,11 @@
</span><span class="cx"> , m_documentSequenceNumber(generateSequenceNumber())
</span><span class="cx"> , m_next(0)
</span><span class="cx"> , m_prev(0)
</span><ins>+#if PLATFORM(IOS)
+ , m_scale(0)
+ , m_scaleIsInitial(false)
+ , m_bookmarkID(0)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> iconDatabase().retainIconForPageURL(m_urlString);
</span><span class="cx"> }
</span><span class="lines">@@ -106,6 +116,11 @@
</span><span class="cx"> , m_documentSequenceNumber(generateSequenceNumber())
</span><span class="cx"> , m_next(0)
</span><span class="cx"> , m_prev(0)
</span><ins>+#if PLATFORM(IOS)
+ , m_scale(0)
+ , m_scaleIsInitial(false)
+ , m_bookmarkID(0)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> iconDatabase().retainIconForPageURL(m_urlString);
</span><span class="cx"> }
</span><span class="lines">@@ -126,6 +141,11 @@
</span><span class="cx"> , m_documentSequenceNumber(generateSequenceNumber())
</span><span class="cx"> , m_next(0)
</span><span class="cx"> , m_prev(0)
</span><ins>+#if PLATFORM(IOS)
+ , m_scale(0)
+ , m_scaleIsInitial(false)
+ , m_bookmarkID(0)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> iconDatabase().retainIconForPageURL(m_urlString);
</span><span class="cx"> }
</span><span class="lines">@@ -157,6 +177,12 @@
</span><span class="cx"> , m_itemSequenceNumber(item.m_itemSequenceNumber)
</span><span class="cx"> , m_documentSequenceNumber(item.m_documentSequenceNumber)
</span><span class="cx"> , m_formContentType(item.m_formContentType)
</span><ins>+#if PLATFORM(IOS)
+ , m_scale(item.m_scale)
+ , m_scaleIsInitial(item.m_scaleIsInitial)
+ , m_bookmarkID(item.m_bookmarkID)
+ , m_sharedLinkUniqueIdentifier(item.m_sharedLinkUniqueIdentifier)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> if (item.m_formData)
</span><span class="cx"> m_formData = item.m_formData->copy();
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryHistoryItemh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/HistoryItem.h (160668 => 160669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/HistoryItem.h        2013-12-16 23:25:31 UTC (rev 160668)
+++ trunk/Source/WebCore/history/HistoryItem.h        2013-12-16 23:54:09 UTC (rev 160669)
</span><span class="lines">@@ -34,6 +34,10 @@
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#include "ViewportArguments.h"
+#endif
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx"> typedef struct objc_object* id;
</span><span class="lines">@@ -206,6 +210,24 @@
</span><span class="cx"> const Vector<int>& dailyVisitCounts() const { return m_dailyVisitCounts; }
</span><span class="cx"> const Vector<int>& weeklyVisitCounts() const { return m_weeklyVisitCounts; }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ float scale() const { return m_scale; }
+ bool scaleIsInitial() const { return m_scaleIsInitial; }
+ void setScale(float newScale, bool isInitial)
+ {
+ m_scale = newScale;
+ m_scaleIsInitial = isInitial;
+ }
+
+ const ViewportArguments& viewportArguments() const { return m_viewportArguments; }
+ void setViewportArguments(const ViewportArguments& viewportArguments) { m_viewportArguments = viewportArguments; }
+
+ uint32_t bookmarkID() const { return m_bookmarkID; }
+ void setBookmarkID(uint32_t bookmarkID) { m_bookmarkID = bookmarkID; }
+ String sharedLinkUniqueIdentifier() const { return m_sharedLinkUniqueIdentifier; }
+ void setSharedLinkUniqueIdentifier(const String& sharedLinkUniqueidentifier) { m_sharedLinkUniqueIdentifier = sharedLinkUniqueidentifier; }
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> HistoryItem();
</span><span class="cx"> HistoryItem(const String& urlString, const String& title, double lastVisited);
</span><span class="lines">@@ -272,7 +294,16 @@
</span><span class="cx"> HistoryItem* m_next;
</span><span class="cx"> HistoryItem* m_prev;
</span><span class="cx"> OwnPtr<CachedPage> m_cachedPage;
</span><del>-
</del><ins>+
+#if PLATFORM(IOS)
+ float m_scale;
+ bool m_scaleIsInitial;
+ ViewportArguments m_viewportArguments;
+
+ uint32_t m_bookmarkID;
+ String m_sharedLinkUniqueIdentifier;
+#endif
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> RetainPtr<id> m_viewState;
</span><span class="cx"> OwnPtr<HashMap<String, RetainPtr<id>>> m_transientProperties;
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryPageCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/PageCache.cpp (160668 => 160669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/PageCache.cpp        2013-12-16 23:25:31 UTC (rev 160668)
+++ trunk/Source/WebCore/history/PageCache.cpp        2013-12-16 23:54:09 UTC (rev 160669)
</span><span class="lines">@@ -57,6 +57,10 @@
</span><span class="cx"> #include "DeviceProximityController.h"
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#include "MemoryPressureHandler.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> #if !defined(NDEBUG)
</span><span class="lines">@@ -103,7 +107,14 @@
</span><span class="cx"> unsigned rejectReasons = 0;
</span><span class="cx"> if (!frame->loader().documentLoader()->mainDocumentError().isNull()) {
</span><span class="cx"> PCLOG(" -Main document has an error");
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> rejectReasons |= 1 << MainDocumentError;
</span><ins>+#else
+ if (frame->loader().documentLoader()->mainDocumentError().isCancellation() && frame->loader().documentLoader()->subresourceLoadersArePageCacheAcceptable())
+ PCLOG(" -But, it was a cancellation and all loaders during the cancel were loading images.");
+ else
+ rejectReasons |= 1 << MainDocumentError;
+#endif
</ins><span class="cx"> }
</span><span class="cx"> if (frame->loader().documentLoader()->substituteData().isValid() && frame->loader().documentLoader()->substituteData().failingURL().isEmpty()) {
</span><span class="cx"> PCLOG(" -Frame is an error page");
</span><span class="lines">@@ -121,7 +132,12 @@
</span><span class="cx"> }
</span><span class="cx"> if (frame->document()->domWindow() && frame->document()->domWindow()->hasEventListeners(eventNames().unloadEvent)) {
</span><span class="cx"> PCLOG(" -Frame has an unload event listener");
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> rejectReasons |= 1 << HasUnloadListener;
</span><ins>+#else
+ // iOS allows pages with unload event listeners to enter the page cache.
+ PCLOG(" -BUT iOS allows these pages to be cached.");
+#endif
</ins><span class="cx"> }
</span><span class="cx"> #if ENABLE(SQL_DATABASE)
</span><span class="cx"> if (DatabaseManager::manager().hasOpenDatabases(frame->document())) {
</span><span class="lines">@@ -223,7 +239,7 @@
</span><span class="cx"> PCLOG(" -Page settings says b/f cache disabled");
</span><span class="cx"> rejectReasons |= 1 << DisabledPageCache;
</span><span class="cx"> }
</span><del>-#if ENABLE(DEVICE_ORIENTATION)
</del><ins>+#if ENABLE(DEVICE_ORIENTATION) && !PLATFORM(IOS)
</ins><span class="cx"> if (DeviceMotionController::isActiveAt(page)) {
</span><span class="cx"> PCLOG(" -Page is using DeviceMotion");
</span><span class="cx"> rejectReasons |= 1 << UsesDeviceMotion;
</span><span class="lines">@@ -312,12 +328,18 @@
</span><span class="cx"> Document* document = frame->document();
</span><span class="cx">
</span><span class="cx"> return documentLoader
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> && documentLoader->mainDocumentError().isNull()
</span><ins>+#else
+ && (documentLoader->mainDocumentError().isNull() || (documentLoader->mainDocumentError().isCancellation() && documentLoader->subresourceLoadersArePageCacheAcceptable()))
+#endif
</ins><span class="cx"> // Do not cache error pages (these can be recognized as pages with substitute data or unreachable URLs).
</span><span class="cx"> && !(documentLoader->substituteData().isValid() && !documentLoader->substituteData().failingURL().isEmpty())
</span><span class="cx"> && (!frameLoader.subframeLoader().containsPlugins() || frame->page()->settings().pageCacheSupportsPlugins())
</span><span class="cx"> && (!document->url().protocolIs("https") || (!documentLoader->response().cacheControlContainsNoCache() && !documentLoader->response().cacheControlContainsNoStore()))
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx"> && (!document->domWindow() || !document->domWindow()->hasEventListeners(eventNames().unloadEvent))
</span><ins>+#endif
</ins><span class="cx"> #if ENABLE(SQL_DATABASE)
</span><span class="cx"> && !DatabaseManager::manager().hasOpenDatabases(document)
</span><span class="cx"> #endif
</span><span class="lines">@@ -343,7 +365,12 @@
</span><span class="cx"> #if !defined(NDEBUG)
</span><span class="cx"> logCanCachePageDecision(page);
</span><span class="cx"> #endif
</span><del>-
</del><ins>+
+#if PLATFORM(IOS)
+ if (memoryPressureHandler().hasReceivedMemoryPressure())
+ return false;
+#endif
+
</ins><span class="cx"> // Cache the page, if possible.
</span><span class="cx"> // Don't write to the cache if in the middle of a redirect, since we will want to
</span><span class="cx"> // store the final page we end up on.
</span><span class="lines">@@ -355,7 +382,7 @@
</span><span class="cx"> && canCachePageContainingThisFrame(&page->mainFrame())
</span><span class="cx"> && page->backForward().isActive()
</span><span class="cx"> && page->settings().usesPageCache()
</span><del>-#if ENABLE(DEVICE_ORIENTATION)
</del><ins>+#if ENABLE(DEVICE_ORIENTATION) && !PLATFORM(IOS)
</ins><span class="cx"> && !DeviceMotionController::isActiveAt(page)
</span><span class="cx"> && !DeviceOrientationController::isActiveAt(page)
</span><span class="cx"> #endif
</span><span class="lines">@@ -368,6 +395,13 @@
</span><span class="cx"> || loadType == FrameLoadTypeIndexedBackForward);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void PageCache::pruneToCapacityNow(int capacity)
+{
+ int savedCapacity = m_capacity;
+ setCapacity(capacity);
+ setCapacity(savedCapacity);
+}
+
</ins><span class="cx"> void PageCache::setCapacity(int capacity)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(capacity >= 0);
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryPageCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/PageCache.h (160668 => 160669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/PageCache.h        2013-12-16 23:25:31 UTC (rev 160668)
+++ trunk/Source/WebCore/history/PageCache.h        2013-12-16 23:54:09 UTC (rev 160669)
</span><span class="lines">@@ -61,6 +61,9 @@
</span><span class="cx"> // Will mark all cached pages associated with the given page as needing style recalc.
</span><span class="cx"> void markPagesForFullStyleRecalc(Page*);
</span><span class="cx">
</span><ins>+ // Used when memory is low to prune some cached pages.
+ void pruneToCapacityNow(int capacity);
+
</ins><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> void markPagesForCaptionPreferencesChanged();
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>
</body>
</html>