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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112325
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-03-27 James Robinson <jamesr@chromium.org>
+
+ 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 <adamk@chromium.org>
Hold a reference to refChild in insertBefore before calling collectChildrenAndRemoveFromOldParent
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)
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
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()) {
}
+void ScrollingCoordinator::frameViewScrollableAreasDidChange(FrameView*)
+{
+ ASSERT(isMainThread());
+ ASSERT(m_page);
+
+ Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame()->view());
+ setNonFastScrollableRegion(nonFastScrollableRegion);
+}
+
void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView*)
{
ASSERT(isMainThread());
// 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*);
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; }
+2012-03-27 James Robinson <jamesr@chromium.org>
+
+ 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 <danakj@chromium.org>
[chromium] Make use of common animation unit test methods
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;
m_verticalScrollbar = scrollbar;
didAddVerticalScrollbar(scrollbar->scrollbar());
}
+
+ if (!hadScrollbars)
+ m_frameView->addScrollableArea(this);
}
void ScrollbarGroup::scrollbarDestroyed(WebScrollbarImpl* scrollbar)
willRemoveVerticalScrollbar(scrollbar->scrollbar());
m_verticalScrollbar = 0;
}
+
+ if (!m_horizontalScrollbar && !m_verticalScrollbar)
+ m_frameView->removeScrollableArea(this);
}
void ScrollbarGroup::setLastMousePosition(const IntPoint& point)
return 0;
}
+void ScrollbarGroup::setFrameRect(const IntRect& frameRect)
+{
+ m_frameRect = frameRect;
+}
+
+IntRect ScrollbarGroup::scrollableAreaBoundingBox() const
+{
+ return m_frameRect;
+}
+
bool ScrollbarGroup::isScrollCornerVisible() const
{
return false;
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;
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;
};
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)
}
#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();
}
// PluginViewBase methods
virtual bool getFormValue(String&);
- virtual bool wantWheelEvents();
// Widget methods
virtual void setFrameRect(const WebCore::IntRect&);