Changeset 161223 in webkit
- Timestamp:
- Jan 2, 2014 2:06:14 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r161222 r161223 1 2014-01-02 Gavin Barraclough <barraclough@apple.com> 2 3 Merge didMoveOnscreen / page visibility to isVisible 4 https://bugs.webkit.org/show_bug.cgi?id=126268 5 6 Reviewed by Tim Horton. 7 8 The onscreen state most closely tracks view visibility (though currently 9 also tracks a mix of in-window state). Make more consistent, simplify, 10 and move all animation suspension logic to Page, so it can be controlled 11 by the PageThrottler. 12 13 * WebCore.exp.in: 14 * page/EventHandler.cpp: 15 (WebCore::EventHandler::fakeMouseMoveEventTimerFired): 16 * page/FrameView.cpp: 17 (WebCore::FrameView::shouldSetCursor): 18 * page/Page.cpp: 19 (WebCore::Page::Page): 20 - initialize new variables. 21 (WebCore::Page::setIsVisible): 22 - merge setVisibilityState, didMoveOnscreen, willMoveOffscreen. 23 (WebCore::Page::setIsPrerender): 24 - switches visibility state from hidden to prerender. 25 (WebCore::Page::visibilityState): 26 - computed from m_isVisible, m_isPrerender. 27 (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged): 28 - m_visibilityState -> m_isVisible. 29 * page/Page.h: 30 - remove didMoveOnscreen/willMoveOffscreen 31 m_isOnscreen & m_visibilityState -> m_isVisible & m_isPrerender 32 setVisibilityState -> setIsVisible & setIsPrerender. 33 (WebCore::Page::isVisible): 34 - isOnscreen -> isVisible. 35 1 36 2014-01-02 Oliver Hunt <oliver@apple.com> 2 37 -
trunk/Source/WebCore/WebCore.exp.in
r161198 r161223 963 963 __ZN7WebCore4Page11PageClientsD1Ev 964 964 __ZN7WebCore4Page12setGroupNameERKN3WTF6StringE 965 __ZN7WebCore4Page12setIsVisibleEbb 965 966 __ZN7WebCore4Page12setThrottledEb 966 967 __ZN7WebCore4Page13rangeOfStringERKN3WTF6StringEPNS_5RangeEj 967 968 __ZN7WebCore4Page13setIsInWindowEb 968 969 __ZN7WebCore4Page13setPaginationERKNS_10PaginationE 970 __ZN7WebCore4Page14setIsPrerenderEv 969 971 __ZN7WebCore4Page14setMediaVolumeEf 970 972 __ZN7WebCore4Page15addSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE 971 __ZN7WebCore4Page15didMoveOnscreenEv972 973 __ZN7WebCore4Page16countFindMatchesERKN3WTF6StringEjj 973 974 __ZN7WebCore4Page16setCanStartMediaEb 974 975 __ZN7WebCore4Page16setDefersLoadingEb 975 __ZN7WebCore4Page17willMoveOffscreenEv976 976 __ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE 977 977 __ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE … … 2771 2771 #endif 2772 2772 2773 #if ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)2774 __ZN7WebCore4Page18setVisibilityStateENS_19PageVisibilityStateEb2775 #endif2776 2777 2773 #if USE(PLUGIN_HOST_PROCESS) 2778 2774 __ZN3JSC13RuntimeMethod11getCallDataEPNS_6JSCellERNS_8CallDataE -
trunk/Source/WebCore/page/EventHandler.cpp
r161106 r161223 2837 2837 return; 2838 2838 2839 if (!m_frame.page() || !m_frame.page()->is Onscreen() || !m_frame.page()->focusController().isActive())2839 if (!m_frame.page() || !m_frame.page()->isVisible() || !m_frame.page()->focusController().isActive()) 2840 2840 return; 2841 2841 -
trunk/Source/WebCore/page/FrameView.cpp
r161197 r161223 1692 1692 { 1693 1693 Page* page = frame().page(); 1694 return page && page->is Onscreen() && page->focusController().isActive();1694 return page && page->isVisible() && page->focusController().isActive(); 1695 1695 } 1696 1696 -
trunk/Source/WebCore/page/Page.cpp
r161105 r161223 172 172 , m_timerAlignmentInterval(Settings::defaultDOMTimerAlignmentInterval()) 173 173 , m_isEditable(false) 174 , m_isOnscreen(true)175 174 , m_isInWindow(true) 176 #if ENABLE(PAGE_VISIBILITY_API) 177 , m_visibilityState(PageVisibilityStateVisible) 178 #endif 175 , m_isVisible(true) 176 , m_isPrerender(false) 179 177 , m_requestedLayoutMilestones(0) 180 178 , m_headerHeight(0) … … 875 873 } 876 874 877 void Page::didMoveOnscreen()878 {879 m_isOnscreen = true;880 881 for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {882 if (FrameView* frameView = frame->view())883 frameView->didMoveOnscreen();884 }885 886 resumeScriptedAnimations();887 }888 889 void Page::willMoveOffscreen()890 {891 m_isOnscreen = false;892 893 for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {894 if (FrameView* frameView = frame->view())895 frameView->willMoveOffscreen();896 }897 898 suspendScriptedAnimations();899 }900 901 875 void Page::setIsInWindow(bool isInWindow) 902 876 { … … 1236 1210 } 1237 1211 1238 #if ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) 1239 void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitialState) 1240 { 1241 #if !ENABLE(PAGE_VISIBILITY_API) 1242 UNUSED_PARAM(isInitialState); 1243 #else 1212 void Page::setIsVisible(bool isVisible, bool isInitialState) 1213 { 1244 1214 // FIXME: The visibility state should be stored on the top-level document. 1245 1215 // https://bugs.webkit.org/show_bug.cgi?id=116769 1246 1216 1247 if (m_visibilityState == visibilityState) 1248 return; 1249 if (m_visibilityState == PageVisibilityStatePrerender && visibilityState == PageVisibilityStateHidden) 1250 return; 1251 m_visibilityState = visibilityState; 1252 1217 if (m_isVisible == isVisible) 1218 return; 1219 m_isVisible = isVisible; 1220 1221 if (isVisible) { 1222 m_isPrerender = false; 1223 1224 for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) { 1225 if (FrameView* frameView = frame->view()) 1226 frameView->didMoveOnscreen(); 1227 } 1228 1229 resumeScriptedAnimations(); 1230 1231 if (FrameView* view = mainFrame().view()) 1232 view->show(); 1233 1234 unthrottleTimers(); 1235 1236 if (m_settings->hiddenPageCSSAnimationSuspensionEnabled()) 1237 mainFrame().animation().resumeAnimations(); 1238 1239 resumeAnimatingImages(); 1240 } 1241 1242 #if ENABLE(PAGE_VISIBILITY_API) 1253 1243 if (!isInitialState) { 1254 1244 Vector<Ref<Document>> documents; … … 1259 1249 documents[i]->visibilityStateChanged(); 1260 1250 } 1261 #endif 1262 1263 if (visibilityState == WebCore::PageVisibilityStateHidden) { 1251 #else 1252 UNUSED_PARAM(isInitialState); 1253 #endif 1254 1255 if (!isVisible) { 1264 1256 if (m_pageThrottler->shouldThrottleTimers()) 1265 1257 throttleTimers(); 1258 1266 1259 if (m_settings->hiddenPageCSSAnimationSuspensionEnabled()) 1267 1260 mainFrame().animation().suspendAnimations(); 1268 } else { 1269 unthrottleTimers(); 1270 if (m_settings->hiddenPageCSSAnimationSuspensionEnabled()) 1271 mainFrame().animation().resumeAnimations(); 1272 resumeAnimatingImages(); 1273 } 1274 } 1275 #endif // ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) 1261 1262 for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) { 1263 if (FrameView* frameView = frame->view()) 1264 frameView->willMoveOffscreen(); 1265 } 1266 1267 suspendScriptedAnimations(); 1268 1269 if (FrameView* view = mainFrame().view()) 1270 view->hide(); 1271 } 1272 } 1273 1274 void Page::setIsPrerender() 1275 { 1276 m_isPrerender = true; 1277 } 1276 1278 1277 1279 #if ENABLE(PAGE_VISIBILITY_API) 1278 1280 PageVisibilityState Page::visibilityState() const 1279 1281 { 1280 return m_visibilityState; 1282 if (m_isVisible) 1283 return PageVisibilityStateVisible; 1284 if (m_isPrerender) 1285 return PageVisibilityStatePrerender; 1286 return PageVisibilityStateHidden; 1281 1287 } 1282 1288 #endif … … 1536 1542 void Page::hiddenPageCSSAnimationSuspensionStateChanged() 1537 1543 { 1538 if ( m_visibilityState == WebCore::PageVisibilityStateHidden) {1544 if (!m_isVisible) { 1539 1545 if (m_settings->hiddenPageCSSAnimationSuspensionEnabled()) 1540 1546 mainFrame().animation().suspendAnimations(); -
trunk/Source/WebCore/page/Page.h
r161106 r161223 295 295 296 296 // Notifications when the Page starts and stops being presented via a native window. 297 void didMoveOnscreen();298 void willMoveOffscreen();299 bool is Onscreen() const { return m_isOnscreen; }297 void setIsVisible(bool isVisible, bool isInitial); 298 void setIsPrerender(); 299 bool isVisible() const { return m_isVisible; } 300 300 301 301 // Notification that this Page was moved into or out of a native window. … … 356 356 PageVisibilityState visibilityState() const; 357 357 #endif 358 #if ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)359 void setVisibilityState(PageVisibilityState, bool);360 #endif361 358 void resumeAnimatingImages(); 362 359 … … 526 523 527 524 bool m_isEditable; 528 bool m_isOnscreen;529 525 bool m_isInWindow; 530 531 #if ENABLE(PAGE_VISIBILITY_API) 532 PageVisibilityState m_visibilityState; 533 #endif 526 bool m_isVisible; 527 bool m_isPrerender; 534 528 535 529 LayoutMilestones m_requestedLayoutMilestones; -
trunk/Source/WebKit/blackberry/Api/WebPage.cpp
r160457 r161223 3119 3119 static bool s_initialVisibilityState = true; 3120 3120 3121 m_page->setVisibilityState(m_visible && m_activationState == ActivationActive ? PageVisibilityStateVisible : PageVisibilityStateHidden, s_initialVisibilityState); 3121 m_page->setIsVisible(m_visible && m_activationState == ActivationActive, s_initialVisibilityState); 3122 3122 3123 s_initialVisibilityState = false; 3123 3124 } -
trunk/Source/WebKit/blackberry/ChangeLog
r161166 r161223 1 2014-01-02 Gavin Barraclough <barraclough@apple.com> 2 3 Merge didMoveOnscreen / page visibility to isVisible 4 https://bugs.webkit.org/show_bug.cgi?id=126268 5 6 Reviewed by Tim Horton. 7 8 The onscreen state most closely tracks view visibility (though currently 9 also tracks a mix of in-window state). Make more consistent, simplify, 10 and move all animation suspension logic to Page, so it can be controlled 11 by the PageThrottler. 12 13 * Api/WebPage.cpp: 14 (BlackBerry::WebKit::WebPagePrivate::setPageVisibilityState): 15 - setVisibilityState -> setIsVisible. 16 1 17 2013-12-30 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 18 -
trunk/Source/WebKit/efl/ChangeLog
r161134 r161223 1 2014-01-02 Gavin Barraclough <barraclough@apple.com> 2 3 Merge didMoveOnscreen / page visibility to isVisible 4 https://bugs.webkit.org/show_bug.cgi?id=126268 5 6 Reviewed by Tim Horton. 7 8 The onscreen state most closely tracks view visibility (though currently 9 also tracks a mix of in-window state). Make more consistent, simplify, 10 and move all animation suspension logic to Page, so it can be controlled 11 by the PageThrottler. 12 13 * ewk/ewk_view.cpp: 14 (ewk_view_visibility_state_set): 15 - setVisibilityState -> setIsVisible/setIsPrerender. 16 1 17 2013-12-29 Ryuan Choi <ryuan.choi@samsung.com> 2 18 -
trunk/Source/WebKit/efl/ewk/ewk_view.cpp
r161134 r161223 4239 4239 return false; 4240 4240 4241 priv->page->setVisibilityState(static_cast<WebCore::PageVisibilityState>(pageVisibilityState), initialState); 4241 priv->page->setIsVisible(pageVisibilityState == EWK_PAGE_VISIBILITY_STATE_VISIBLE, initialState); 4242 if (pageVisibilityState == EWK_PAGE_VISIBILITY_STATE_PRERENDER) 4243 priv->page->setIsPrerender(); 4242 4244 4243 4245 return true; -
trunk/Source/WebKit/gtk/ChangeLog
r161221 r161223 1 2014-01-02 Gavin Barraclough <barraclough@apple.com> 2 3 Merge didMoveOnscreen / page visibility to isVisible 4 https://bugs.webkit.org/show_bug.cgi?id=126268 5 6 Reviewed by Tim Horton. 7 8 The onscreen state most closely tracks view visibility (though currently 9 also tracks a mix of in-window state). Make more consistent, simplify, 10 and move all animation suspension logic to Page, so it can be controlled 11 by the PageThrottler. 12 13 * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: 14 (DumpRenderTreeSupportGtk::setPageVisibility): 15 - setVisibilityState -> setIsVisible/setIsPrerender. 16 1 17 2014-01-02 Zan Dobersek <zdobersek@igalia.com> 2 18 -
trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
r157018 r161223 700 700 return; 701 701 702 page->setVisibilityState(visibilityState, isInitialState); 703 #endif 704 } 702 page->setIsVisible(visibilityState == PageVisibilityStateVisible, isInitialState); 703 if (visibilityState == PageVisibilityStatePrerender) 704 page->setIsPrerender(); 705 #endif 706 } -
trunk/Source/WebKit/mac/ChangeLog
r161220 r161223 1 2014-01-02 Gavin Barraclough <barraclough@apple.com> 2 3 Merge didMoveOnscreen / page visibility to isVisible 4 https://bugs.webkit.org/show_bug.cgi?id=126268 5 6 Reviewed by Tim Horton. 7 8 The onscreen state most closely tracks view visibility (though currently 9 also tracks a mix of in-window state). Make more consistent, simplify, 10 and move all animation suspension logic to Page, so it can be controlled 11 by the PageThrottler. 12 13 * WebView/WebView.mm: 14 (-[WebView _commonInitializationWithFrameName:groupName:]): 15 (-[WebView _updateVisibilityState]): 16 - _setVisibilityState:isInitialState: -> _setIsVisibile:isInitialState:. 17 (-[WebView _setIsVisible:isInitialState:]): 18 - added. 19 (-[WebView _setVisibilityState:isInitialState:]): 20 - setVisibilityState -> setIsVisible/setIsPrerender. 21 (-[WebView viewWillMoveToWindow:]): 22 (-[WebView viewDidMoveToWindow]): 23 - remove redundant calls to willMoveOffscreen/didMoveOnscreen 24 (this is handled by _updateVisibilityState). 25 1 26 2013-12-23 Oliver Hunt <oliver@apple.com> 2 27 -
trunk/Source/WebKit/mac/WebView/WebView.mm
r161185 r161223 508 508 } 509 509 510 static PageVisibilityState core(WebPageVisibilityState visibilityState)511 {512 switch (visibilityState) {513 case WebPageVisibilityStateVisible:514 return PageVisibilityStateVisible;515 case WebPageVisibilityStateHidden:516 return PageVisibilityStateHidden;517 case WebPageVisibilityStatePrerender:518 return PageVisibilityStatePrerender;519 }520 521 ASSERT_NOT_REACHED();522 return PageVisibilityStateVisible;523 }524 525 510 static WebPageVisibilityState kit(PageVisibilityState visibilityState) 526 511 { … … 1051 1036 #endif 1052 1037 1053 [self _set VisibilityState:([self _isViewVisible] ? WebPageVisibilityStateVisible : WebPageVisibilityStateHidden)isInitialState:YES];1038 [self _setIsVisible:[self _isViewVisible] isInitialState:YES]; 1054 1039 1055 1040 WebPreferences *prefs = [self preferences]; … … 4010 3995 { 4011 3996 if (_private && _private->page) 4012 [self _set VisibilityState:([self _isViewVisible] ? WebPageVisibilityStateVisible : WebPageVisibilityStateHidden)isInitialState:NO];3997 [self _setIsVisible:[self _isViewVisible] isInitialState:NO]; 4013 3998 } 4014 3999 … … 4375 4360 } 4376 4361 4362 - (void)_setIsVisible:(BOOL)isVisible isInitialState:(BOOL)isInitialState 4363 { 4364 if (_private->page) 4365 _private->page->setIsVisible(isVisible, isInitialState); 4366 } 4367 4377 4368 - (void)_setVisibilityState:(WebPageVisibilityState)visibilityState isInitialState:(BOOL)isInitialState 4378 4369 { 4379 #if ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) 4380 if (_private->page) 4381 _private->page->setVisibilityState(core(visibilityState), isInitialState); 4382 #endif 4370 if (_private->page) { 4371 _private->page->setIsVisible(visibilityState == WebPageVisibilityStateVisible, isInitialState); 4372 if (visibilityState == WebPageVisibilityStatePrerender) 4373 _private->page->setIsPrerender(); 4374 } 4383 4375 } 4384 4376 … … 5284 5276 } else { 5285 5277 _private->page->setCanStartMedia(false); 5286 _private->page->willMoveOffscreen();5287 5278 _private->page->setIsInWindow(false); 5288 5279 } … … 5306 5297 if ([self window]) { 5307 5298 _private->page->setCanStartMedia(true); 5308 _private->page->didMoveOnscreen();5309 5299 _private->page->setIsInWindow(true); 5310 5300 -
trunk/Source/WebKit2/ChangeLog
r161220 r161223 1 2014-01-02 Gavin Barraclough <barraclough@apple.com> 2 3 Merge didMoveOnscreen / page visibility to isVisible 4 https://bugs.webkit.org/show_bug.cgi?id=126268 5 6 Reviewed by Tim Horton. 7 8 The onscreen state most closely tracks view visibility (though currently 9 also tracks a mix of in-window state). Make more consistent, simplify, 10 and move all animation suspension logic to Page, so it can be controlled 11 by the PageThrottler. 12 13 * WebProcess/WebPage/WebPage.cpp: 14 (WebKit::WebPage::WebPage): 15 (WebKit::WebPage::setViewIsVisible): 16 - updateVisibilityState -> setIsVisible. 17 (WebKit::WebPage::setIsInWindow): 18 - remove redundant willMoveOffscreen/didMoveOnscreen calls - this is handled 19 by setIsVisible. 20 (WebKit::WebPage::setMayStartMediaWhenInWindow): 21 - isOnscreen -> isInWindow. We start media when the view is in a window, not 22 when the view is visible. 23 (WebKit::WebPage::setVisibilityStatePrerender): 24 - setVisibilityState -> setIsPrerender. 25 1 26 2013-12-23 Oliver Hunt <oliver@apple.com> 2 27 -
trunk/Source/WebKit2/UIProcess/WebContext.h
r161148 r161223 83 83 #endif 84 84 #if ENABLE(NETWORK_PROCESS) 85 struc t NetworkProcessCreationParameters;85 struc t NetworkProcessCreationParameters; 86 86 #endif 87 87 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r161212 r161223 426 426 #endif 427 427 428 updateVisibilityState(true);428 m_page->setIsVisible(m_viewState & ViewState::IsVisible, true); 429 429 } 430 430 … … 1923 1923 void WebPage::setViewIsVisible(bool isVisible) 1924 1924 { 1925 if (!isVisible) { 1925 if (isVisible) 1926 m_drawingArea->resumePainting(); 1927 else 1926 1928 m_drawingArea->suspendPainting(); 1927 m_page->suspendScriptedAnimations(); 1928 } else { 1929 m_drawingArea->resumePainting(); 1930 // FIXME: this seems redundant; for the view to be visible the window must be visible too! 1931 // refactoring for now, will change the logic later. 1932 if (m_windowIsVisible) { 1933 m_page->resumeScriptedAnimations(); 1934 m_page->resumeAnimatingImages(); 1935 } 1936 } 1937 1938 updateVisibilityState(); 1929 1930 m_page->setIsVisible(m_viewState & ViewState::IsVisible, false); 1939 1931 } 1940 1932 … … 2060 2052 m_setCanStartMediaTimer.stop(); 2061 2053 m_page->setCanStartMedia(false); 2062 m_page->willMoveOffscreen();2063 2054 2064 2055 if (pageWasInWindow) … … 2071 2062 m_setCanStartMediaTimer.startOneShot(0); 2072 2063 2073 m_page->didMoveOnscreen();2074 2075 2064 if (!pageWasInWindow) 2076 2065 WebProcess::shared().pageDidEnterWindow(m_pageID); … … 3539 3528 3540 3529 m_mayStartMediaWhenInWindow = mayStartMedia; 3541 if (m_mayStartMediaWhenInWindow && m_page->is Onscreen())3530 if (m_mayStartMediaWhenInWindow && m_page->isInWindow()) 3542 3531 m_setCanStartMediaTimer.startOneShot(0); 3543 3532 } … … 3708 3697 } 3709 3698 3710 void WebPage::updateVisibilityState(bool isInitialState)3711 {3712 bool isVisible = m_viewState & ViewState::IsVisible;3713 if (!m_page)3714 return;3715 3716 #if ENABLE(PAGE_VISIBILITY_API)3717 3718 FrameView* view = m_page->mainFrame().view();3719 3720 if (isVisible) {3721 m_page->didMoveOnscreen();3722 if (view)3723 view->show();3724 }3725 3726 PageVisibilityState state = isVisible ? PageVisibilityStateVisible : PageVisibilityStateHidden;3727 m_page->setVisibilityState(state, isInitialState);3728 3729 if (!isVisible) {3730 m_page->willMoveOffscreen();3731 if (view)3732 view->hide();3733 }3734 3735 #elif ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)3736 3737 PageVisibilityState state = isVisible ? PageVisibilityStateVisible : PageVisibilityStateHidden;3738 m_page->setVisibilityState(state, isInitialState);3739 3740 #else3741 UNUSED_PARAM(isVisible);3742 UNUSED_PARAM(isInitialState);3743 #endif3744 }3745 3746 3699 void WebPage::setVisibilityStatePrerender() 3747 3700 { 3748 #if ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) 3749 if (!m_page) 3750 return; 3751 m_page->setVisibilityState(PageVisibilityStatePrerender, true); 3752 #endif 3701 if (m_page) 3702 m_page->setIsPrerender(); 3753 3703 } 3754 3704
Note: See TracChangeset
for help on using the changeset viewer.