Changeset 160129 in webkit
- Timestamp:
- Dec 4, 2013 2:51:37 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r160128 r160129 1 2013-12-04 Anders Carlsson <andersca@apple.com> 2 3 Add a loading property to WKBrowsingContextController 4 https://bugs.webkit.org/show_bug.cgi?id=125256 5 6 Reviewed by Dan Bernstein. 7 8 * UIProcess/API/Cocoa/WKBrowsingContextController.h: 9 Add loading property. 10 11 * UIProcess/API/Cocoa/WKBrowsingContextConteroller.mm: 12 Implement willChangeIsLoading and didChangeIsLoading and call the relevant KVO methods. 13 14 (-[WKBrowsingContextController isLoading]): 15 Call through to the PageLoadState. 16 17 * UIProcess/PageLoadState.cpp: 18 (WebKit::PageLoadState::reset): 19 Use setState. 20 21 (WebKit::PageLoadState::isLoading): 22 Call isLoadingState. 23 24 (WebKit::PageLoadState::didStartProvisionalLoad): 25 Use setState. 26 27 (WebKit::PageLoadState::didFailProvisionalLoad): 28 Use setState. 29 30 (WebKit::PageLoadState::didCommitLoad): 31 Use setState. 32 33 (WebKit::PageLoadState::didFinishLoad): 34 Use setState. 35 36 (WebKit::PageLoadState::didFailLoad): 37 Use setState. 38 39 (WebKit::PageLoadState::isLoadingState): 40 Helper function for determining whether a state is a loading state or not. 41 42 (WebKit::PageLoadState::setState): 43 If setting the state will cause "isLoading" to change, call out to the observers. 44 45 * UIProcess/PageLoadState.h: 46 1 47 2013-12-04 Nick Diego Yamane <nick.yamane@openbossa.org> 2 48 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.h
r159875 r160129 107 107 #pragma mark Active Load Introspection 108 108 109 @property (readonly, getter=isLoading) BOOL loading; 110 109 111 /* URL for the active load. This is the URL that should be shown in user interface. */ 110 112 @property(readonly) NSURL *activeURL; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm
r160104 r160129 62 62 63 63 private: 64 virtual void willChangeIsLoading() OVERRIDE 65 { 66 [m_controller willChangeValueForKey:@"loading"]; 67 } 68 69 virtual void didChangeIsLoading() OVERRIDE 70 { 71 [m_controller didChangeValueForKey:@"loading"]; 72 } 73 64 74 virtual void willChangeTitle() OVERRIDE 65 75 { … … 269 279 270 280 #pragma mark Active Load Introspection 281 282 - (BOOL)isLoading 283 { 284 return _page->pageLoadState().isLoading(); 285 } 271 286 272 287 - (NSURL *)activeURL -
trunk/Source/WebKit2/UIProcess/PageLoadState.cpp
r159701 r160129 56 56 void PageLoadState::reset() 57 57 { 58 m_state = State::Finished; 58 setState(State::Finished); 59 59 60 m_pendingAPIRequestURL = String(); 60 61 m_provisionalURL = String(); … … 67 68 m_title = String(); 68 69 callObserverCallback(&Observer::didChangeTitle); 70 } 71 72 bool PageLoadState::isLoading() const 73 { 74 return isLoadingState(m_state); 69 75 } 70 76 … … 112 118 ASSERT(m_provisionalURL.isEmpty()); 113 119 114 m_state = State::Provisional; 120 setState(State::Provisional); 121 115 122 m_provisionalURL = url; 116 123 … … 129 136 ASSERT(m_state == State::Provisional); 130 137 131 m_state = State::Finished; 138 setState(State::Finished); 139 132 140 m_provisionalURL = String(); 133 141 m_unreachableURL = m_lastUnreachableURL; … … 138 146 ASSERT(m_state == State::Provisional); 139 147 140 m_state = State::Committed; 148 setState(State::Committed); 149 141 150 m_url = m_provisionalURL; 142 151 m_provisionalURL = String(); … … 150 159 ASSERT(m_provisionalURL.isEmpty()); 151 160 152 m_state = State::Finished;161 setState(State::Finished); 153 162 } 154 163 … … 157 166 ASSERT(m_provisionalURL.isEmpty()); 158 167 159 m_state = State::Finished;168 setState(State::Finished); 160 169 } 161 170 … … 185 194 } 186 195 196 bool PageLoadState::isLoadingState(State state) 197 { 198 switch (state) { 199 case State::Provisional: 200 case State::Committed: 201 return true; 202 203 case State::Finished: 204 return false; 205 } 206 207 ASSERT_NOT_REACHED(); 208 return false; 209 } 210 211 void PageLoadState::setState(State state) 212 { 213 if (m_state == state) 214 return; 215 216 bool isLoadingIsChanging = false; 217 218 if (isLoadingState(m_state) != isLoadingState(state)) 219 isLoadingIsChanging = true; 220 221 if (isLoadingIsChanging) 222 callObserverCallback(&Observer::willChangeIsLoading); 223 224 m_state = state; 225 226 if (isLoadingIsChanging) 227 callObserverCallback(&Observer::didChangeIsLoading); 228 } 229 187 230 void PageLoadState::callObserverCallback(void (Observer::*callback)()) 188 231 { -
trunk/Source/WebKit2/UIProcess/PageLoadState.h
r159701 r160129 46 46 virtual ~Observer() { } 47 47 48 virtual void willChangeIsLoading() = 0; 49 virtual void didChangeIsLoading() = 0; 50 48 51 virtual void willChangeTitle() = 0; 49 52 virtual void didChangeTitle() = 0; … … 54 57 55 58 void reset(); 59 60 bool isLoading() const; 56 61 57 62 const String& provisionalURL() const { return m_provisionalURL; } … … 81 86 82 87 private: 88 static bool isLoadingState(State); 89 void setState(State); 90 83 91 void callObserverCallback(void (Observer::*)()); 84 92 -
trunk/Tools/ChangeLog
r160128 r160129 1 2013-12-04 Anders Carlsson <andersca@apple.com> 2 3 Add a loading property to WKBrowsingContextController 4 https://bugs.webkit.org/show_bug.cgi?id=125256 5 6 Reviewed by Dan Bernstein. 7 8 Bind the progress indicator visibility to the "loading" property. 9 10 * MiniBrowser/mac/WK2BrowserWindowController.m: 11 (-[WK2BrowserWindowController dealloc]): 12 (-[WK2BrowserWindowController awakeFromNib]): 13 (-[WK2BrowserWindowController didStartProgress]): 14 (-[WK2BrowserWindowController didFinishProgress]): 15 1 16 2013-12-04 Nick Diego Yamane <nick.yamane@openbossa.org> 2 17 -
trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
r160104 r160129 68 68 - (void)dealloc 69 69 { 70 [progressIndicator unbind:NSHiddenBinding]; 71 70 72 WKRelease(_context); 71 73 WKRelease(_pageGroup); … … 615 617 [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; 616 618 [containerView addSubview:_webView]; 617 619 620 [progressIndicator bind:NSHiddenBinding toObject:_webView.browsingContextController withKeyPath:@"loading" options:@{ NSValueTransformerNameBindingOption : NSNegateBooleanTransformerName }]; 621 618 622 WKPageLoaderClientV3 loadClient = { 619 623 { 3, self }, … … 714 718 { 715 719 [progressIndicator setDoubleValue:0.0]; 716 [progressIndicator setHidden:NO];717 720 } 718 721 … … 724 727 - (void)didFinishProgress 725 728 { 726 [progressIndicator setHidden:YES];727 729 [progressIndicator setDoubleValue:1.0]; 728 730 }
Note: See TracChangeset
for help on using the changeset viewer.