Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (207344 => 207345)
--- trunk/Source/WebCore/CMakeLists.txt 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-10-14 17:14:39 UTC (rev 207345)
@@ -1604,7 +1604,6 @@
fileapi/WebKitBlobBuilder.cpp
history/BackForwardController.cpp
- history/BackForwardList.cpp
history/CachedFrame.cpp
history/CachedPage.cpp
history/HistoryItem.cpp
Modified: trunk/Source/WebCore/ChangeLog (207344 => 207345)
--- trunk/Source/WebCore/ChangeLog 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebCore/ChangeLog 2016-10-14 17:14:39 UTC (rev 207345)
@@ -1,3 +1,20 @@
+2016-10-13 Anders Carlsson <ander...@apple.com>
+
+ Move BackForwardList from WebCore to WebKitLegacy
+ https://bugs.webkit.org/show_bug.cgi?id=163418
+
+ Reviewed by Tim Horton.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * history/BackForwardController.cpp:
+ (WebCore::BackForwardController::BackForwardController):
+ * history/BackForwardController.h:
+ * loader/EmptyClients.cpp:
+ (WebCore::fillWithEmptyClients):
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+
2016-10-14 Manuel Rego Casasnovas <r...@igalia.com>
[css-grid] Changing the argument on fit-content() doesn't cause the grid to be relayout
Modified: trunk/Source/WebCore/PlatformMac.cmake (207344 => 207345)
--- trunk/Source/WebCore/PlatformMac.cmake 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebCore/PlatformMac.cmake 2016-10-14 17:14:39 UTC (rev 207345)
@@ -690,7 +690,6 @@
editing/mac/TextAlternativeWithRange.h
- history/BackForwardList.h
history/HistoryItem.h
history/PageCache.h
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (207344 => 207345)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-10-14 17:14:39 UTC (rev 207345)
@@ -5280,8 +5280,6 @@
BCA846D70DC67A350026C309 /* RenderReplica.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA846D50DC67A350026C309 /* RenderReplica.h */; };
BCA8C81E11E3D36900812FB7 /* BackForwardController.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8C81C11E3D36900812FB7 /* BackForwardController.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCA8C81F11E3D36900812FB7 /* BackForwardController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA8C81D11E3D36900812FB7 /* BackForwardController.cpp */; };
- BCA8CA5F11E4E6D100812FB7 /* BackForwardList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA8CA5D11E4E6D100812FB7 /* BackForwardList.cpp */; };
- BCA8CA6011E4E6D100812FB7 /* BackForwardList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8CA5E11E4E6D100812FB7 /* BackForwardList.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCAA486F14A052530088FAC4 /* PlatformEventFactoryMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCAA486D14A052530088FAC4 /* PlatformEventFactoryMac.mm */; };
BCAA487014A052530088FAC4 /* PlatformEventFactoryMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BCAA486E14A052530088FAC4 /* PlatformEventFactoryMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCAA90C30A7EBA60008B1229 /* Scrollbar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */; };
@@ -12806,8 +12804,6 @@
BCA846D50DC67A350026C309 /* RenderReplica.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderReplica.h; sourceTree = "<group>"; };
BCA8C81C11E3D36900812FB7 /* BackForwardController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackForwardController.h; sourceTree = "<group>"; };
BCA8C81D11E3D36900812FB7 /* BackForwardController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackForwardController.cpp; sourceTree = "<group>"; };
- BCA8CA5D11E4E6D100812FB7 /* BackForwardList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackForwardList.cpp; sourceTree = "<group>"; };
- BCA8CA5E11E4E6D100812FB7 /* BackForwardList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackForwardList.h; sourceTree = "<group>"; };
BCAA486D14A052530088FAC4 /* PlatformEventFactoryMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformEventFactoryMac.mm; sourceTree = "<group>"; };
BCAA486E14A052530088FAC4 /* PlatformEventFactoryMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformEventFactoryMac.h; sourceTree = "<group>"; };
BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Scrollbar.cpp; sourceTree = "<group>"; };
@@ -16698,8 +16694,6 @@
51741D0B0B07259A00ED442C /* BackForwardClient.h */,
BCA8C81D11E3D36900812FB7 /* BackForwardController.cpp */,
BCA8C81C11E3D36900812FB7 /* BackForwardController.h */,
- BCA8CA5D11E4E6D100812FB7 /* BackForwardList.cpp */,
- BCA8CA5E11E4E6D100812FB7 /* BackForwardList.h */,
51C0AA400F2AA15E001648C2 /* CachedFrame.cpp */,
51C0AA380F2AA10A001648C2 /* CachedFrame.h */,
51CBFC980D10E483002DBF51 /* CachedFramePlatformData.h */,
@@ -24000,7 +23994,6 @@
91C9F2F91AE3BEB00095B61C /* AXTextStateChangeIntent.h in Headers */,
51741D0F0B07259A00ED442C /* BackForwardClient.h in Headers */,
BCA8C81E11E3D36900812FB7 /* BackForwardController.h in Headers */,
- BCA8CA6011E4E6D100812FB7 /* BackForwardList.h in Headers */,
BC124EE80C2641CD009E2349 /* BarProp.h in Headers */,
460BB6161D0A1BF000221812 /* Base64Utilities.h in Headers */,
379E61CA126CA5C400B63E8D /* BaseButtonInputType.h in Headers */,
@@ -27779,7 +27772,6 @@
1A299FE71D7F5FA600A60093 /* RenderThemeCocoa.mm in Sources */,
29A8124B0FBB9CA900510293 /* AXObjectCacheMac.mm in Sources */,
BCA8C81F11E3D36900812FB7 /* BackForwardController.cpp in Sources */,
- BCA8CA5F11E4E6D100812FB7 /* BackForwardList.cpp in Sources */,
BC124EE70C2641CD009E2349 /* BarProp.cpp in Sources */,
460BB6151D0A1BF000221812 /* Base64Utilities.cpp in Sources */,
379E61C9126CA5C300B63E8D /* BaseButtonInputType.cpp in Sources */,
Modified: trunk/Source/WebCore/history/BackForwardController.cpp (207344 => 207345)
--- trunk/Source/WebCore/history/BackForwardController.cpp 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebCore/history/BackForwardController.cpp 2016-10-14 17:14:39 UTC (rev 207345)
@@ -26,18 +26,15 @@
#include "config.h"
#include "BackForwardController.h"
-#include "BackForwardList.h"
-#include "HistoryItem.h"
+#include "BackForwardClient.h"
#include "Page.h"
namespace WebCore {
-BackForwardController::BackForwardController(Page& page, RefPtr<BackForwardClient>&& client)
+BackForwardController::BackForwardController(Page& page, Ref<BackForwardClient>&& client)
: m_page(page)
, m_client(WTFMove(client))
{
- if (!m_client)
- m_client = BackForwardList::create(&page);
}
BackForwardController::~BackForwardController()
Modified: trunk/Source/WebCore/history/BackForwardController.h (207344 => 207345)
--- trunk/Source/WebCore/history/BackForwardController.h 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebCore/history/BackForwardController.h 2016-10-14 17:14:39 UTC (rev 207345)
@@ -39,7 +39,7 @@
class BackForwardController {
WTF_MAKE_NONCOPYABLE(BackForwardController); WTF_MAKE_FAST_ALLOCATED;
public:
- BackForwardController(Page&, RefPtr<BackForwardClient>&&);
+ BackForwardController(Page&, Ref<BackForwardClient>&&);
~BackForwardController();
BackForwardClient* client() const { return m_client.get(); }
Deleted: trunk/Source/WebCore/history/BackForwardList.cpp (207344 => 207345)
--- trunk/Source/WebCore/history/BackForwardList.cpp 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebCore/history/BackForwardList.cpp 2016-10-14 17:14:39 UTC (rev 207345)
@@ -1,295 +0,0 @@
-/*
- * Copyright (C) 2005, 2006 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "BackForwardList.h"
-
-#include "Frame.h"
-#include "FrameLoader.h"
-#include "FrameLoaderClient.h"
-#include "HistoryItem.h"
-#include "Logging.h"
-#include "Page.h"
-#include "PageCache.h"
-#include "SerializedScriptValue.h"
-
-namespace WebCore {
-
-static const unsigned DefaultCapacity = 100;
-static const unsigned NoCurrentItemIndex = UINT_MAX;
-
-BackForwardList::BackForwardList(Page* page)
- : m_page(page)
- , m_current(NoCurrentItemIndex)
- , m_capacity(DefaultCapacity)
- , m_closed(true)
- , m_enabled(true)
-{
-}
-
-BackForwardList::~BackForwardList()
-{
- ASSERT(m_closed);
-}
-
-void BackForwardList::addItem(Ref<HistoryItem>&& newItem)
-{
- if (!m_capacity || !m_enabled)
- return;
-
- // Toss anything in the forward list
- if (m_current != NoCurrentItemIndex) {
- unsigned targetSize = m_current + 1;
- while (m_entries.size() > targetSize) {
- Ref<HistoryItem> item = m_entries.takeLast();
- m_entryHash.remove(item.ptr());
- PageCache::singleton().remove(item);
- }
- }
-
- // Toss the first item if the list is getting too big, as long as we're not using it
- // (or even if we are, if we only want 1 entry).
- if (m_entries.size() == m_capacity && (m_current || m_capacity == 1)) {
- Ref<HistoryItem> item = WTFMove(m_entries[0]);
- m_entries.remove(0);
- m_entryHash.remove(item.ptr());
- PageCache::singleton().remove(item);
- --m_current;
- }
-
- m_entryHash.add(newItem.ptr());
- m_entries.insert(m_current + 1, WTFMove(newItem));
- ++m_current;
-}
-
-void BackForwardList::goBack()
-{
- ASSERT(m_current > 0);
- if (m_current > 0) {
- m_current--;
- }
-}
-
-void BackForwardList::goForward()
-{
- ASSERT(m_current < m_entries.size() - 1);
- if (m_current < m_entries.size() - 1) {
- m_current++;
- }
-}
-
-void BackForwardList::goToItem(HistoryItem* item)
-{
- if (!m_entries.size() || !item)
- return;
-
- unsigned int index = 0;
- for (; index < m_entries.size(); ++index)
- if (m_entries[index].ptr() == item)
- break;
- if (index < m_entries.size()) {
- m_current = index;
- }
-}
-
-HistoryItem* BackForwardList::backItem()
-{
- if (m_current && m_current != NoCurrentItemIndex)
- return m_entries[m_current - 1].ptr();
- return nullptr;
-}
-
-HistoryItem* BackForwardList::currentItem()
-{
- if (m_current != NoCurrentItemIndex)
- return m_entries[m_current].ptr();
- return nullptr;
-}
-
-HistoryItem* BackForwardList::forwardItem()
-{
- if (m_entries.size() && m_current < m_entries.size() - 1)
- return m_entries[m_current + 1].ptr();
- return nullptr;
-}
-
-void BackForwardList::backListWithLimit(int limit, Vector<Ref<HistoryItem>>& list)
-{
- list.clear();
- if (m_current != NoCurrentItemIndex) {
- unsigned first = std::max(static_cast<int>(m_current) - limit, 0);
- for (; first < m_current; ++first)
- list.append(m_entries[first].get());
- }
-}
-
-void BackForwardList::forwardListWithLimit(int limit, Vector<Ref<HistoryItem>>& list)
-{
- ASSERT(limit > -1);
- list.clear();
- if (!m_entries.size())
- return;
-
- unsigned lastEntry = m_entries.size() - 1;
- if (m_current < lastEntry) {
- int last = std::min(m_current + limit, lastEntry);
- limit = m_current + 1;
- for (; limit <= last; ++limit)
- list.append(m_entries[limit].get());
- }
-}
-
-int BackForwardList::capacity()
-{
- return m_capacity;
-}
-
-void BackForwardList::setCapacity(int size)
-{
- while (size < static_cast<int>(m_entries.size())) {
- Ref<HistoryItem> item = m_entries.takeLast();
- m_entryHash.remove(item.ptr());
- PageCache::singleton().remove(item);
- }
-
- if (!size)
- m_current = NoCurrentItemIndex;
- else if (m_current > m_entries.size() - 1) {
- m_current = m_entries.size() - 1;
- }
- m_capacity = size;
-}
-
-bool BackForwardList::enabled()
-{
- return m_enabled;
-}
-
-void BackForwardList::setEnabled(bool enabled)
-{
- m_enabled = enabled;
- if (!enabled) {
- int capacity = m_capacity;
- setCapacity(0);
- setCapacity(capacity);
- }
-}
-
-int BackForwardList::backListCount()
-{
- return m_current == NoCurrentItemIndex ? 0 : m_current;
-}
-
-int BackForwardList::forwardListCount()
-{
- return m_current == NoCurrentItemIndex ? 0 : (int)m_entries.size() - (m_current + 1);
-}
-
-HistoryItem* BackForwardList::itemAtIndex(int index)
-{
- // Do range checks without doing math on index to avoid overflow.
- if (index < -static_cast<int>(m_current))
- return nullptr;
-
- if (index > forwardListCount())
- return nullptr;
-
- return m_entries[index + m_current].ptr();
-}
-
-Vector<Ref<HistoryItem>>& BackForwardList::entries()
-{
- return m_entries;
-}
-
-#if PLATFORM(IOS)
-unsigned BackForwardList::current()
-{
- return m_current;
-}
-
-void BackForwardList::setCurrent(unsigned newCurrent)
-{
- m_current = newCurrent;
-}
-
-bool BackForwardList::clearAllPageCaches()
-{
- bool didRemoveAtLeastOneItem = false;
- for (auto& item : m_entries) {
- if (item->isInPageCache()) {
- didRemoveAtLeastOneItem = true;
- PageCache::singleton().remove(item);
- }
- }
- return didRemoveAtLeastOneItem;
-}
-#endif
-
-void BackForwardList::close()
-{
- for (auto& item : m_entries)
- PageCache::singleton().remove(item);
- m_entries.clear();
- m_entryHash.clear();
- m_page = nullptr;
- m_closed = true;
-}
-
-bool BackForwardList::closed()
-{
- return m_closed;
-}
-
-void BackForwardList::removeItem(HistoryItem* item)
-{
- if (!item)
- return;
-
- for (unsigned i = 0; i < m_entries.size(); ++i) {
- if (m_entries[i].ptr() == item) {
- m_entries.remove(i);
- m_entryHash.remove(item);
- if (m_current == NoCurrentItemIndex || m_current < i)
- break;
- if (m_current > i)
- m_current--;
- else {
- size_t count = m_entries.size();
- if (m_current >= count)
- m_current = count ? count - 1 : NoCurrentItemIndex;
- }
- break;
- }
- }
-}
-
-bool BackForwardList::containsItem(HistoryItem* entry)
-{
- return m_entryHash.contains(entry);
-}
-
-}; // namespace WebCore
Deleted: trunk/Source/WebCore/history/BackForwardList.h (207344 => 207345)
--- trunk/Source/WebCore/history/BackForwardList.h 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebCore/history/BackForwardList.h 2016-10-14 17:14:39 UTC (rev 207345)
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
- * Copyright (C) 2009 Google, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BackForwardList_h
-#define BackForwardList_h
-
-#include "BackForwardClient.h"
-#include <wtf/HashSet.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class Page;
-
-typedef HashSet<RefPtr<HistoryItem>> HistoryItemHashSet;
-
-class BackForwardList : public BackForwardClient {
-public:
- static Ref<BackForwardList> create(Page* page) { return adoptRef(*new BackForwardList(page)); }
- virtual ~BackForwardList();
-
- Page* page() { return m_page; }
-
- void addItem(Ref<HistoryItem>&&) override;
- WEBCORE_EXPORT void goBack();
- WEBCORE_EXPORT void goForward();
- void goToItem(HistoryItem*) override;
-
- WEBCORE_EXPORT HistoryItem* backItem();
- WEBCORE_EXPORT HistoryItem* currentItem();
- WEBCORE_EXPORT HistoryItem* forwardItem();
- HistoryItem* itemAtIndex(int) override;
-
- WEBCORE_EXPORT void backListWithLimit(int, Vector<Ref<HistoryItem>>&);
- WEBCORE_EXPORT void forwardListWithLimit(int, Vector<Ref<HistoryItem>>&);
-
- WEBCORE_EXPORT int capacity();
- WEBCORE_EXPORT void setCapacity(int);
- WEBCORE_EXPORT bool enabled();
- WEBCORE_EXPORT void setEnabled(bool);
- int backListCount() override;
- int forwardListCount() override;
- WEBCORE_EXPORT bool containsItem(HistoryItem*);
-
- void close() override;
- WEBCORE_EXPORT bool closed();
-
- WEBCORE_EXPORT void removeItem(HistoryItem*);
- WEBCORE_EXPORT Vector<Ref<HistoryItem>>& entries();
-
-#if PLATFORM(IOS)
- unsigned current() override;
- void setCurrent(unsigned newCurrent) override;
-
- bool clearAllPageCaches() override;
-#endif
-
-private:
- WEBCORE_EXPORT explicit BackForwardList(Page*);
-
- Page* m_page;
- Vector<Ref<HistoryItem>> m_entries;
- HistoryItemHashSet m_entryHash;
- unsigned m_current;
- unsigned m_capacity;
- bool m_closed;
- bool m_enabled;
-};
-
-} // namespace WebCore
-
-#endif // BackForwardList_h
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (207344 => 207345)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2016-10-14 17:14:39 UTC (rev 207345)
@@ -29,6 +29,7 @@
#include "EmptyClients.h"
#include "ApplicationCacheStorage.h"
+#include "BackForwardClient.h"
#include "ColorChooser.h"
#include "DOMWrapperWorld.h"
#include "DatabaseProvider.h"
@@ -140,6 +141,21 @@
void addVisitedLink(Page&, LinkHash) override { }
};
+class EmptyBackForwardClient final : public BackForwardClient {
+ void addItem(Ref<HistoryItem>&&) override { }
+ void goToItem(HistoryItem*) override { }
+ HistoryItem* itemAtIndex(int) override { return nullptr; }
+ int backListCount() override { return 0; }
+ int forwardListCount() override { return 0; }
+ void close() override { }
+
+#if PLATFORM(IOS)
+ unsigned current() override { return 0; }
+ void setCurrent(unsigned) override { }
+ bool clearAllPageCaches() override { return false; }
+#endif
+};
+
void fillWithEmptyClients(PageConfiguration& pageConfiguration)
{
static NeverDestroyed<EmptyChromeClient> dummyChromeClient;
@@ -169,6 +185,7 @@
static NeverDestroyed<EmptyProgressTrackerClient> dummyProgressTrackerClient;
pageConfiguration.progressTrackerClient = &dummyProgressTrackerClient.get();
+ pageConfiguration.backForwardClient = adoptRef(new EmptyBackForwardClient);
pageConfiguration.diagnosticLoggingClient = std::make_unique<EmptyDiagnosticLoggingClient>();
pageConfiguration.applicationCacheStorage = ApplicationCacheStorage::create(String(), String());
Modified: trunk/Source/WebCore/page/Page.cpp (207344 => 207345)
--- trunk/Source/WebCore/page/Page.cpp 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebCore/page/Page.cpp 2016-10-14 17:14:39 UTC (rev 207345)
@@ -178,7 +178,7 @@
#endif
, m_settings(Settings::create(this))
, m_progress(std::make_unique<ProgressTracker>(*pageConfiguration.progressTrackerClient))
- , m_backForwardController(std::make_unique<BackForwardController>(*this, WTFMove(pageConfiguration.backForwardClient)))
+ , m_backForwardController(std::make_unique<BackForwardController>(*this, *WTFMove(pageConfiguration.backForwardClient)))
, m_mainFrame(MainFrame::create(*this, pageConfiguration))
, m_theme(RenderTheme::themeForPage(this))
, m_editorClient(WTFMove(pageConfiguration.editorClient))
Modified: trunk/Source/WebKit/ChangeLog (207344 => 207345)
--- trunk/Source/WebKit/ChangeLog 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebKit/ChangeLog 2016-10-14 17:14:39 UTC (rev 207345)
@@ -1,3 +1,12 @@
+2016-10-13 Anders Carlsson <ander...@apple.com>
+
+ Move BackForwardList from WebCore to WebKitLegacy
+ https://bugs.webkit.org/show_bug.cgi?id=163418
+
+ Reviewed by Tim Horton.
+
+ * WebKit.xcodeproj/project.pbxproj:
+
2016-10-12 Anders Carlsson <ander...@apple.com>
Copy BackForwardList from WebCore to WebKit/win
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (207344 => 207345)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2016-10-14 17:14:39 UTC (rev 207345)
@@ -55,6 +55,8 @@
1A86CCD41AD48A620074BA89 /* WebApplicationCacheInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A86CCD31AD48A620074BA89 /* WebApplicationCacheInternal.h */; };
1A8DED500EE88B8A00F25022 /* HostedNetscapePluginStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8DED4E0EE88B8A00F25022 /* HostedNetscapePluginStream.h */; };
1A8DED510EE88B8A00F25022 /* HostedNetscapePluginStream.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A8DED4F0EE88B8A00F25022 /* HostedNetscapePluginStream.mm */; };
+ 1A9119F61DB0470A0087D1FD /* BackForwardList.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A9119F41DB0470A0087D1FD /* BackForwardList.mm */; };
+ 1A9119F71DB0470A0087D1FD /* BackForwardList.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9119F51DB0470A0087D1FD /* BackForwardList.h */; };
1AA83F831A5C4AE400026EC6 /* WebDatabaseProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA83F811A5C4AE400026EC6 /* WebDatabaseProvider.cpp */; };
1AA83F841A5C4AE400026EC6 /* WebDatabaseProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA83F821A5C4AE400026EC6 /* WebDatabaseProvider.h */; };
1AA879B611CBE9BF003C664F /* WebPlatformStrategies.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA879B411CBE9BF003C664F /* WebPlatformStrategies.h */; };
@@ -849,6 +851,8 @@
1A86CCD31AD48A620074BA89 /* WebApplicationCacheInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebApplicationCacheInternal.h; sourceTree = "<group>"; };
1A8DED4E0EE88B8A00F25022 /* HostedNetscapePluginStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HostedNetscapePluginStream.h; sourceTree = "<group>"; };
1A8DED4F0EE88B8A00F25022 /* HostedNetscapePluginStream.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HostedNetscapePluginStream.mm; sourceTree = "<group>"; };
+ 1A9119F41DB0470A0087D1FD /* BackForwardList.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BackForwardList.mm; sourceTree = "<group>"; };
+ 1A9119F51DB0470A0087D1FD /* BackForwardList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackForwardList.h; sourceTree = "<group>"; };
1AA83F811A5C4AE400026EC6 /* WebDatabaseProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebDatabaseProvider.cpp; path = ../../Storage/WebDatabaseProvider.cpp; sourceTree = "<group>"; };
1AA83F821A5C4AE400026EC6 /* WebDatabaseProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebDatabaseProvider.h; path = ../../Storage/WebDatabaseProvider.h; sourceTree = "<group>"; };
1AA879B411CBE9BF003C664F /* WebPlatformStrategies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPlatformStrategies.h; sourceTree = "<group>"; };
@@ -1848,6 +1852,8 @@
25A8176801B5474B0ECA149E /* History */ = {
isa = PBXGroup;
children = (
+ 1A9119F41DB0470A0087D1FD /* BackForwardList.mm */,
+ 1A9119F51DB0470A0087D1FD /* BackForwardList.h */,
1A60518D17502A5D00BC62F5 /* BinaryPropertyList.cpp */,
1A60518E17502A5D00BC62F5 /* BinaryPropertyList.h */,
1A60519017502A5D00BC62F5 /* HistoryPropertyList.h */,
@@ -2895,6 +2901,7 @@
93D437651D57ABEF00AB85EA /* DOMProcessingInstructionInternal.h in Headers */,
93D437661D57ABEF00AB85EA /* DOMProgressEvent.h in Headers */,
93D437681D57ABEF00AB85EA /* DOMRange.h in Headers */,
+ 1A9119F71DB0470A0087D1FD /* BackForwardList.h in Headers */,
93D4376A1D57ABEF00AB85EA /* DOMRangeException.h in Headers */,
93D4376B1D57ABEF00AB85EA /* DOMRangeInternal.h in Headers */,
93D4376C1D57ABEF00AB85EA /* DOMRanges.h in Headers */,
@@ -3539,6 +3546,7 @@
CEDA12DB152CBE6800D9E08D /* WebAlternativeTextClient.mm in Sources */,
B6CE5C24100BC5CE00219936 /* WebApplicationCache.mm in Sources */,
A5DEFC1411D5344B00885273 /* WebApplicationCacheQuotaManager.mm in Sources */,
+ 1A9119F61DB0470A0087D1FD /* BackForwardList.mm in Sources */,
9398111D0824BF01008DF038 /* WebArchive.mm in Sources */,
939810CF0824BF01008DF038 /* WebAuthenticationPanel.m in Sources */,
939810BC0824BF01008DF038 /* WebBackForwardList.mm in Sources */,
Modified: trunk/Source/WebKit/mac/ChangeLog (207344 => 207345)
--- trunk/Source/WebKit/mac/ChangeLog 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-10-14 17:14:39 UTC (rev 207345)
@@ -1,5 +1,31 @@
2016-10-13 Anders Carlsson <ander...@apple.com>
+ Move BackForwardList from WebCore to WebKitLegacy
+ https://bugs.webkit.org/show_bug.cgi?id=163418
+
+ Reviewed by Tim Horton.
+
+ * History/BackForwardList.h: Renamed from Source/WebCore/history/BackForwardList.h.
+ (BackForwardList::create):
+ (BackForwardList::webView):
+ * History/BackForwardList.mm: Renamed from Source/WebCore/history/BackForwardList.cpp.
+ (BackForwardList::BackForwardList):
+ (BackForwardList::close):
+ (BackForwardList::containsItem):
+ * History/WebBackForwardList.mm:
+ (kit):
+ (-[WebBackForwardList initWithBackForwardList:]):
+ (-[WebBackForwardList setPageCacheSize:]):
+ (-[WebBackForwardList pageCacheSize]):
+ * History/WebBackForwardListInternal.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ * WebView/WebFrameView.mm:
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+ (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
+
+2016-10-13 Anders Carlsson <ander...@apple.com>
+
Get rid of the HistoryItemVector typedef
https://bugs.webkit.org/show_bug.cgi?id=163398
Copied: trunk/Source/WebKit/mac/History/BackForwardList.h (from rev 207344, trunk/Source/WebCore/history/BackForwardList.h) (0 => 207345)
--- trunk/Source/WebKit/mac/History/BackForwardList.h (rev 0)
+++ trunk/Source/WebKit/mac/History/BackForwardList.h 2016-10-14 17:14:39 UTC (rev 207345)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2009 Google, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <WebCore/BackForwardClient.h>
+#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
+
+OBJC_CLASS WebView;
+
+typedef HashSet<RefPtr<WebCore::HistoryItem>> HistoryItemHashSet;
+
+class BackForwardList : public WebCore::BackForwardClient {
+public:
+ static Ref<BackForwardList> create(WebView *webView) { return adoptRef(*new BackForwardList(webView)); }
+ virtual ~BackForwardList();
+
+ WebView *webView() { return m_webView; }
+
+ void addItem(Ref<WebCore::HistoryItem>&&) override;
+ WEBCORE_EXPORT void goBack();
+ WEBCORE_EXPORT void goForward();
+ void goToItem(WebCore::HistoryItem*) override;
+
+ WEBCORE_EXPORT WebCore::HistoryItem* backItem();
+ WEBCORE_EXPORT WebCore::HistoryItem* currentItem();
+ WEBCORE_EXPORT WebCore::HistoryItem* forwardItem();
+ WebCore::HistoryItem* itemAtIndex(int) override;
+
+ WEBCORE_EXPORT void backListWithLimit(int, Vector<Ref<WebCore::HistoryItem>>&);
+ WEBCORE_EXPORT void forwardListWithLimit(int, Vector<Ref<WebCore::HistoryItem>>&);
+
+ WEBCORE_EXPORT int capacity();
+ WEBCORE_EXPORT void setCapacity(int);
+ WEBCORE_EXPORT bool enabled();
+ WEBCORE_EXPORT void setEnabled(bool);
+ int backListCount() override;
+ int forwardListCount() override;
+ WEBCORE_EXPORT bool containsItem(WebCore::HistoryItem*);
+
+ void close() override;
+ WEBCORE_EXPORT bool closed();
+
+ WEBCORE_EXPORT void removeItem(WebCore::HistoryItem*);
+ WEBCORE_EXPORT Vector<Ref<WebCore::HistoryItem>>& entries();
+
+#if PLATFORM(IOS)
+ unsigned current() override;
+ void setCurrent(unsigned newCurrent) override;
+
+ bool clearAllPageCaches() override;
+#endif
+
+private:
+ WEBCORE_EXPORT explicit BackForwardList(WebView *);
+
+ WebView* m_webView;
+ Vector<Ref<WebCore::HistoryItem>> m_entries;
+ HistoryItemHashSet m_entryHash;
+ unsigned m_current;
+ unsigned m_capacity;
+ bool m_closed;
+ bool m_enabled;
+};
Copied: trunk/Source/WebKit/mac/History/BackForwardList.mm (from rev 207344, trunk/Source/WebCore/history/BackForwardList.cpp) (0 => 207345)
--- trunk/Source/WebKit/mac/History/BackForwardList.mm (rev 0)
+++ trunk/Source/WebKit/mac/History/BackForwardList.mm 2016-10-14 17:14:39 UTC (rev 207345)
@@ -0,0 +1,284 @@
+/*
+ * Copyright (C) 2005, 2006 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "BackForwardList.h"
+
+#include <WebCore/PageCache.h>
+
+using namespace WebCore;
+
+static const unsigned DefaultCapacity = 100;
+static const unsigned NoCurrentItemIndex = UINT_MAX;
+
+BackForwardList::BackForwardList(WebView *webView)
+ : m_webView(webView)
+ , m_current(NoCurrentItemIndex)
+ , m_capacity(DefaultCapacity)
+ , m_closed(true)
+ , m_enabled(true)
+{
+}
+
+BackForwardList::~BackForwardList()
+{
+ ASSERT(m_closed);
+}
+
+void BackForwardList::addItem(Ref<HistoryItem>&& newItem)
+{
+ if (!m_capacity || !m_enabled)
+ return;
+
+ // Toss anything in the forward list
+ if (m_current != NoCurrentItemIndex) {
+ unsigned targetSize = m_current + 1;
+ while (m_entries.size() > targetSize) {
+ Ref<HistoryItem> item = m_entries.takeLast();
+ m_entryHash.remove(item.ptr());
+ PageCache::singleton().remove(item);
+ }
+ }
+
+ // Toss the first item if the list is getting too big, as long as we're not using it
+ // (or even if we are, if we only want 1 entry).
+ if (m_entries.size() == m_capacity && (m_current || m_capacity == 1)) {
+ Ref<HistoryItem> item = WTFMove(m_entries[0]);
+ m_entries.remove(0);
+ m_entryHash.remove(item.ptr());
+ PageCache::singleton().remove(item);
+ --m_current;
+ }
+
+ m_entryHash.add(newItem.ptr());
+ m_entries.insert(m_current + 1, WTFMove(newItem));
+ ++m_current;
+}
+
+void BackForwardList::goBack()
+{
+ ASSERT(m_current > 0);
+ if (m_current > 0)
+ m_current--;
+}
+
+void BackForwardList::goForward()
+{
+ ASSERT(m_current < m_entries.size() - 1);
+ if (m_current < m_entries.size() - 1)
+ m_current++;
+}
+
+void BackForwardList::goToItem(HistoryItem* item)
+{
+ if (!m_entries.size() || !item)
+ return;
+
+ unsigned index = 0;
+ for (; index < m_entries.size(); ++index) {
+ if (m_entries[index].ptr() == item)
+ break;
+ }
+
+ if (index < m_entries.size())
+ m_current = index;
+}
+
+HistoryItem* BackForwardList::backItem()
+{
+ if (m_current && m_current != NoCurrentItemIndex)
+ return m_entries[m_current - 1].ptr();
+ return nullptr;
+}
+
+HistoryItem* BackForwardList::currentItem()
+{
+ if (m_current != NoCurrentItemIndex)
+ return m_entries[m_current].ptr();
+ return nullptr;
+}
+
+HistoryItem* BackForwardList::forwardItem()
+{
+ if (m_entries.size() && m_current < m_entries.size() - 1)
+ return m_entries[m_current + 1].ptr();
+ return nullptr;
+}
+
+void BackForwardList::backListWithLimit(int limit, Vector<Ref<HistoryItem>>& list)
+{
+ list.clear();
+ if (m_current != NoCurrentItemIndex) {
+ unsigned first = std::max(static_cast<int>(m_current) - limit, 0);
+ for (; first < m_current; ++first)
+ list.append(m_entries[first].get());
+ }
+}
+
+void BackForwardList::forwardListWithLimit(int limit, Vector<Ref<HistoryItem>>& list)
+{
+ ASSERT(limit > -1);
+ list.clear();
+ if (!m_entries.size())
+ return;
+
+ unsigned lastEntry = m_entries.size() - 1;
+ if (m_current < lastEntry) {
+ int last = std::min(m_current + limit, lastEntry);
+ limit = m_current + 1;
+ for (; limit <= last; ++limit)
+ list.append(m_entries[limit].get());
+ }
+}
+
+int BackForwardList::capacity()
+{
+ return m_capacity;
+}
+
+void BackForwardList::setCapacity(int size)
+{
+ while (size < static_cast<int>(m_entries.size())) {
+ Ref<HistoryItem> item = m_entries.takeLast();
+ m_entryHash.remove(item.ptr());
+ PageCache::singleton().remove(item);
+ }
+
+ if (!size)
+ m_current = NoCurrentItemIndex;
+ else if (m_current > m_entries.size() - 1)
+ m_current = m_entries.size() - 1;
+
+ m_capacity = size;
+}
+
+bool BackForwardList::enabled()
+{
+ return m_enabled;
+}
+
+void BackForwardList::setEnabled(bool enabled)
+{
+ m_enabled = enabled;
+ if (!enabled) {
+ int capacity = m_capacity;
+ setCapacity(0);
+ setCapacity(capacity);
+ }
+}
+
+int BackForwardList::backListCount()
+{
+ return m_current == NoCurrentItemIndex ? 0 : m_current;
+}
+
+int BackForwardList::forwardListCount()
+{
+ return m_current == NoCurrentItemIndex ? 0 : (int)m_entries.size() - (m_current + 1);
+}
+
+HistoryItem* BackForwardList::itemAtIndex(int index)
+{
+ // Do range checks without doing math on index to avoid overflow.
+ if (index < -static_cast<int>(m_current))
+ return nullptr;
+
+ if (index > forwardListCount())
+ return nullptr;
+
+ return m_entries[index + m_current].ptr();
+}
+
+Vector<Ref<HistoryItem>>& BackForwardList::entries()
+{
+ return m_entries;
+}
+
+#if PLATFORM(IOS)
+unsigned BackForwardList::current()
+{
+ return m_current;
+}
+
+void BackForwardList::setCurrent(unsigned newCurrent)
+{
+ m_current = newCurrent;
+}
+
+bool BackForwardList::clearAllPageCaches()
+{
+ bool didRemoveAtLeastOneItem = false;
+ for (auto& item : m_entries) {
+ if (item->isInPageCache()) {
+ didRemoveAtLeastOneItem = true;
+ PageCache::singleton().remove(item);
+ }
+ }
+ return didRemoveAtLeastOneItem;
+}
+#endif
+
+void BackForwardList::close()
+{
+ for (auto& item : m_entries)
+ PageCache::singleton().remove(item);
+ m_entries.clear();
+ m_entryHash.clear();
+ m_webView = nullptr;
+ m_closed = true;
+}
+
+bool BackForwardList::closed()
+{
+ return m_closed;
+}
+
+void BackForwardList::removeItem(HistoryItem* item)
+{
+ if (!item)
+ return;
+
+ for (unsigned i = 0; i < m_entries.size(); ++i) {
+ if (m_entries[i].ptr() == item) {
+ m_entries.remove(i);
+ m_entryHash.remove(item);
+ if (m_current == NoCurrentItemIndex || m_current < i)
+ break;
+ if (m_current > i)
+ m_current--;
+ else {
+ size_t count = m_entries.size();
+ if (m_current >= count)
+ m_current = count ? count - 1 : NoCurrentItemIndex;
+ }
+ break;
+ }
+ }
+}
+
+bool BackForwardList::containsItem(HistoryItem* entry)
+{
+ return m_entryHash.contains(entry);
+}
Modified: trunk/Source/WebKit/mac/History/WebBackForwardList.mm (207344 => 207345)
--- trunk/Source/WebKit/mac/History/WebBackForwardList.mm 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebKit/mac/History/WebBackForwardList.mm 2016-10-14 17:14:39 UTC (rev 207345)
@@ -29,6 +29,7 @@
#import "WebBackForwardList.h"
#import "WebBackForwardListInternal.h"
+#import "BackForwardList.h"
#import "WebFrameInternal.h"
#import "WebHistoryItemInternal.h"
#import "WebHistoryItemPrivate.h"
@@ -38,7 +39,6 @@
#import "WebPreferencesPrivate.h"
#import "WebTypesInternal.h"
#import "WebViewPrivate.h"
-#import <WebCore/BackForwardList.h>
#import <WebCore/HistoryItem.h>
#import <WebCore/Page.h>
#import <WebCore/PageCache.h>
@@ -82,10 +82,10 @@
if (WebBackForwardList *webBackForwardList = backForwardLists().get(backForwardList))
return webBackForwardList;
- return [[[WebBackForwardList alloc] initWithBackForwardList:backForwardList] autorelease];
+ return [[[WebBackForwardList alloc] initWithBackForwardList:*backForwardList] autorelease];
}
-- (id)initWithBackForwardList:(PassRefPtr<BackForwardList>)backForwardList
+- (id)initWithBackForwardList:(Ref<BackForwardList>&&)backForwardList
{
WebCoreThreadViolationCheckRoundOne();
self = [super init];
@@ -92,7 +92,7 @@
if (!self)
return nil;
- _private = reinterpret_cast<WebBackForwardListPrivate*>(backForwardList.leakRef());
+ _private = reinterpret_cast<WebBackForwardListPrivate*>(&backForwardList.leakRef());
backForwardLists().set(core(self), self);
return self;
}
@@ -332,12 +332,12 @@
- (void)setPageCacheSize:(NSUInteger)size
{
- [kit(core(self)->page()) setUsesPageCache:size != 0];
+ [core(self)->webView() setUsesPageCache:size != 0];
}
- (NSUInteger)pageCacheSize
{
- return [kit(core(self)->page()) usesPageCache] ? PageCache::singleton().maxSize() : 0;
+ return [core(self)->webView() usesPageCache] ? PageCache::singleton().maxSize() : 0;
}
- (int)backListCount
Modified: trunk/Source/WebKit/mac/History/WebBackForwardListInternal.h (207344 => 207345)
--- trunk/Source/WebKit/mac/History/WebBackForwardListInternal.h 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebKit/mac/History/WebBackForwardListInternal.h 2016-10-14 17:14:39 UTC (rev 207345)
@@ -29,13 +29,11 @@
#import <WebKitLegacy/WebBackForwardList.h>
#import <wtf/PassRefPtr.h>
-namespace WebCore {
class BackForwardList;
-}
-WebCore::BackForwardList* core(WebBackForwardList *);
-WebBackForwardList *kit(WebCore::BackForwardList*);
+BackForwardList* core(WebBackForwardList *);
+WebBackForwardList *kit(BackForwardList*);
@interface WebBackForwardList ()
-- (id)initWithBackForwardList:(PassRefPtr<WebCore::BackForwardList>)backForwardList;
+- (id)initWithBackForwardList:(Ref<BackForwardList>&&)backForwardList;
@end
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (207344 => 207345)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm 2016-10-14 17:14:39 UTC (rev 207345)
@@ -28,6 +28,7 @@
#import "WebFrameLoaderClient.h"
+#import "BackForwardList.h"
#import "DOMElementInternal.h"
#import "DOMHTMLFormElementInternal.h"
#import "WebBackForwardList.h"
@@ -75,7 +76,6 @@
#import <WebCore/AuthenticationCF.h>
#import <WebCore/AuthenticationMac.h>
#import <WebCore/BackForwardController.h>
-#import <WebCore/BackForwardList.h>
#import <WebCore/CachedFrame.h>
#import <WebCore/Chrome.h>
#import <WebCore/DNS.h>
Modified: trunk/Source/WebKit/mac/WebView/WebFrameView.mm (207344 => 207345)
--- trunk/Source/WebKit/mac/WebView/WebFrameView.mm 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebKit/mac/WebView/WebFrameView.mm 2016-10-14 17:14:39 UTC (rev 207345)
@@ -28,6 +28,7 @@
#import "WebFrameView.h"
+#import "BackForwardList.h"
#import "WebClipView.h"
#import "WebDataSourcePrivate.h"
#import "WebDocument.h"
@@ -52,7 +53,6 @@
#import "WebViewPrivate.h"
#import <Foundation/NSURLRequest.h>
#import <WebCore/BackForwardController.h>
-#import <WebCore/BackForwardList.h>
#import <WebCore/DragController.h>
#import <WebCore/EventHandler.h>
#import <WebCore/Frame.h>
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (207344 => 207345)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2016-10-14 16:23:42 UTC (rev 207344)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2016-10-14 17:14:39 UTC (rev 207345)
@@ -31,6 +31,7 @@
#import "WebViewInternal.h"
#import "WebViewData.h"
+#import "BackForwardList.h"
#import "DOMCSSStyleDeclarationInternal.h"
#import "DOMDocumentInternal.h"
#import "DOMInternal.h"
@@ -121,7 +122,6 @@
#import <WebCore/AnimationController.h>
#import <WebCore/ApplicationCacheStorage.h>
#import <WebCore/BackForwardController.h>
-#import <WebCore/BackForwardList.h>
#import <WebCore/CFNetworkSPI.h>
#import <WebCore/Chrome.h>
#import <WebCore/ColorMac.h>
@@ -1032,6 +1032,8 @@
pageConfiguration.inspectorClient = new WebInspectorClient(self);
#endif
+ pageConfiguration.backForwardClient = BackForwardList::create(self);
+
#if ENABLE(APPLE_PAY)
pageConfiguration.paymentCoordinatorClient = new WebPaymentCoordinatorClient();
#endif
@@ -1281,6 +1283,7 @@
pageConfiguration.paymentCoordinatorClient = new WebPaymentCoordinatorClient();
#endif
+ pageConfiguration.backForwardClient = BackForwardList::create(self);
pageConfiguration.inspectorClient = new WebInspectorClient(self);
pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(self);