Title: [170394] trunk/Source/WebKit2
Revision
170394
Author
ander...@apple.com
Date
2014-06-24 15:24:23 -0700 (Tue, 24 Jun 2014)

Log Message

Add SPI for clearing an entire back-forward list
https://bugs.webkit.org/show_bug.cgi?id=134274

Reviewed by Dan Bernstein.

Add -[WKBackForwardList _clear] which only clears the back-forward items, and
change -[WKBackForwardList _removeAllItems] to remove all items including the current one.

* UIProcess/API/Cocoa/WKBackForwardList.mm:
(-[WKBackForwardList _removeAllItems]):
(-[WKBackForwardList _clear]):
* UIProcess/API/Cocoa/WKBackForwardListPrivate.h:
* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::removeAllItems):
* UIProcess/WebBackForwardList.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (170393 => 170394)


--- trunk/Source/WebKit2/ChangeLog	2014-06-24 22:02:54 UTC (rev 170393)
+++ trunk/Source/WebKit2/ChangeLog	2014-06-24 22:24:23 UTC (rev 170394)
@@ -1,5 +1,23 @@
 2014-06-24  Anders Carlsson  <ander...@apple.com>
 
+        Add SPI for clearing an entire back-forward list
+        https://bugs.webkit.org/show_bug.cgi?id=134274
+
+        Reviewed by Dan Bernstein.
+
+        Add -[WKBackForwardList _clear] which only clears the back-forward items, and
+        change -[WKBackForwardList _removeAllItems] to remove all items including the current one.
+
+        * UIProcess/API/Cocoa/WKBackForwardList.mm:
+        (-[WKBackForwardList _removeAllItems]):
+        (-[WKBackForwardList _clear]):
+        * UIProcess/API/Cocoa/WKBackForwardListPrivate.h:
+        * UIProcess/WebBackForwardList.cpp:
+        (WebKit::WebBackForwardList::removeAllItems):
+        * UIProcess/WebBackForwardList.h:
+
+2014-06-24  Anders Carlsson  <ander...@apple.com>
+
         Add iOS specific frame state member variables
         https://bugs.webkit.org/show_bug.cgi?id=134268
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardList.mm (170393 => 170394)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardList.mm	2014-06-24 22:02:54 UTC (rev 170393)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardList.mm	2014-06-24 22:24:23 UTC (rev 170394)
@@ -110,6 +110,11 @@
 
 - (void)_removeAllItems
 {
+    _list->removeAllItems();
+}
+
+- (void)_clear
+{
     _list->clear();
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListPrivate.h (170393 => 170394)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListPrivate.h	2014-06-24 22:02:54 UTC (rev 170393)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListPrivate.h	2014-06-24 22:24:23 UTC (rev 170394)
@@ -31,6 +31,9 @@
 
 - (void)_removeAllItems;
 
+// Removes all items except the current one.
+- (void)_clear;
+
 @end
 
 #endif

Modified: trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp (170393 => 170394)


--- trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp	2014-06-24 22:02:54 UTC (rev 170393)
+++ trunk/Source/WebKit2/UIProcess/WebBackForwardList.cpp	2014-06-24 22:24:23 UTC (rev 170394)
@@ -289,6 +289,26 @@
     return API::Array::create(std::move(vector));
 }
 
+void WebBackForwardList::removeAllItems()
+{
+    ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
+
+    Vector<RefPtr<WebBackForwardListItem>> removedItems;
+
+    for (auto& entry : m_entries) {
+        ASSERT(entry);
+        if (!entry)
+            continue;
+
+        m_page->backForwardRemovedItem(entry->itemID());
+        removedItems.append(std::move(entry));
+    }
+
+    m_entries.clear();
+    m_hasCurrentIndex = false;
+    m_page->didChangeBackForwardList(nullptr, std::move(removedItems));
+}
+
 void WebBackForwardList::clear()
 {
     ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());

Modified: trunk/Source/WebKit2/UIProcess/WebBackForwardList.h (170393 => 170394)


--- trunk/Source/WebKit2/UIProcess/WebBackForwardList.h	2014-06-24 22:02:54 UTC (rev 170393)
+++ trunk/Source/WebKit2/UIProcess/WebBackForwardList.h	2014-06-24 22:24:23 UTC (rev 170394)
@@ -56,6 +56,7 @@
 
     void addItem(WebBackForwardListItem*);
     void goToItem(WebBackForwardListItem*);
+    void removeAllItems();
     void clear();
 
     WebBackForwardListItem* currentItem() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to