Changeset 169805 in webkit
- Timestamp:
- Jun 11, 2014 7:30:34 AM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r169803 r169805 1 2014-06-11 Dan Bernstein <mitz@apple.com> 2 3 <rdar://problem/17218629> [Cocoa] WKWebView’s canGoBack and canGoForward properties are not KVO-compliant 4 https://bugs.webkit.org/show_bug.cgi?id=133722 5 6 Reviewed by Anders Carlsson. 7 8 * UIProcess/API/Cocoa/WKBrowsingContextController.mm: Added no-op overrides of new 9 PageLoadStateObserver member functions. 10 11 * UIProcess/API/Cocoa/WKWebView.h: Documented the canGoBack and canGoForward properties as 12 being KVO-compliant. 13 * UIProcess/API/Cocoa/WKWebView.mm: 14 (-[WKWebView canGoBack]): Changed to get the return value from the page load state. 15 (-[WKWebView canGoForward]): Ditto. 16 17 * UIProcess/Cocoa/NavigationState.h: 18 * UIProcess/Cocoa/NavigationState.mm: 19 (WebKit::NavigationState::willChangeCanGoBack): Override this new PageLoadStateObserver 20 member function by sending the appropriate KVO change message to the WKWebView. 21 (WebKit::NavigationState::didChangeCanGoBack): Ditto. 22 (WebKit::NavigationState::willChangeCanGoForward): Ditto. 23 (WebKit::NavigationState::didChangeCanGoForward): Ditto. 24 25 * UIProcess/PageLoadState.cpp: 26 (WebKit::PageLoadState::commitChanges): Check for changes to canGoBack and canGoForward 27 and call the observers if needed. 28 (WebKit::PageLoadState::canGoBack): Added. Returns the value from the committed state. 29 (WebKit::PageLoadState::setCanGoBack): Added. Sets the value in the uncommitted state. 30 (WebKit::PageLoadState::canGoForward): Added. Returns the value from the committed state. 31 (WebKit::PageLoadState::setCanGoForward): Added. Sets the value in the uncommitted state. 32 * UIProcess/PageLoadState.h: 33 (WebKit::PageLoadState::Data::Data): Added canGoBack and canGoForward boolean members. 34 35 * UIProcess/WebPageProxy.cpp: 36 (WebKit::WebPageProxy::didChangeBackForwardList): Update the page load state with the new 37 state of canGoBack and canGoForward. 38 * UIProcess/WebPageProxy.h: Removed unused member variables m_canGoBack and m_canGoForward. 39 1 40 2014-06-11 Zan Dobersek <zdobersek@igalia.com> 2 41 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm
r168213 r169805 121 121 } 122 122 123 virtual void willChangeCanGoBack() override { } 124 virtual void didChangeCanGoBack() override { } 125 virtual void willChangeCanGoForward() override { } 126 virtual void didChangeCanGoForward() override { } 127 123 128 WKBrowsingContextController *m_controller; 124 129 }; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.h
r169765 r169805 147 147 /*! @abstract A Boolean value indicating whether there is a back item in 148 148 the back-forward list that can be navigated to. 149 @discussion @link WKWebView @/link is key-value observing (KVO) compliant 150 for this property. 149 151 @seealso backForwardList. 150 152 */ … … 153 155 /*! @abstract A Boolean value indicating whether there is a forward item in 154 156 the back-forward list that can be navigated to. 157 @discussion @link WKWebView @/link is key-value observing (KVO) compliant 158 for this property. 155 159 @seealso backForwardList. 156 160 */ -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r169791 r169805 405 405 } 406 406 407 // FIXME: This should be KVO compliant.408 407 - (BOOL)canGoBack 409 408 { 410 return !!_page->backForwardList().backItem(); 411 } 412 413 // FIXME: This should be KVO compliant. 409 return _page->pageLoadState().canGoBack(); 410 } 411 414 412 - (BOOL)canGoForward 415 413 { 416 return !!_page->backForwardList().forwardItem();414 return _page->pageLoadState().canGoForward(); 417 415 } 418 416 -
trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h
r169782 r169805 128 128 virtual void willChangeEstimatedProgress() override; 129 129 virtual void didChangeEstimatedProgress() override; 130 virtual void willChangeCanGoBack() override; 131 virtual void didChangeCanGoBack() override; 132 virtual void willChangeCanGoForward() override; 133 virtual void didChangeCanGoForward() override; 130 134 131 135 WKWebView *m_webView; -
trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm
r169782 r169805 733 733 } 734 734 735 void NavigationState::willChangeCanGoBack() 736 { 737 [m_webView willChangeValueForKey:@"canGoBack"]; 738 } 739 740 void NavigationState::didChangeCanGoBack() 741 { 742 [m_webView didChangeValueForKey:@"canGoBack"]; 743 } 744 745 void NavigationState::willChangeCanGoForward() 746 { 747 [m_webView willChangeValueForKey:@"canGoForward"]; 748 } 749 750 void NavigationState::didChangeCanGoForward() 751 { 752 [m_webView didChangeValueForKey:@"canGoForward"]; 753 } 754 735 755 } // namespace WebKit 736 756 -
trunk/Source/WebKit2/UIProcess/PageLoadState.cpp
r168405 r169805 96 96 m_mayHaveUncommittedChanges = false; 97 97 98 bool canGoBackChanged = m_committedState.canGoBack != m_uncommittedState.canGoBack; 99 bool canGoForwardChanged = m_committedState.canGoForward != m_uncommittedState.canGoForward; 98 100 bool titleChanged = m_committedState.title != m_uncommittedState.title; 99 101 bool isLoadingChanged = isLoading(m_committedState) != isLoading(m_uncommittedState); … … 102 104 bool estimatedProgressChanged = estimatedProgress(m_committedState) != estimatedProgress(m_uncommittedState); 103 105 106 if (canGoBackChanged) 107 callObserverCallback(&Observer::willChangeCanGoBack); 108 if (canGoForwardChanged) 109 callObserverCallback(&Observer::willChangeCanGoForward); 104 110 if (titleChanged) 105 111 callObserverCallback(&Observer::willChangeTitle); … … 126 132 if (titleChanged) 127 133 callObserverCallback(&Observer::didChangeTitle); 134 if (canGoForwardChanged) 135 callObserverCallback(&Observer::didChangeCanGoForward); 136 if (canGoBackChanged) 137 callObserverCallback(&Observer::didChangeCanGoBack); 128 138 } 129 139 … … 319 329 } 320 330 331 bool PageLoadState::canGoBack() const 332 { 333 return m_committedState.canGoBack; 334 } 335 336 void PageLoadState::setCanGoBack(const Transaction::Token& token, bool canGoBack) 337 { 338 ASSERT_UNUSED(token, &token.m_pageLoadState == this); 339 m_uncommittedState.canGoBack = canGoBack; 340 } 341 342 bool PageLoadState::canGoForward() const 343 { 344 return m_committedState.canGoForward; 345 } 346 347 void PageLoadState::setCanGoForward(const Transaction::Token& token, bool canGoForward) 348 { 349 ASSERT_UNUSED(token, &token.m_pageLoadState == this); 350 m_uncommittedState.canGoForward = canGoForward; 351 } 352 321 353 void PageLoadState::didStartProgress(const Transaction::Token& token) 322 354 { -
trunk/Source/WebKit2/UIProcess/PageLoadState.h
r168405 r169805 62 62 virtual void willChangeEstimatedProgress() = 0; 63 63 virtual void didChangeEstimatedProgress() = 0; 64 65 virtual void willChangeCanGoBack() = 0; 66 virtual void didChangeCanGoBack() = 0; 67 68 virtual void willChangeCanGoForward() = 0; 69 virtual void didChangeCanGoForward() = 0; 64 70 }; 65 71 … … 135 141 void setTitle(const Transaction::Token&, const String&); 136 142 143 bool canGoBack() const; 144 void setCanGoBack(const Transaction::Token&, bool); 145 146 bool canGoForward() const; 147 void setCanGoForward(const Transaction::Token&, bool); 148 137 149 void didStartProgress(const Transaction::Token&); 138 150 void didChangeProgress(const Transaction::Token&, double); … … 151 163 : state(State::Finished) 152 164 , hasInsecureContent(false) 165 , canGoBack(false) 166 , canGoForward(false) 153 167 , estimatedProgress(0) 154 168 { … … 166 180 167 181 String title; 182 183 bool canGoBack; 184 bool canGoForward; 168 185 169 186 double estimatedProgress; -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r169737 r169805 926 926 m_loaderClient->didChangeBackForwardList(this, added, std::move(removed)); 927 927 928 auto transaction = m_pageLoadState.transaction(); 929 930 m_pageLoadState.setCanGoBack(transaction, m_backForwardList->backItem()); 931 m_pageLoadState.setCanGoForward(transaction, m_backForwardList->forwardItem()); 932 928 933 #if PLATFORM(MAC) 929 934 m_pageClient.clearCustomSwipeViews(); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r169791 r169805 1553 1553 #endif 1554 1554 1555 bool m_canGoBack;1556 bool m_canGoForward;1557 1555 Ref<WebBackForwardList> m_backForwardList; 1558 1556
Note: See TracChangeset
for help on using the changeset viewer.