Move lastVisitWasHTTPNonGet out to WebHistoryItem
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Jan 2014 21:21:39 +0000 (21:21 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Jan 2014 21:21:39 +0000 (21:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127657

Reviewed by Dan Bernstein.

Source/WebCore:

Remove m_lastVisitWasHTTPNonGet, it's only used by WebKit.

* history/HistoryItem.cpp:
(WebCore::HistoryItem::HistoryItem):
(WebCore::HistoryItem::reset):
* history/HistoryItem.h:

Source/WebKit/mac:

Keep track of _lastVisitWasHTTPNonGet inside WebHistoryItem.

* History/WebHistory.mm:
(-[WebHistory _visitedURL:withTitle:method:wasFailure:increaseVisitCount:]):
Set entry->_private->_lastVisitWasHTTPNonGet.

* History/WebHistoryItem.h:
Change @private to @package so we can get at WebHistoryItemPrivate from WebHistory.

* History/WebHistoryItem.mm:
(-[WebHistoryItem copyWithZone:]):
Assign _private->_lastVisitWasHTTPNonGet.

(-[WebHistoryItem initFromDictionaryRepresentation:]):
Set _private->_lastVisitWasHTTPNonGet.

* History/WebHistoryItemInternal.h:
Move WebHistoryItemPrivate interface here.

Source/WebKit/win:

Remove uses of lastVisitWasHTTPNonGet.

* WebHistory.cpp:
(WebHistory::visitedURL):
* WebHistoryItem.cpp:
(WebHistoryItem::initFromDictionaryRepresentation):
(WebHistoryItem::lastVisitWasHTTPNonGet):
(WebHistoryItem::setLastVisitWasHTTPNonGet):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162806 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/history/HistoryItem.cpp
Source/WebCore/history/HistoryItem.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/History/WebHistory.mm
Source/WebKit/mac/History/WebHistoryItem.h
Source/WebKit/mac/History/WebHistoryItem.mm
Source/WebKit/mac/History/WebHistoryItemInternal.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebHistory.cpp
Source/WebKit/win/WebHistoryItem.cpp

index ef42026..5722fa9 100644 (file)
@@ -1,3 +1,17 @@
+2014-01-26  Anders Carlsson  <andersca@apple.com>
+
+        Move lastVisitWasHTTPNonGet out to WebHistoryItem
+        https://bugs.webkit.org/show_bug.cgi?id=127657
+
+        Reviewed by Dan Bernstein.
+
+        Remove m_lastVisitWasHTTPNonGet, it's only used by WebKit.
+
+        * history/HistoryItem.cpp:
+        (WebCore::HistoryItem::HistoryItem):
+        (WebCore::HistoryItem::reset):
+        * history/HistoryItem.h:
+
 2014-01-26  Zalan Bujtas  <zalan@apple.com>
 
         Subpixel Layout: Align <input type="button", submit etc (PushButtonPart) top and bottom paddings with <button>
index 5b47002..1873f35 100644 (file)
@@ -61,7 +61,6 @@ void (*notifyHistoryItemChanged)(HistoryItem*) = defaultNotifyHistoryItemChanged
 
 HistoryItem::HistoryItem()
     : m_lastVisitedTime(0)
-    , m_lastVisitWasHTTPNonGet(false)
     , m_pageScaleFactor(0)
     , m_lastVisitWasFailure(false)
     , m_isTargetItem(false)
@@ -83,7 +82,6 @@ HistoryItem::HistoryItem(const String& urlString, const String& title, double ti
     , m_originalURLString(urlString)
     , m_title(title)
     , m_lastVisitedTime(time)
-    , m_lastVisitWasHTTPNonGet(false)
     , m_pageScaleFactor(0)
     , m_lastVisitWasFailure(false)
     , m_isTargetItem(false)
@@ -107,7 +105,6 @@ HistoryItem::HistoryItem(const String& urlString, const String& title, const Str
     , m_title(title)
     , m_displayTitle(alternateTitle)
     , m_lastVisitedTime(time)
-    , m_lastVisitWasHTTPNonGet(false)
     , m_pageScaleFactor(0)
     , m_lastVisitWasFailure(false)
     , m_isTargetItem(false)
@@ -132,7 +129,6 @@ HistoryItem::HistoryItem(const URL& url, const String& target, const String& par
     , m_parent(parent)
     , m_title(title)
     , m_lastVisitedTime(0)
-    , m_lastVisitWasHTTPNonGet(false)
     , m_pageScaleFactor(0)
     , m_lastVisitWasFailure(false)
     , m_isTargetItem(false)
@@ -166,7 +162,6 @@ inline HistoryItem::HistoryItem(const HistoryItem& item)
     , m_title(item.m_title)
     , m_displayTitle(item.m_displayTitle)
     , m_lastVisitedTime(item.m_lastVisitedTime)
-    , m_lastVisitWasHTTPNonGet(item.m_lastVisitWasHTTPNonGet)
     , m_scrollPoint(item.m_scrollPoint)
     , m_pageScaleFactor(item.m_pageScaleFactor)
     , m_lastVisitWasFailure(item.m_lastVisitWasFailure)
@@ -214,7 +209,6 @@ void HistoryItem::reset()
     m_displayTitle = String();
 
     m_lastVisitedTime = 0;
-    m_lastVisitWasHTTPNonGet = false;
 
     m_lastVisitWasFailure = false;
     m_isTargetItem = false;
index a6da6bf..da9b04a 100644 (file)
@@ -117,7 +117,6 @@ public:
     
     int visitCount() const;
     bool lastVisitWasFailure() const { return m_lastVisitWasFailure; }
-    bool lastVisitWasHTTPNonGet() const { return m_lastVisitWasHTTPNonGet; }
 
     void mergeAutoCompleteHints(HistoryItem* otherItem);
     
@@ -158,7 +157,6 @@ public:
 
     void setVisitCount(int);
     void setLastVisitWasFailure(bool wasFailure) { m_lastVisitWasFailure = wasFailure; }
-    void setLastVisitWasHTTPNonGet(bool wasNotGet) { m_lastVisitWasHTTPNonGet = wasNotGet; }
 
     void addChildItem(PassRefPtr<HistoryItem>);
     void setChildItem(PassRefPtr<HistoryItem>);
@@ -249,7 +247,6 @@ private:
     String m_displayTitle;
     
     double m_lastVisitedTime;
-    bool m_lastVisitWasHTTPNonGet;
 
     IntPoint m_scrollPoint;
     float m_pageScaleFactor;
index 5cb0311..6bdbe4c 100644 (file)
@@ -1,5 +1,31 @@
 2014-01-26  Anders Carlsson  <andersca@apple.com>
 
+        Move lastVisitWasHTTPNonGet out to WebHistoryItem
+        https://bugs.webkit.org/show_bug.cgi?id=127657
+
+        Reviewed by Dan Bernstein.
+
+        Keep track of _lastVisitWasHTTPNonGet inside WebHistoryItem.
+
+        * History/WebHistory.mm:
+        (-[WebHistory _visitedURL:withTitle:method:wasFailure:increaseVisitCount:]):
+        Set entry->_private->_lastVisitWasHTTPNonGet.
+
+        * History/WebHistoryItem.h:
+        Change @private to @package so we can get at WebHistoryItemPrivate from WebHistory.
+
+        * History/WebHistoryItem.mm:
+        (-[WebHistoryItem copyWithZone:]):
+        Assign _private->_lastVisitWasHTTPNonGet.
+
+        (-[WebHistoryItem initFromDictionaryRepresentation:]):
+        Set _private->_lastVisitWasHTTPNonGet.
+
+        * History/WebHistoryItemInternal.h:
+        Move WebHistoryItemPrivate interface here.
+
+2014-01-26  Anders Carlsson  <andersca@apple.com>
+
         Turn WebHistoryItemPrivate back into a real Objective-C class
         https://bugs.webkit.org/show_bug.cgi?id=127653
 
index 30d0f5c..57f1138 100644 (file)
@@ -938,7 +938,7 @@ static inline WebHistoryDateKey dateKey(NSTimeInterval date)
     item->setLastVisitWasFailure(wasFailure);
 
     if ([method length])
-        item->setLastVisitWasHTTPNonGet([method caseInsensitiveCompare:@"GET"] && (![[url scheme] caseInsensitiveCompare:@"http"] || ![[url scheme] caseInsensitiveCompare:@"https"]));
+        entry->_private->_lastVisitWasHTTPNonGet = [method caseInsensitiveCompare:@"GET"] && (![[url scheme] caseInsensitiveCompare:@"http"] || ![[url scheme] caseInsensitiveCompare:@"https"]);
 
     item->setRedirectURLs(nullptr);
 
index 2e65a71..aa8d6dd 100644 (file)
@@ -52,7 +52,7 @@ extern NSString *WebHistoryItemChangedNotification;
 */
 @interface WebHistoryItem : NSObject <NSCopying>
 {
-@private
+@package
     WebHistoryItemPrivate *_private;
 }
 
index 074e88d..542d009 100644 (file)
@@ -94,12 +94,6 @@ NSString *WebHistoryItemChangedNotification = @"WebHistoryItemChangedNotificatio
 
 using namespace WebCore;
 
-@interface WebHistoryItemPrivate : NSObject {
-@package
-    RefPtr<HistoryItem> _historyItem;
-}
-@end
-
 @implementation WebHistoryItemPrivate
 
 @end
@@ -177,6 +171,9 @@ void WKNotifyHistoryItemChanged(HistoryItem*)
 {
     WebCoreThreadViolationCheckRoundOne();
     WebHistoryItem *copy = [[[self class] alloc] initWithWebCoreHistoryItem:core(_private)->copy()];
+
+    copy->_private->_lastVisitWasHTTPNonGet = _private->_lastVisitWasHTTPNonGet;
+
     historyItemWrappers().set(core(copy->_private), copy);
 
     return copy;
@@ -395,7 +392,7 @@ WebHistoryItem *kit(HistoryItem* item)
     BOOL lastVisitWasHTTPNonGet = [dict _webkit_boolForKey:lastVisitWasHTTPNonGetKey];
     NSString *tempURLString = [URLString lowercaseString];
     if (lastVisitWasHTTPNonGet && ([tempURLString hasPrefix:@"http:"] || [tempURLString hasPrefix:@"https:"]))
-        core(_private)->setLastVisitWasHTTPNonGet(lastVisitWasHTTPNonGet);
+        _private->_lastVisitWasHTTPNonGet = lastVisitWasHTTPNonGet;
 
     if (NSArray *redirectURLs = [dict _webkit_arrayForKey:redirectURLsKey]) {
         NSUInteger size = [redirectURLs count];
@@ -679,7 +676,7 @@ WebHistoryItem *kit(HistoryItem* item)
 
 - (BOOL)_lastVisitWasHTTPNonGet
 {
-    return core(_private)->lastVisitWasHTTPNonGet();
+    return _private->_lastVisitWasHTTPNonGet;
 }
 
 - (NSArray *)_redirectURLs
index f5a4fd7..880cb7c 100644 (file)
@@ -28,7 +28,7 @@
 
 #import "WebBackForwardList.h"
 #import "WebHistoryItemPrivate.h"
-#import <wtf/Forward.h>
+#import <wtf/RefPtr.h>
 
 namespace WebCore {
     class HistoryItem;
@@ -58,3 +58,11 @@ extern void WKNotifyHistoryItemChanged(WebCore::HistoryItem*);
 @interface WebBackForwardList (WebInternal)
 - (void)_close;
 @end
+
+@interface WebHistoryItemPrivate : NSObject {
+@package
+    RefPtr<WebCore::HistoryItem> _historyItem;
+
+    bool _lastVisitWasHTTPNonGet;
+}
+@end
index e0c6846..b1000be 100644 (file)
@@ -1,3 +1,19 @@
+2014-01-26  Anders Carlsson  <andersca@apple.com>
+
+        Move lastVisitWasHTTPNonGet out to WebHistoryItem
+        https://bugs.webkit.org/show_bug.cgi?id=127657
+
+        Reviewed by Dan Bernstein.
+
+        Remove uses of lastVisitWasHTTPNonGet.
+
+        * WebHistory.cpp:
+        (WebHistory::visitedURL):
+        * WebHistoryItem.cpp:
+        (WebHistoryItem::initFromDictionaryRepresentation):
+        (WebHistoryItem::lastVisitWasHTTPNonGet):
+        (WebHistoryItem::setLastVisitWasHTTPNonGet):
+
 2014-01-25  Anders Carlsson  <andersca@apple.com>
 
         Remove an unused FrameLoaderClient function
index bbddfa9..84fdc17 100644 (file)
@@ -585,8 +585,6 @@ void WebHistory::visitedURL(const URL& url, const String& title, const String& h
         return;
 
     entryPrivate->setLastVisitWasFailure(wasFailure);
-    if (!httpMethod.isEmpty())
-        entryPrivate->setLastVisitWasHTTPNonGet(!equalIgnoringCase(httpMethod, "GET") && url.protocolIsInHTTPFamily());
 
     COMPtr<WebHistoryItem> item(Query, entry);
     item->historyItem()->setRedirectURLs(nullptr);
index 7f11506..44c983e 100644 (file)
@@ -187,9 +187,6 @@ HRESULT STDMETHODCALLTYPE WebHistoryItem::initFromDictionaryRepresentation(void*
     if (lastVisitWasFailure)
         m_historyItem->setLastVisitWasFailure(true);
 
-    if (lastVisitWasHTTPNonGet && (protocolIs(m_historyItem->urlString(), "http") || protocolIs(m_historyItem->urlString(), "https")))
-        m_historyItem->setLastVisitWasHTTPNonGet(true);
-
     if (redirectURLsVector.get())
         m_historyItem->setRedirectURLs(std::move(redirectURLsVector));
 
@@ -445,22 +442,16 @@ HRESULT STDMETHODCALLTYPE WebHistoryItem::setLastVisitWasFailure(BOOL wasFailure
     return S_OK;
 }
 
+// FIXME: This function should be removed from the IWebHistoryItem interface.
 HRESULT STDMETHODCALLTYPE WebHistoryItem::lastVisitWasHTTPNonGet(BOOL* HTTPNonGet)
 {
-    if (!HTTPNonGet) {
-        ASSERT_NOT_REACHED();
-        return E_POINTER;
-    }
-
-    *HTTPNonGet = m_historyItem->lastVisitWasHTTPNonGet();
-
-    return S_OK;
+    return E_NOTIMPL;
 }
 
+// FIXME: This function should be removed from the IWebHistoryItem interface.
 HRESULT STDMETHODCALLTYPE WebHistoryItem::setLastVisitWasHTTPNonGet(BOOL HTTPNonGet)
 {
-    m_historyItem->setLastVisitWasHTTPNonGet(HTTPNonGet);
-    return S_OK;
+    return E_NOTIMPL;
 }
 
 HRESULT STDMETHODCALLTYPE WebHistoryItem::redirectURLs(IEnumVARIANT** urls)