Changeset 106875 in webkit


Ignore:
Timestamp:
Feb 6, 2012 4:43:26 PM (12 years ago)
Author:
andersca@apple.com
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.

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106874 r106875  
     12012-02-06  Anders Carlsson  <andersca@apple.com>
     2
     3        Overlay scrollbars flash when window is simply activated
     4        https://bugs.webkit.org/show_bug.cgi?id=77911
     5        <rdar://problem/10211995>
     6
     7        Reviewed by Kenneth Russell.
     8
     9        Add a new member function, FocusController::setContainingWindowIsVisible, and move the code
     10        that calls ScrollableArea::contentAreaDidShow/ScrollableArea::contentAreaDidHide there, since
     11        we only want to flash scrollers when the window becomes visible.
     12
     13        * WebCore.exp.in:
     14        * page/FocusController.cpp:
     15        (WebCore::FocusController::FocusController):
     16        (WebCore::FocusController::setActive):
     17        (WebCore::FocusController::setContainingWindowIsVisible):
     18        (WebCore):
     19        * page/FocusController.h:
     20        (FocusController):
     21        (WebCore::FocusController::containingWindowIsVisible):
     22
     23        * platform/mac/ScrollAnimatorMac.mm:
     24        (-[WebScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
     25        Call ScrollAnimatorMac::contentAreaWillPaint here, since that will trigger AppKit to flash the scrollers.
     26
    1272012-02-06  Greg Simon  <gregsimon@chromium.org>
    228
  • trunk/Source/WebCore/WebCore.exp.in

    r106836 r106875  
    435435__ZN7WebCore15FocusController15setFocusedFrameEN3WTF10PassRefPtrINS_5FrameEEE
    436436__ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE
     437__ZN7WebCore15FocusController28setContainingWindowIsVisibleEb
    437438__ZN7WebCore15FocusController9setActiveEb
    438439__ZN7WebCore15GraphicsContext11clearShadowEv
  • trunk/Source/WebCore/page/FocusController.cpp

    r106530 r106875  
    8989    , m_isFocused(false)
    9090    , m_isChangingFocusedFrame(false)
     91    , m_containingWindowIsVisible(false)
    9192{
    9293}
     
    574575            view->updateControlTints();
    575576        }
    576 
    577         if (const HashSet<ScrollableArea*>* scrollableAreas = m_page->scrollableAreaSet()) {
    578             HashSet<ScrollableArea*>::const_iterator end = scrollableAreas->end();
    579             for (HashSet<ScrollableArea*>::const_iterator it = scrollableAreas->begin(); it != end; ++it) {
    580                 if (!active)
    581                     (*it)->contentAreaDidHide();
    582                 else
    583                     (*it)->contentAreaDidShow();
    584             }
    585         }
    586577    }
    587578
     
    590581    if (m_focusedFrame && isFocused())
    591582        dispatchEventsOnWindowAndFocusedNode(m_focusedFrame->document(), active);
     583}
     584
     585void FocusController::setContainingWindowIsVisible(bool containingWindowIsVisible)
     586{
     587    if (m_containingWindowIsVisible == containingWindowIsVisible)
     588        return;
     589
     590    m_containingWindowIsVisible = containingWindowIsVisible;
     591
     592    FrameView* view = m_page->mainFrame()->view();
     593    if (!view)
     594        return;
     595
     596    if (const HashSet<ScrollableArea*>* scrollableAreas = m_page->scrollableAreaSet()) {
     597        HashSet<ScrollableArea*>::const_iterator end = scrollableAreas->end();
     598        for (HashSet<ScrollableArea*>::const_iterator it = scrollableAreas->begin(); it != end; ++it) {
     599            if (!containingWindowIsVisible)
     600                (*it)->contentAreaDidHide();
     601            else
     602                (*it)->contentAreaDidShow();
     603        }
     604    }
    592605}
    593606
  • trunk/Source/WebCore/page/FocusController.h

    r103365 r106875  
    6464    bool isFocused() const { return m_isFocused; }
    6565
     66    void setContainingWindowIsVisible(bool);
     67    bool containingWindowIsVisible() const { return m_containingWindowIsVisible; }
     68
    6669    bool transferFocusToElementInShadowRoot(Element* shadowHost, bool restorePreviousSelection);
    6770
     
    97100    bool m_isFocused;
    98101    bool m_isChangingFocusedFrame;
     102    bool m_containingWindowIsVisible;
    99103
    100104};
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm

    r106073 r106875  
    254254    UNUSED_PARAM(scrollerImpPair);
    255255    UNUSED_PARAM(rect);
     256
     257    if (!_scrollableArea)
     258        return;
     259
     260    if (!_scrollableArea->isOnActivePage())
     261        return;
     262
     263    _scrollableArea->scrollAnimator()->contentAreaWillPaint();
    256264}
    257265
  • trunk/Source/WebKit/mac/ChangeLog

    r106836 r106875  
     12012-02-06  Anders Carlsson  <andersca@apple.com>
     2
     3        Overlay scrollbars flash when window is simply activated
     4        https://bugs.webkit.org/show_bug.cgi?id=77911
     5        <rdar://problem/10211995>
     6
     7        Reviewed by Kenneth Russell.
     8
     9        * WebView/WebView.mm:
     10        (-[WebView _windowWillOrderOnScreen:]):
     11        (-[WebView _windowWillOrderOffScreen:]):
     12        Call FocusController::setContainingWindowIsVisible.
     13
     14
    1152012-02-06  Matthew Delaney  <mdelaney@apple.com>
    216
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r106511 r106875  
    34703470    [self doWindowDidChangeScreen];
    34713471
    3472     if (_private && _private->page)
    3473         _private->page->resumeScriptedAnimations();   
     3472    if (_private && _private->page) {
     3473        _private->page->resumeScriptedAnimations();
     3474        _private->page->focusController()->setContainingWindowIsVisible(true);
     3475    }
    34743476}
    34753477
     
    34813483- (void)_windowWillOrderOffScreen:(NSNotification *)notification
    34823484{
    3483     if (_private && _private->page)
    3484         _private->page->suspendScriptedAnimations();   
     3485    if (_private && _private->page) {
     3486        _private->page->suspendScriptedAnimations();
     3487        _private->page->focusController()->setContainingWindowIsVisible(false);
     3488    }
    34853489}
    34863490
  • trunk/Source/WebKit2/ChangeLog

    r106838 r106875  
     12012-02-06  Anders Carlsson  <andersca@apple.com>
     2
     3        Overlay scrollbars flash when window is simply activated
     4        https://bugs.webkit.org/show_bug.cgi?id=77911
     5
     6        Reviewed by Kenneth Russell.
     7
     8        * UIProcess/API/mac/WKView.mm:
     9        (-[WKView _updateWindowVisibility]):
     10        Use -[NSWindow isVisible] here, since we also want to consider the window hidden if the application itself is hidden.
     11
     12        (-[WKView _windowDidOrderOffScreen:]):
     13        (-[WKView _windowDidOrderOnScreen:]):
     14        Call -[WKView updateWindowVisibility].
     15
     16        * WebProcess/WebPage/WebPage.cpp:
     17        (WebKit::WebPage::setWindowIsVisible):
     18        Call FocusController::setContainingWindowIsVisible.
     19
    1202012-02-06  Martin Robinson  <mrobinson@igalia.com>
    221
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r106678 r106875  
    17101710- (void)_updateWindowVisibility
    17111711{
    1712     _data->_page->updateWindowIsVisible(![[self window] isMiniaturized]);
     1712    _data->_page->updateWindowIsVisible([[self window] isVisible]);
    17131713}
    17141714
     
    19251925    _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
    19261926    _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
     1927    [self _updateWindowVisibility];
    19271928}
    19281929
     
    19331934    _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
    19341935    _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
     1936    [self _updateWindowVisibility];
    19351937}
    19361938
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r106706 r106875  
    23892389    m_windowIsVisible = windowIsVisible;
    23902390
     2391    corePage()->focusController()->setContainingWindowIsVisible(windowIsVisible);
     2392
    23912393    // Tell all our plug-in views that the window visibility changed.
    23922394    for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
Note: See TracChangeset for help on using the changeset viewer.