Changeset 160137 in webkit
- Timestamp:
- Dec 4, 2013 3:43:37 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r160136 r160137 1 2013-12-04 Anders Carlsson <andersca@apple.com> 2 3 Make the estimatedProgress property observable using KVO 4 https://bugs.webkit.org/show_bug.cgi?id=125259 5 6 Reviewed by Dan Bernstein. 7 8 * UIProcess/API/Cocoa/WKBrowsingContextController.mm: 9 * UIProcess/PageLoadState.cpp: 10 (WebKit::PageLoadState::PageLoadState): 11 (WebKit::PageLoadState::reset): 12 (WebKit::PageLoadState::activeURL): 13 (WebKit::PageLoadState::estimatedProgress): 14 (WebKit::PageLoadState::setPendingAPIRequestURL): 15 (WebKit::PageLoadState::clearPendingAPIRequestURL): 16 (WebKit::PageLoadState::didStartProgress): 17 (WebKit::PageLoadState::didChangeProgress): 18 (WebKit::PageLoadState::didFinishProgress): 19 * UIProcess/PageLoadState.h: 20 Move m_estimatedProgress to the page load state and call the observers when it changes. 21 22 * UIProcess/WebPageProxy.cpp: 23 (WebKit::WebPageProxy::WebPageProxy): 24 (WebKit::WebPageProxy::estimatedProgress): 25 (WebKit::WebPageProxy::didStartProgress): 26 (WebKit::WebPageProxy::didChangeProgress): 27 (WebKit::WebPageProxy::didFinishProgress): 28 (WebKit::WebPageProxy::resetState): 29 Call through to m_pageLoadState. 30 31 * UIProcess/WebPageProxy.h: 32 1 33 2013-12-04 Nick Diego Yamane <nick.yamane@openbossa.org> 2 34 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm
r160129 r160137 82 82 } 83 83 84 virtual void willChangeEstimatedProgress() OVERRIDE 85 { 86 [m_controller willChangeValueForKey:@"estimatedProgress"]; 87 } 88 89 virtual void didChangeEstimatedProgress() OVERRIDE 90 { 91 [m_controller didChangeValueForKey:@"estimatedProgress"]; 92 } 93 84 94 WKBrowsingContextController *m_controller; 85 95 }; -
trunk/Source/WebKit2/UIProcess/PageLoadState.cpp
r160129 r160137 31 31 PageLoadState::PageLoadState() 32 32 : m_state(State::Finished) 33 , m_estimatedProgress(0) 33 34 { 34 35 } … … 68 69 m_title = String(); 69 70 callObserverCallback(&Observer::didChangeTitle); 71 72 callObserverCallback(&Observer::willChangeEstimatedProgress); 73 m_estimatedProgress = 0; 74 callObserverCallback(&Observer::didChangeEstimatedProgress); 70 75 } 71 76 … … 96 101 ASSERT_NOT_REACHED(); 97 102 return String(); 98 103 } 104 105 // Always start progress at initialProgressValue. This helps provide feedback as 106 // soon as a load starts. 107 108 static const double initialProgressValue = 0.1; 109 110 double PageLoadState::estimatedProgress() const 111 { 112 if (!m_pendingAPIRequestURL.isNull()) 113 return initialProgressValue; 114 115 return m_estimatedProgress; 99 116 } 100 117 … … 106 123 void PageLoadState::setPendingAPIRequestURL(const String& pendingAPIRequestURL) 107 124 { 125 callObserverCallback(&Observer::willChangeEstimatedProgress); 108 126 m_pendingAPIRequestURL = pendingAPIRequestURL; 127 callObserverCallback(&Observer::didChangeEstimatedProgress); 109 128 } 110 129 111 130 void PageLoadState::clearPendingAPIRequestURL() 112 131 { 132 callObserverCallback(&Observer::willChangeEstimatedProgress); 113 133 m_pendingAPIRequestURL = String(); 134 callObserverCallback(&Observer::didChangeEstimatedProgress); 114 135 } 115 136 … … 192 213 m_title = title; 193 214 callObserverCallback(&Observer::didChangeTitle); 215 } 216 217 void PageLoadState::didStartProgress() 218 { 219 callObserverCallback(&Observer::willChangeEstimatedProgress); 220 m_estimatedProgress = initialProgressValue; 221 callObserverCallback(&Observer::didChangeEstimatedProgress); 222 } 223 224 void PageLoadState::didChangeProgress(double value) 225 { 226 callObserverCallback(&Observer::willChangeEstimatedProgress); 227 m_estimatedProgress = value; 228 callObserverCallback(&Observer::didChangeEstimatedProgress); 229 } 230 231 void PageLoadState::didFinishProgress() 232 { 233 callObserverCallback(&Observer::willChangeEstimatedProgress); 234 m_estimatedProgress = 1; 235 callObserverCallback(&Observer::didChangeEstimatedProgress); 194 236 } 195 237 -
trunk/Source/WebKit2/UIProcess/PageLoadState.h
r160129 r160137 51 51 virtual void willChangeTitle() = 0; 52 52 virtual void didChangeTitle() = 0; 53 54 virtual void willChangeEstimatedProgress() = 0; 55 virtual void didChangeEstimatedProgress() = 0; 53 56 }; 54 57 … … 65 68 66 69 String activeURL() const; 70 71 double estimatedProgress() const; 67 72 68 73 const String& pendingAPIRequestURL() const; … … 85 90 void setTitle(const String&); 86 91 92 void didStartProgress(); 93 void didChangeProgress(double); 94 void didFinishProgress(); 95 87 96 private: 88 97 static bool isLoadingState(State); … … 104 113 105 114 String m_title; 115 116 double m_estimatedProgress; 106 117 }; 107 118 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r159988 r160137 236 236 , m_geolocationPermissionRequestManager(*this) 237 237 , m_notificationPermissionRequestManager(*this) 238 , m_estimatedProgress(0)239 238 , m_viewState(ViewState::NoFlags) 240 239 , m_backForwardList(WebBackForwardList::create(*this)) … … 2040 2039 } 2041 2040 2042 // Always start progress at initialProgressValue. This helps provide feedback as2043 // soon as a load starts.2044 2045 static const double initialProgressValue = 0.1;2046 2047 2041 double WebPageProxy::estimatedProgress() const 2048 2042 { 2049 if (!m_pageLoadState.pendingAPIRequestURL().isNull()) 2050 return initialProgressValue; 2051 2052 return m_estimatedProgress; 2043 return m_pageLoadState.estimatedProgress(); 2053 2044 } 2054 2045 2055 2046 void WebPageProxy::didStartProgress() 2056 2047 { 2057 m_ estimatedProgress = initialProgressValue;2048 m_pageLoadState.didStartProgress(); 2058 2049 2059 2050 m_loaderClient.didStartProgress(this); … … 2062 2053 void WebPageProxy::didChangeProgress(double value) 2063 2054 { 2064 m_ estimatedProgress = value;2055 m_pageLoadState.didChangeProgress(value); 2065 2056 2066 2057 m_loaderClient.didChangeProgress(this); … … 2069 2060 void WebPageProxy::didFinishProgress() 2070 2061 { 2071 m_ estimatedProgress = 1.0;2062 m_pageLoadState.didFinishProgress(); 2072 2063 2073 2064 m_loaderClient.didFinishProgress(this); … … 3758 3749 3759 3750 m_activePopupMenu = 0; 3760 3761 m_estimatedProgress = 0.0;3762 3751 } 3763 3752 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r160075 r160137 1207 1207 NotificationPermissionRequestManagerProxy m_notificationPermissionRequestManager; 1208 1208 1209 double m_estimatedProgress;1210 1211 1209 ViewState::Flags m_viewState; 1212 1210 -
trunk/Tools/ChangeLog
r160129 r160137 1 2013-12-04 Anders Carlsson <andersca@apple.com> 2 3 Make the estimatedProgress property observable using KVO 4 https://bugs.webkit.org/show_bug.cgi?id=125259 5 6 Reviewed by Dan Bernstein. 7 8 Bind the progress indicator value to the "estimatedProgress" property. 9 10 * MiniBrowser/mac/WK2BrowserWindowController.m: 11 (-[WK2BrowserWindowController dealloc]): 12 (-[WK2BrowserWindowController awakeFromNib]): 13 1 14 2013-12-04 Anders Carlsson <andersca@apple.com> 2 15 -
trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
r160129 r160137 37 37 38 38 @interface WK2BrowserWindowController () <WKBrowsingContextPolicyDelegate> 39 - (void)didStartProgress;40 - (void)didChangeProgress:(double)value;41 - (void)didFinishProgress;42 39 - (void)didStartProvisionalLoadForFrame:(WKFrameRef)frame; 43 40 - (void)didCommitLoadForFrame:(WKFrameRef)frame; … … 69 66 { 70 67 [progressIndicator unbind:NSHiddenBinding]; 68 [progressIndicator unbind:NSValueBinding]; 71 69 72 70 WKRelease(_context); … … 389 387 } 390 388 391 static void didStartProgress(WKPageRef page, const void *clientInfo)392 {393 [(WK2BrowserWindowController *)clientInfo didStartProgress];394 }395 396 static void didChangeProgress(WKPageRef page, const void *clientInfo)397 {398 [(WK2BrowserWindowController *)clientInfo didChangeProgress:WKPageGetEstimatedProgress(page)];399 }400 401 static void didFinishProgress(WKPageRef page, const void *clientInfo)402 {403 [(WK2BrowserWindowController *)clientInfo didFinishProgress];404 }405 406 389 static void didBecomeUnresponsive(WKPageRef page, const void *clientInfo) 407 390 { … … 619 602 620 603 [progressIndicator bind:NSHiddenBinding toObject:_webView.browsingContextController withKeyPath:@"loading" options:@{ NSValueTransformerNameBindingOption : NSNegateBooleanTransformerName }]; 604 [progressIndicator bind:NSValueBinding toObject:_webView.browsingContextController withKeyPath:@"estimatedProgress" options:nil]; 621 605 622 606 WKPageLoaderClientV3 loadClient = { … … 638 622 0, // canAuthenticateAgainstProtectionSpaceInFrame 639 623 0, // didReceiveAuthenticationChallengeInFrame 640 didStartProgress,641 didChangeProgress,642 didFinishProgress,624 0, // didStartProgress, 625 0, // didChangeProgress, 626 0, // didFinishProgress, 643 627 didBecomeUnresponsive, 644 628 didBecomeResponsive, … … 715 699 } 716 700 717 - (void)didStartProgress718 {719 [progressIndicator setDoubleValue:0.0];720 }721 722 - (void)didChangeProgress:(double)value723 {724 [progressIndicator setDoubleValue:value];725 }726 727 - (void)didFinishProgress728 {729 [progressIndicator setDoubleValue:1.0];730 }731 732 701 - (void)updateTextFieldFromURL:(WKURLRef)URLRef 733 702 {
Note: See TracChangeset
for help on using the changeset viewer.