Title: [112325] trunk/Source
Revision
112325
Author
[email protected]
Date
2012-03-27 15:24:36 -0700 (Tue, 27 Mar 2012)

Log Message

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

Patch by James Robinson <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (112324 => 112325)


--- trunk/Source/WebCore/ChangeLog	2012-03-27 22:21:11 UTC (rev 112324)
+++ trunk/Source/WebCore/ChangeLog	2012-03-27 22:24:36 UTC (rev 112325)
@@ -1,3 +1,26 @@
+2012-03-27  James Robinson  <[email protected]>
+
+        Scrollable plugins not registered properly in ScrollingCoordinator
+        https://bugs.webkit.org/show_bug.cgi?id=82163
+
+        Reviewed by Anders Carlsson.
+
+        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:
+
 2012-03-27  Adam Klein  <[email protected]>
 
         Hold a reference to refChild in insertBefore before calling collectChildrenAndRemoveFromOldParent

Modified: trunk/Source/WebCore/page/FrameView.cpp (112324 => 112325)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-03-27 22:21:11 UTC (rev 112324)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-03-27 22:24:36 UTC (rev 112325)
@@ -3385,6 +3385,11 @@
     if (!m_scrollableAreas)
         m_scrollableAreas = adoptPtr(new ScrollableAreaSet);
     m_scrollableAreas->add(scrollableArea);
+
+    if (Page* page = m_frame->page()) {
+        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
+            scrollingCoordinator->frameViewScrollableAreasDidChange(this);
+    }
 }
 
 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea)
@@ -3392,6 +3397,11 @@
     if (!m_scrollableAreas)
         return;
     m_scrollableAreas->remove(scrollableArea);
+
+    if (Page* page = m_frame->page()) {
+        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
+            scrollingCoordinator->frameViewScrollableAreasDidChange(this);
+    }
 }
 
 bool FrameView::containsScrollableArea(ScrollableArea* scrollableArea) const

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (112324 => 112325)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-03-27 22:21:11 UTC (rev 112324)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-03-27 22:24:36 UTC (rev 112325)
@@ -112,10 +112,6 @@
     for (HashSet<RefPtr<Widget> >::const_iterator it = frameView->children()->begin(), end = frameView->children()->end(); it != end; ++it) {
         if ((*it)->isFrameView())
             childFrameViews.add(static_cast<FrameView*>(it->get()));
-        else if ((*it)->isPluginViewBase()) {
-            if (static_cast<PluginViewBase*>(it->get())->wantWheelEvents())
-                nonFastScrollableRegion.unite((*it)->frameRect());
-        }
     }
 
     if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) {
@@ -159,6 +155,15 @@
 
 }
 
+void ScrollingCoordinator::frameViewScrollableAreasDidChange(FrameView*)
+{
+    ASSERT(isMainThread());
+    ASSERT(m_page);
+
+    Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame()->view());
+    setNonFastScrollableRegion(nonFastScrollableRegion);
+}
+
 void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView*)
 {
     ASSERT(isMainThread());

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (112324 => 112325)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2012-03-27 22:21:11 UTC (rev 112324)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2012-03-27 22:24:36 UTC (rev 112325)
@@ -72,6 +72,9 @@
     // Should be called whenever the given frame view has been laid out.
     void frameViewLayoutUpdated(FrameView*);
 
+    // Should be called whenever the set of ScrollableAreas inside a FrameView changes.
+    void frameViewScrollableAreasDidChange(FrameView*);
+
     // Should be called whenever a wheel event handler is added or removed in the 
     // frame view's underlying document.
     void frameViewWheelEventHandlerCountChanged(FrameView*);

Modified: trunk/Source/WebCore/plugins/PluginViewBase.h (112324 => 112325)


--- trunk/Source/WebCore/plugins/PluginViewBase.h	2012-03-27 22:21:11 UTC (rev 112324)
+++ trunk/Source/WebCore/plugins/PluginViewBase.h	2012-03-27 22:24:36 UTC (rev 112325)
@@ -53,8 +53,6 @@
     virtual bool getFormValue(String&) { return false; }
     virtual bool scroll(ScrollDirection, ScrollGranularity) { return false; }
 
-    virtual bool wantWheelEvents() { return false; }
-
     // A plug-in can ask WebKit to handle scrollbars for it.
     virtual Scrollbar* horizontalScrollbar() { return 0; }
     virtual Scrollbar* verticalScrollbar() { return 0; }

Modified: trunk/Source/WebKit/chromium/ChangeLog (112324 => 112325)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-27 22:21:11 UTC (rev 112324)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-27 22:24:36 UTC (rev 112325)
@@ -1,3 +1,31 @@
+2012-03-27  James Robinson  <[email protected]>
+
+        Scrollable plugins not registered properly in ScrollingCoordinator
+        https://bugs.webkit.org/show_bug.cgi?id=82163
+
+        Reviewed by Anders Carlsson.
+
+        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):
+
 2012-03-27  Dana Jansens  <[email protected]>
 
         [chromium] Make use of common animation unit test methods

Modified: trunk/Source/WebKit/chromium/src/ScrollbarGroup.cpp (112324 => 112325)


--- trunk/Source/WebKit/chromium/src/ScrollbarGroup.cpp	2012-03-27 22:21:11 UTC (rev 112324)
+++ trunk/Source/WebKit/chromium/src/ScrollbarGroup.cpp	2012-03-27 22:24:36 UTC (rev 112325)
@@ -36,23 +36,23 @@
 
 namespace WebKit {
 
-ScrollbarGroup::ScrollbarGroup(FrameView* frameView)
+ScrollbarGroup::ScrollbarGroup(FrameView* frameView, const IntRect& frameRect)
     : m_frameView(frameView)
+    , m_frameRect(frameRect)
     , m_horizontalScrollbar(0)
     , m_verticalScrollbar(0)
 {
-    m_frameView->addScrollableArea(this);
 }
 
 ScrollbarGroup::~ScrollbarGroup()
 {
     ASSERT(!m_horizontalScrollbar);
     ASSERT(!m_verticalScrollbar);
-    m_frameView->removeScrollableArea(this);
 }
 
 void ScrollbarGroup::scrollbarCreated(WebScrollbarImpl* scrollbar)
 {
+    bool hadScrollbars = m_horizontalScrollbar || m_verticalScrollbar;
     if (scrollbar->scrollbar()->orientation() == HorizontalScrollbar) {
         ASSERT(!m_horizontalScrollbar);
         m_horizontalScrollbar = scrollbar;
@@ -62,6 +62,9 @@
         m_verticalScrollbar = scrollbar;
         didAddVerticalScrollbar(scrollbar->scrollbar());
     }
+
+    if (!hadScrollbars)
+        m_frameView->addScrollableArea(this);
 }
 
 void ScrollbarGroup::scrollbarDestroyed(WebScrollbarImpl* scrollbar)
@@ -74,6 +77,9 @@
         willRemoveVerticalScrollbar(scrollbar->scrollbar());
         m_verticalScrollbar = 0;
     }
+
+    if (!m_horizontalScrollbar && !m_verticalScrollbar)
+        m_frameView->removeScrollableArea(this);
 }
 
 void ScrollbarGroup::setLastMousePosition(const IntPoint& point)
@@ -129,6 +135,16 @@
     return 0;
 }
 
+void ScrollbarGroup::setFrameRect(const IntRect& frameRect)
+{
+    m_frameRect = frameRect;
+}
+
+IntRect ScrollbarGroup::scrollableAreaBoundingBox() const
+{
+    return m_frameRect;
+}
+
 bool ScrollbarGroup::isScrollCornerVisible() const
 {
     return false;

Modified: trunk/Source/WebKit/chromium/src/ScrollbarGroup.h (112324 => 112325)


--- trunk/Source/WebKit/chromium/src/ScrollbarGroup.h	2012-03-27 22:21:11 UTC (rev 112324)
+++ trunk/Source/WebKit/chromium/src/ScrollbarGroup.h	2012-03-27 22:24:36 UTC (rev 112325)
@@ -40,12 +40,13 @@
 
 class ScrollbarGroup : public WebCore::ScrollableArea {
 public:
-    explicit ScrollbarGroup(WebCore::FrameView*);
+    ScrollbarGroup(WebCore::FrameView*, const WebCore::IntRect& frameRect);
     ~ScrollbarGroup();
 
     void scrollbarCreated(WebScrollbarImpl*);
     void scrollbarDestroyed(WebScrollbarImpl*);
     void setLastMousePosition(const WebCore::IntPoint&);
+    void setFrameRect(const WebCore::IntRect&);
 
     // WebCore::ScrollableArea methods
     virtual int scrollSize(WebCore::ScrollbarOrientation) const;
@@ -72,10 +73,12 @@
     virtual bool shouldSuspendScrollAnimations() const;
     virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate);
     virtual bool isOnActivePage() const;
+    virtual WebCore::IntRect scrollableAreaBoundingBox() const;
 
 private:
     WebCore::FrameView* m_frameView;
     WebCore::IntPoint m_lastMousePosition;
+    WebCore::IntRect m_frameRect;
     WebScrollbarImpl* m_horizontalScrollbar;
     WebScrollbarImpl* m_verticalScrollbar;
 };

Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp (112324 => 112325)


--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2012-03-27 22:21:11 UTC (rev 112324)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2012-03-27 22:24:36 UTC (rev 112325)
@@ -328,8 +328,10 @@
 
     m_webPlugin->updateGeometry(windowRect, clipRect, cutOutRects, isVisible());
 
-    if (m_scrollbarGroup)
+    if (m_scrollbarGroup) {
         m_scrollbarGroup->scrollAnimator()->contentsResized();
+        m_scrollbarGroup->setFrameRect(frameRect());
+    }
 }
 
 void WebPluginContainerImpl::setBackingTextureId(unsigned id)
@@ -518,15 +520,10 @@
 }
 #endif
 
-bool WebPluginContainerImpl::wantWheelEvents()
-{
-    return m_scrollbarGroup;
-}
-
 ScrollbarGroup* WebPluginContainerImpl::scrollbarGroup()
 {
     if (!m_scrollbarGroup)
-        m_scrollbarGroup = adoptPtr(new ScrollbarGroup(m_element->document()->frame()->view()));
+        m_scrollbarGroup = adoptPtr(new ScrollbarGroup(m_element->document()->frame()->view(), frameRect()));
     return m_scrollbarGroup.get();
 }
 

Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h (112324 => 112325)


--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h	2012-03-27 22:21:11 UTC (rev 112324)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h	2012-03-27 22:24:36 UTC (rev 112325)
@@ -73,7 +73,6 @@
 
     // PluginViewBase methods
     virtual bool getFormValue(String&);
-    virtual bool wantWheelEvents();
 
     // Widget methods
     virtual void setFrameRect(const WebCore::IntRect&);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to