Title: [106875] trunk/Source
Revision
106875
Author
[email protected]
Date
2012-02-06 16:43:26 -0800 (Mon, 06 Feb 2012)

Log Message

Source/WebCore: Overlay scrollbars flash when window is simply activated
https://bugs.webkit.org/show_bug.cgi?id=77911
<rdar://problem/10211995>

Reviewed by Kenneth Russell.

Add a new member function, FocusController::setContainingWindowIsVisible, and move the code
that calls ScrollableArea::contentAreaDidShow/ScrollableArea::contentAreaDidHide there, since
we only want to flash scrollers when the window becomes visible.

* WebCore.exp.in:
* page/FocusController.cpp:
(WebCore::FocusController::FocusController):
(WebCore::FocusController::setActive):
(WebCore::FocusController::setContainingWindowIsVisible):
(WebCore):
* page/FocusController.h:
(FocusController):
(WebCore::FocusController::containingWindowIsVisible):

* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
Call ScrollAnimatorMac::contentAreaWillPaint here, since that will trigger AppKit to flash the scrollers.

Source/WebKit/mac: Overlay scrollbars flash when window is simply activated
https://bugs.webkit.org/show_bug.cgi?id=77911
<rdar://problem/10211995>

Reviewed by Kenneth Russell.

* WebView/WebView.mm:
(-[WebView _windowWillOrderOnScreen:]):
(-[WebView _windowWillOrderOffScreen:]):
Call FocusController::setContainingWindowIsVisible.

Source/WebKit2: Overlay scrollbars flash when window is simply activated
https://bugs.webkit.org/show_bug.cgi?id=77911

Reviewed by Kenneth Russell.

* UIProcess/API/mac/WKView.mm:
(-[WKView _updateWindowVisibility]):
Use -[NSWindow isVisible] here, since we also want to consider the window hidden if the application itself is hidden.

(-[WKView _windowDidOrderOffScreen:]):
(-[WKView _windowDidOrderOnScreen:]):
Call -[WKView updateWindowVisibility].

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setWindowIsVisible):
Call FocusController::setContainingWindowIsVisible.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106874 => 106875)


--- trunk/Source/WebCore/ChangeLog	2012-02-07 00:41:31 UTC (rev 106874)
+++ trunk/Source/WebCore/ChangeLog	2012-02-07 00:43:26 UTC (rev 106875)
@@ -1,3 +1,29 @@
+2012-02-06  Anders Carlsson  <[email protected]>
+
+        Overlay scrollbars flash when window is simply activated
+        https://bugs.webkit.org/show_bug.cgi?id=77911
+        <rdar://problem/10211995>
+
+        Reviewed by Kenneth Russell.
+
+        Add a new member function, FocusController::setContainingWindowIsVisible, and move the code
+        that calls ScrollableArea::contentAreaDidShow/ScrollableArea::contentAreaDidHide there, since
+        we only want to flash scrollers when the window becomes visible.
+
+        * WebCore.exp.in:
+        * page/FocusController.cpp:
+        (WebCore::FocusController::FocusController):
+        (WebCore::FocusController::setActive):
+        (WebCore::FocusController::setContainingWindowIsVisible):
+        (WebCore):
+        * page/FocusController.h:
+        (FocusController):
+        (WebCore::FocusController::containingWindowIsVisible):
+
+        * platform/mac/ScrollAnimatorMac.mm:
+        (-[WebScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
+        Call ScrollAnimatorMac::contentAreaWillPaint here, since that will trigger AppKit to flash the scrollers.
+
 2012-02-06  Greg Simon  <[email protected]>
 
         postMessage leaks MemoryEvent object

Modified: trunk/Source/WebCore/WebCore.exp.in (106874 => 106875)


--- trunk/Source/WebCore/WebCore.exp.in	2012-02-07 00:41:31 UTC (rev 106874)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-02-07 00:43:26 UTC (rev 106875)
@@ -434,6 +434,7 @@
 __ZN7WebCore15FocusController14setFocusedNodeEPNS_4NodeEN3WTF10PassRefPtrINS_5FrameEEE
 __ZN7WebCore15FocusController15setFocusedFrameEN3WTF10PassRefPtrINS_5FrameEEE
 __ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE
+__ZN7WebCore15FocusController28setContainingWindowIsVisibleEb
 __ZN7WebCore15FocusController9setActiveEb
 __ZN7WebCore15GraphicsContext11clearShadowEv
 __ZN7WebCore15GraphicsContext12setFillColorERKNS_5ColorENS_10ColorSpaceE

Modified: trunk/Source/WebCore/page/FocusController.cpp (106874 => 106875)


--- trunk/Source/WebCore/page/FocusController.cpp	2012-02-07 00:41:31 UTC (rev 106874)
+++ trunk/Source/WebCore/page/FocusController.cpp	2012-02-07 00:43:26 UTC (rev 106875)
@@ -88,6 +88,7 @@
     , m_isActive(false)
     , m_isFocused(false)
     , m_isChangingFocusedFrame(false)
+    , m_containingWindowIsVisible(false)
 {
 }
 
@@ -573,16 +574,6 @@
             view->updateLayoutAndStyleIfNeededRecursive();
             view->updateControlTints();
         }
-
-        if (const HashSet<ScrollableArea*>* scrollableAreas = m_page->scrollableAreaSet()) {
-            HashSet<ScrollableArea*>::const_iterator end = scrollableAreas->end(); 
-            for (HashSet<ScrollableArea*>::const_iterator it = scrollableAreas->begin(); it != end; ++it) {
-                if (!active)
-                    (*it)->contentAreaDidHide();
-                else
-                    (*it)->contentAreaDidShow();
-            }
-        }
     }
 
     focusedOrMainFrame()->selection()->pageActivationChanged();
@@ -591,6 +582,28 @@
         dispatchEventsOnWindowAndFocusedNode(m_focusedFrame->document(), active);
 }
 
+void FocusController::setContainingWindowIsVisible(bool containingWindowIsVisible)
+{
+    if (m_containingWindowIsVisible == containingWindowIsVisible)
+        return;
+
+    m_containingWindowIsVisible = containingWindowIsVisible;
+
+    FrameView* view = m_page->mainFrame()->view();
+    if (!view)
+        return;
+
+    if (const HashSet<ScrollableArea*>* scrollableAreas = m_page->scrollableAreaSet()) {
+        HashSet<ScrollableArea*>::const_iterator end = scrollableAreas->end(); 
+        for (HashSet<ScrollableArea*>::const_iterator it = scrollableAreas->begin(); it != end; ++it) {
+            if (!containingWindowIsVisible)
+                (*it)->contentAreaDidHide();
+            else
+                (*it)->contentAreaDidShow();
+        }
+    }
+}
+
 static void updateFocusCandidateIfNeeded(FocusDirection direction, const FocusCandidate& current, FocusCandidate& candidate, FocusCandidate& closest)
 {
     ASSERT(candidate.visibleNode->isElementNode());

Modified: trunk/Source/WebCore/page/FocusController.h (106874 => 106875)


--- trunk/Source/WebCore/page/FocusController.h	2012-02-07 00:41:31 UTC (rev 106874)
+++ trunk/Source/WebCore/page/FocusController.h	2012-02-07 00:43:26 UTC (rev 106875)
@@ -63,6 +63,9 @@
     void setFocused(bool);
     bool isFocused() const { return m_isFocused; }
 
+    void setContainingWindowIsVisible(bool);
+    bool containingWindowIsVisible() const { return m_containingWindowIsVisible; }
+
     bool transferFocusToElementInShadowRoot(Element* shadowHost, bool restorePreviousSelection);
 
 private:
@@ -96,6 +99,7 @@
     bool m_isActive;
     bool m_isFocused;
     bool m_isChangingFocusedFrame;
+    bool m_containingWindowIsVisible;
 
 };
 

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (106874 => 106875)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-02-07 00:41:31 UTC (rev 106874)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-02-07 00:43:26 UTC (rev 106875)
@@ -253,6 +253,14 @@
 {
     UNUSED_PARAM(scrollerImpPair);
     UNUSED_PARAM(rect);
+
+    if (!_scrollableArea)
+        return;
+
+    if (!_scrollableArea->isOnActivePage())
+        return;
+
+    _scrollableArea->scrollAnimator()->contentAreaWillPaint();
 }
 
 - (void)scrollerImpPair:(id)scrollerImpPair updateScrollerStyleForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle

Modified: trunk/Source/WebKit/mac/ChangeLog (106874 => 106875)


--- trunk/Source/WebKit/mac/ChangeLog	2012-02-07 00:41:31 UTC (rev 106874)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-02-07 00:43:26 UTC (rev 106875)
@@ -1,3 +1,17 @@
+2012-02-06  Anders Carlsson  <[email protected]>
+
+        Overlay scrollbars flash when window is simply activated
+        https://bugs.webkit.org/show_bug.cgi?id=77911
+        <rdar://problem/10211995>
+
+        Reviewed by Kenneth Russell.
+
+        * WebView/WebView.mm:
+        (-[WebView _windowWillOrderOnScreen:]):
+        (-[WebView _windowWillOrderOffScreen:]):
+        Call FocusController::setContainingWindowIsVisible.
+
+
 2012-02-06  Matthew Delaney  <[email protected]>
 
         toDataURL() uses stale data after putImageData()

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (106874 => 106875)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2012-02-07 00:41:31 UTC (rev 106874)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2012-02-07 00:43:26 UTC (rev 106875)
@@ -3469,8 +3469,10 @@
     // Send a change screen to make sure the initial displayID is set
     [self doWindowDidChangeScreen];
 
-    if (_private && _private->page)
-        _private->page->resumeScriptedAnimations();    
+    if (_private && _private->page) {
+        _private->page->resumeScriptedAnimations();
+        _private->page->focusController()->setContainingWindowIsVisible(true);
+    }
 }
 
 - (void)_windowDidChangeScreen:(NSNotification *)notification
@@ -3480,8 +3482,10 @@
 
 - (void)_windowWillOrderOffScreen:(NSNotification *)notification
 {
-    if (_private && _private->page)
-        _private->page->suspendScriptedAnimations();    
+    if (_private && _private->page) {
+        _private->page->suspendScriptedAnimations();
+        _private->page->focusController()->setContainingWindowIsVisible(false);
+    }
 }
 
 - (void)_windowWillClose:(NSNotification *)notification

Modified: trunk/Source/WebKit2/ChangeLog (106874 => 106875)


--- trunk/Source/WebKit2/ChangeLog	2012-02-07 00:41:31 UTC (rev 106874)
+++ trunk/Source/WebKit2/ChangeLog	2012-02-07 00:43:26 UTC (rev 106875)
@@ -1,3 +1,22 @@
+2012-02-06  Anders Carlsson  <[email protected]>
+
+        Overlay scrollbars flash when window is simply activated
+        https://bugs.webkit.org/show_bug.cgi?id=77911
+
+        Reviewed by Kenneth Russell.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _updateWindowVisibility]):
+        Use -[NSWindow isVisible] here, since we also want to consider the window hidden if the application itself is hidden.
+
+        (-[WKView _windowDidOrderOffScreen:]):
+        (-[WKView _windowDidOrderOnScreen:]):
+        Call -[WKView updateWindowVisibility].
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setWindowIsVisible):
+        Call FocusController::setContainingWindowIsVisible.
+
 2012-02-06  Martin Robinson  <[email protected]>
 
          [GTK] Fix remaining errors in GTK+ WebKit2 API

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (106874 => 106875)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2012-02-07 00:41:31 UTC (rev 106874)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2012-02-07 00:43:26 UTC (rev 106875)
@@ -1709,7 +1709,7 @@
 
 - (void)_updateWindowVisibility
 {
-    _data->_page->updateWindowIsVisible(![[self window] isMiniaturized]);
+    _data->_page->updateWindowIsVisible([[self window] isVisible]);
 }
 
 - (BOOL)_ownsWindowGrowBox
@@ -1924,6 +1924,7 @@
     // we hide it first and then update the active state.
     _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
     _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
+    [self _updateWindowVisibility];
 }
 
 - (void)_windowDidOrderOnScreen:(NSNotification *)notification
@@ -1932,6 +1933,7 @@
     // we update the active state first and then make it visible.
     _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
     _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
+    [self _updateWindowVisibility];
 }
 
 - (void)_windowDidChangeBackingProperties:(NSNotification *)notification

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (106874 => 106875)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-02-07 00:41:31 UTC (rev 106874)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-02-07 00:43:26 UTC (rev 106875)
@@ -2388,6 +2388,8 @@
 {
     m_windowIsVisible = windowIsVisible;
 
+    corePage()->focusController()->setContainingWindowIsVisible(windowIsVisible);
+
     // Tell all our plug-in views that the window visibility changed.
     for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
         (*it)->setWindowIsVisible(windowIsVisible);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to