<!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  &lt;dabates@apple.com&gt;
</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  &lt;dabates@apple.com&gt;
+
</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 &lt; length; ++i) {
+        HistoryItem* item = m_entries[i].get();
+        if (item-&gt;isInPageCache()) {
+            didRemoveAtLeastOneItem = true;
+            pageCache()-&gt;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&amp; 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]-&gt;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-&gt;domWindow()) {
+            // FIXME: Add SCROLL_LISTENER to the list of event types on Document, and use m_document-&gt;hasListenerType(). See &lt;rdar://problem/9615482&gt;.
+            if (domWindow-&gt;scrollEventListenerCount() &amp;&amp; frame.page())
+                frame.page()-&gt;chrome().client().setNeedsScrollNotifications(&amp;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-&gt;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-&gt;enqueuePopstateEvent(historyItem &amp;&amp; historyItem-&gt;stateObject() ? historyItem-&gt;stateObject() : SerializedScriptValue::nullValue());
</span><span class="cx"> 
</span><del>-#if ENABLE(TOUCH_EVENTS)
</del><ins>+#if ENABLE(TOUCH_EVENTS) &amp;&amp; !PLATFORM(IOS)
</ins><span class="cx">     if (m_document-&gt;hasTouchEventHandlers())
</span><span class="cx">         m_document-&gt;page()-&gt;chrome().client().needTouchEvents(true);
</span><span class="cx"> #endif
</span><span class="lines">@@ -209,6 +221,14 @@
</span><span class="cx">         LOG(PageCache, &quot;Finished creating CachedFrame for child frame with url '%s' and DocumentLoader %p\n&quot;, 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-&gt;domWindow()) {
+            if (domWindow-&gt;scrollEventListenerCount() &amp;&amp; frame.page())
+                frame.page()-&gt;chrome().client().setNeedsScrollNotifications(&amp;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 &lt;wtf/RefCountedLeakCounter.h&gt;
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#include &quot;FrameSelection.h&quot;
+#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-&gt;focusedElement())
</del><ins>+    if (Element* element = focusedDocument-&gt;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-&gt;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 = &amp;page.mainFrame(); frame; frame = frame-&gt;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-&gt;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 &lt;wtf/RefCounted.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#include &quot;ViewportArguments.h&quot;
+#endif
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> typedef struct objc_object* id;
</span><span class="lines">@@ -206,6 +210,24 @@
</span><span class="cx">     const Vector&lt;int&gt;&amp; dailyVisitCounts() const { return m_dailyVisitCounts; }
</span><span class="cx">     const Vector&lt;int&gt;&amp; 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&amp; viewportArguments() const { return m_viewportArguments; }
+    void setViewportArguments(const ViewportArguments&amp; 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&amp; sharedLinkUniqueidentifier) { m_sharedLinkUniqueIdentifier = sharedLinkUniqueidentifier; }
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     HistoryItem();
</span><span class="cx">     HistoryItem(const String&amp; urlString, const String&amp; 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&lt;CachedPage&gt; 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&lt;id&gt; m_viewState;
</span><span class="cx">     OwnPtr&lt;HashMap&lt;String, RetainPtr&lt;id&gt;&gt;&gt; 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 &quot;DeviceProximityController.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#include &quot;MemoryPressureHandler.h&quot;
+#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-&gt;loader().documentLoader()-&gt;mainDocumentError().isNull()) {
</span><span class="cx">         PCLOG(&quot;   -Main document has an error&quot;);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">         rejectReasons |= 1 &lt;&lt; MainDocumentError;
</span><ins>+#else
+        if (frame-&gt;loader().documentLoader()-&gt;mainDocumentError().isCancellation() &amp;&amp; frame-&gt;loader().documentLoader()-&gt;subresourceLoadersArePageCacheAcceptable())
+            PCLOG(&quot;    -But, it was a cancellation and all loaders during the cancel were loading images.&quot;);
+        else
+            rejectReasons |= 1 &lt;&lt; MainDocumentError;
+#endif
</ins><span class="cx">     }
</span><span class="cx">     if (frame-&gt;loader().documentLoader()-&gt;substituteData().isValid() &amp;&amp; frame-&gt;loader().documentLoader()-&gt;substituteData().failingURL().isEmpty()) {
</span><span class="cx">         PCLOG(&quot;   -Frame is an error page&quot;);
</span><span class="lines">@@ -121,7 +132,12 @@
</span><span class="cx">     }
</span><span class="cx">     if (frame-&gt;document()-&gt;domWindow() &amp;&amp; frame-&gt;document()-&gt;domWindow()-&gt;hasEventListeners(eventNames().unloadEvent)) {
</span><span class="cx">         PCLOG(&quot;   -Frame has an unload event listener&quot;);
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">         rejectReasons |= 1 &lt;&lt; HasUnloadListener;
</span><ins>+#else
+        // iOS allows pages with unload event listeners to enter the page cache.
+        PCLOG(&quot;    -BUT iOS allows these pages to be cached.&quot;);
+#endif
</ins><span class="cx">     }
</span><span class="cx"> #if ENABLE(SQL_DATABASE)
</span><span class="cx">     if (DatabaseManager::manager().hasOpenDatabases(frame-&gt;document())) {
</span><span class="lines">@@ -223,7 +239,7 @@
</span><span class="cx">         PCLOG(&quot;   -Page settings says b/f cache disabled&quot;);
</span><span class="cx">         rejectReasons |= 1 &lt;&lt; DisabledPageCache;
</span><span class="cx">     }
</span><del>-#if ENABLE(DEVICE_ORIENTATION)
</del><ins>+#if ENABLE(DEVICE_ORIENTATION) &amp;&amp; !PLATFORM(IOS)
</ins><span class="cx">     if (DeviceMotionController::isActiveAt(page)) {
</span><span class="cx">         PCLOG(&quot;   -Page is using DeviceMotion&quot;);
</span><span class="cx">         rejectReasons |= 1 &lt;&lt; UsesDeviceMotion;
</span><span class="lines">@@ -312,12 +328,18 @@
</span><span class="cx">     Document* document = frame-&gt;document();
</span><span class="cx">     
</span><span class="cx">     return documentLoader
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">         &amp;&amp; documentLoader-&gt;mainDocumentError().isNull()
</span><ins>+#else
+        &amp;&amp; (documentLoader-&gt;mainDocumentError().isNull() || (documentLoader-&gt;mainDocumentError().isCancellation() &amp;&amp; documentLoader-&gt;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">         &amp;&amp; !(documentLoader-&gt;substituteData().isValid() &amp;&amp; !documentLoader-&gt;substituteData().failingURL().isEmpty())
</span><span class="cx">         &amp;&amp; (!frameLoader.subframeLoader().containsPlugins() || frame-&gt;page()-&gt;settings().pageCacheSupportsPlugins())
</span><span class="cx">         &amp;&amp; (!document-&gt;url().protocolIs(&quot;https&quot;) || (!documentLoader-&gt;response().cacheControlContainsNoCache() &amp;&amp; !documentLoader-&gt;response().cacheControlContainsNoStore()))
</span><ins>+#if !PLATFORM(IOS)
</ins><span class="cx">         &amp;&amp; (!document-&gt;domWindow() || !document-&gt;domWindow()-&gt;hasEventListeners(eventNames().unloadEvent))
</span><ins>+#endif
</ins><span class="cx"> #if ENABLE(SQL_DATABASE)
</span><span class="cx">         &amp;&amp; !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">         &amp;&amp; canCachePageContainingThisFrame(&amp;page-&gt;mainFrame())
</span><span class="cx">         &amp;&amp; page-&gt;backForward().isActive()
</span><span class="cx">         &amp;&amp; page-&gt;settings().usesPageCache()
</span><del>-#if ENABLE(DEVICE_ORIENTATION)
</del><ins>+#if ENABLE(DEVICE_ORIENTATION) &amp;&amp; !PLATFORM(IOS)
</ins><span class="cx">         &amp;&amp; !DeviceMotionController::isActiveAt(page)
</span><span class="cx">         &amp;&amp; !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 &gt;= 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>