Changeset 112325 in webkit


Ignore:
Timestamp:
Mar 27, 2012 3:24:36 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Scrollable plugins not registered properly in ScrollingCoordinator
https://bugs.webkit.org/show_bug.cgi?id=82163

Patch by James Robinson <jamesr@chromium.org> on 2012-03-27
Reviewed by Anders Carlsson.

Source/WebCore:

Whenever a ScrollableArea is added or removed from a FrameView's ScrollableAreaSet, we have to recalculate the
nonFastScrollableRegion. This can happen for certain types of plugins that are scrollable.

This also reverts 112142 which was a not quite right way to handle these plugins.

  • page/FrameView.cpp:

(WebCore::FrameView::addScrollableArea):
(WebCore::FrameView::removeScrollableArea):

  • page/scrolling/ScrollingCoordinator.cpp:

(WebCore::computeNonFastScrollableRegion):
(WebCore::ScrollingCoordinator::frameViewScrollableAreasDidChange):
(WebCore):

  • page/scrolling/ScrollingCoordinator.h:

(ScrollingCoordinator):

  • plugins/PluginViewBase.h:

Source/WebKit/chromium:

Since ScrollbarGroups are ScrollableAreas, they need to be able to report their bounds for the
ScrollingCoordinator's calculateNonFastScrollableRegion. This also changes ScrollbarGroups to only be registered
as ScrollableAreas on the FrameView's set when they actually have Scrollbars.

  • src/ScrollbarGroup.cpp:

(WebKit::ScrollbarGroup::ScrollbarGroup):
(WebKit::ScrollbarGroup::~ScrollbarGroup):
(WebKit::ScrollbarGroup::scrollbarCreated):
(WebKit::ScrollbarGroup::scrollbarDestroyed):
(WebKit::ScrollbarGroup::setFrameRect):
(WebKit):
(WebKit::ScrollbarGroup::scrollableAreaBoundingBox):

  • src/ScrollbarGroup.h:

(ScrollbarGroup):

  • src/WebPluginContainerImpl.cpp:

(WebKit::WebPluginContainerImpl::reportGeometry):
(WebKit):
(WebKit::WebPluginContainerImpl::scrollbarGroup):

  • src/WebPluginContainerImpl.h:

(WebPluginContainerImpl):

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r112323 r112325  
     12012-03-27  James Robinson  <jamesr@chromium.org>
     2
     3        Scrollable plugins not registered properly in ScrollingCoordinator
     4        https://bugs.webkit.org/show_bug.cgi?id=82163
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Whenever a ScrollableArea is added or removed from a FrameView's ScrollableAreaSet, we have to recalculate the
     9        nonFastScrollableRegion. This can happen for certain types of plugins that are scrollable.
     10
     11        This also reverts 112142 which was a not quite right way to handle these plugins.
     12
     13        * page/FrameView.cpp:
     14        (WebCore::FrameView::addScrollableArea):
     15        (WebCore::FrameView::removeScrollableArea):
     16        * page/scrolling/ScrollingCoordinator.cpp:
     17        (WebCore::computeNonFastScrollableRegion):
     18        (WebCore::ScrollingCoordinator::frameViewScrollableAreasDidChange):
     19        (WebCore):
     20        * page/scrolling/ScrollingCoordinator.h:
     21        (ScrollingCoordinator):
     22        * plugins/PluginViewBase.h:
     23
    1242012-03-27  Adam Klein  <adamk@chromium.org>
    225
  • trunk/Source/WebCore/page/FrameView.cpp

    r112283 r112325  
    33863386        m_scrollableAreas = adoptPtr(new ScrollableAreaSet);
    33873387    m_scrollableAreas->add(scrollableArea);
     3388
     3389    if (Page* page = m_frame->page()) {
     3390        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
     3391            scrollingCoordinator->frameViewScrollableAreasDidChange(this);
     3392    }
    33883393}
    33893394
     
    33933398        return;
    33943399    m_scrollableAreas->remove(scrollableArea);
     3400
     3401    if (Page* page = m_frame->page()) {
     3402        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
     3403            scrollingCoordinator->frameViewScrollableAreasDidChange(this);
     3404    }
    33953405}
    33963406
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r112148 r112325  
    113113        if ((*it)->isFrameView())
    114114            childFrameViews.add(static_cast<FrameView*>(it->get()));
    115         else if ((*it)->isPluginViewBase()) {
    116             if (static_cast<PluginViewBase*>(it->get())->wantWheelEvents())
    117                 nonFastScrollableRegion.unite((*it)->frameRect());
    118         }
    119115    }
    120116
     
    160156}
    161157
     158void ScrollingCoordinator::frameViewScrollableAreasDidChange(FrameView*)
     159{
     160    ASSERT(isMainThread());
     161    ASSERT(m_page);
     162
     163    Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame()->view());
     164    setNonFastScrollableRegion(nonFastScrollableRegion);
     165}
     166
    162167void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView*)
    163168{
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h

    r109801 r112325  
    7272    // Should be called whenever the given frame view has been laid out.
    7373    void frameViewLayoutUpdated(FrameView*);
     74
     75    // Should be called whenever the set of ScrollableAreas inside a FrameView changes.
     76    void frameViewScrollableAreasDidChange(FrameView*);
    7477
    7578    // Should be called whenever a wheel event handler is added or removed in the
  • trunk/Source/WebCore/plugins/PluginViewBase.h

    r112142 r112325  
    5454    virtual bool scroll(ScrollDirection, ScrollGranularity) { return false; }
    5555
    56     virtual bool wantWheelEvents() { return false; }
    57 
    5856    // A plug-in can ask WebKit to handle scrollbars for it.
    5957    virtual Scrollbar* horizontalScrollbar() { return 0; }
  • trunk/Source/WebKit/chromium/ChangeLog

    r112317 r112325  
     12012-03-27  James Robinson  <jamesr@chromium.org>
     2
     3        Scrollable plugins not registered properly in ScrollingCoordinator
     4        https://bugs.webkit.org/show_bug.cgi?id=82163
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Since ScrollbarGroups are ScrollableAreas, they need to be able to report their bounds for the
     9        ScrollingCoordinator's calculateNonFastScrollableRegion. This also changes ScrollbarGroups to only be registered
     10        as ScrollableAreas on the FrameView's set when they actually have Scrollbars.
     11
     12        * src/ScrollbarGroup.cpp:
     13        (WebKit::ScrollbarGroup::ScrollbarGroup):
     14        (WebKit::ScrollbarGroup::~ScrollbarGroup):
     15        (WebKit::ScrollbarGroup::scrollbarCreated):
     16        (WebKit::ScrollbarGroup::scrollbarDestroyed):
     17        (WebKit::ScrollbarGroup::setFrameRect):
     18        (WebKit):
     19        (WebKit::ScrollbarGroup::scrollableAreaBoundingBox):
     20        * src/ScrollbarGroup.h:
     21        (ScrollbarGroup):
     22        * src/WebPluginContainerImpl.cpp:
     23        (WebKit::WebPluginContainerImpl::reportGeometry):
     24        (WebKit):
     25        (WebKit::WebPluginContainerImpl::scrollbarGroup):
     26        * src/WebPluginContainerImpl.h:
     27        (WebPluginContainerImpl):
     28
    1292012-03-27  Dana Jansens  <danakj@chromium.org>
    230
  • trunk/Source/WebKit/chromium/src/ScrollbarGroup.cpp

    r106977 r112325  
    3737namespace WebKit {
    3838
    39 ScrollbarGroup::ScrollbarGroup(FrameView* frameView)
     39ScrollbarGroup::ScrollbarGroup(FrameView* frameView, const IntRect& frameRect)
    4040    : m_frameView(frameView)
     41    , m_frameRect(frameRect)
    4142    , m_horizontalScrollbar(0)
    4243    , m_verticalScrollbar(0)
    4344{
    44     m_frameView->addScrollableArea(this);
    4545}
    4646
     
    4949    ASSERT(!m_horizontalScrollbar);
    5050    ASSERT(!m_verticalScrollbar);
    51     m_frameView->removeScrollableArea(this);
    5251}
    5352
    5453void ScrollbarGroup::scrollbarCreated(WebScrollbarImpl* scrollbar)
    5554{
     55    bool hadScrollbars = m_horizontalScrollbar || m_verticalScrollbar;
    5656    if (scrollbar->scrollbar()->orientation() == HorizontalScrollbar) {
    5757        ASSERT(!m_horizontalScrollbar);
     
    6363        didAddVerticalScrollbar(scrollbar->scrollbar());
    6464    }
     65
     66    if (!hadScrollbars)
     67        m_frameView->addScrollableArea(this);
    6568}
    6669
     
    7578        m_verticalScrollbar = 0;
    7679    }
     80
     81    if (!m_horizontalScrollbar && !m_verticalScrollbar)
     82        m_frameView->removeScrollableArea(this);
    7783}
    7884
     
    128134    // FIXME: Return a parent scrollable area that can be scrolled.
    129135    return 0;
     136}
     137
     138void ScrollbarGroup::setFrameRect(const IntRect& frameRect)
     139{
     140    m_frameRect = frameRect;
     141}
     142
     143IntRect ScrollbarGroup::scrollableAreaBoundingBox() const
     144{
     145    return m_frameRect;
    130146}
    131147
  • trunk/Source/WebKit/chromium/src/ScrollbarGroup.h

    r106977 r112325  
    4141class ScrollbarGroup : public WebCore::ScrollableArea {
    4242public:
    43     explicit ScrollbarGroup(WebCore::FrameView*);
     43    ScrollbarGroup(WebCore::FrameView*, const WebCore::IntRect& frameRect);
    4444    ~ScrollbarGroup();
    4545
     
    4747    void scrollbarDestroyed(WebScrollbarImpl*);
    4848    void setLastMousePosition(const WebCore::IntPoint&);
     49    void setFrameRect(const WebCore::IntRect&);
    4950
    5051    // WebCore::ScrollableArea methods
     
    7374    virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate);
    7475    virtual bool isOnActivePage() const;
     76    virtual WebCore::IntRect scrollableAreaBoundingBox() const;
    7577
    7678private:
    7779    WebCore::FrameView* m_frameView;
    7880    WebCore::IntPoint m_lastMousePosition;
     81    WebCore::IntRect m_frameRect;
    7982    WebScrollbarImpl* m_horizontalScrollbar;
    8083    WebScrollbarImpl* m_verticalScrollbar;
  • trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp

    r112142 r112325  
    329329    m_webPlugin->updateGeometry(windowRect, clipRect, cutOutRects, isVisible());
    330330
    331     if (m_scrollbarGroup)
     331    if (m_scrollbarGroup) {
    332332        m_scrollbarGroup->scrollAnimator()->contentsResized();
     333        m_scrollbarGroup->setFrameRect(frameRect());
     334    }
    333335}
    334336
     
    519521#endif
    520522
    521 bool WebPluginContainerImpl::wantWheelEvents()
    522 {
    523     return m_scrollbarGroup;
    524 }
    525 
    526523ScrollbarGroup* WebPluginContainerImpl::scrollbarGroup()
    527524{
    528525    if (!m_scrollbarGroup)
    529         m_scrollbarGroup = adoptPtr(new ScrollbarGroup(m_element->document()->frame()->view()));
     526        m_scrollbarGroup = adoptPtr(new ScrollbarGroup(m_element->document()->frame()->view(), frameRect()));
    530527    return m_scrollbarGroup.get();
    531528}
  • trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h

    r112142 r112325  
    7474    // PluginViewBase methods
    7575    virtual bool getFormValue(String&);
    76     virtual bool wantWheelEvents();
    7776
    7877    // Widget methods
Note: See TracChangeset for help on using the changeset viewer.