Commit 6a18a04a authored by weinig@apple.com's avatar weinig@apple.com

Overlay scrollbars crash used with a RenderListBox.

Reviewed by Beth Dakin.

* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::layout):
(WebCore::RenderListBox::contentsSize):
(WebCore::RenderListBox::currentMousePosition):
(WebCore::RenderListBox::setHasVerticalScrollbar):
* rendering/RenderListBox.h:
Implement enough of the ScrollableArea interface to get things generally
working.



git-svn-id: svn://svn.chromium.org/blink/trunk@78167 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 7ec32df5
2011-02-09 Sam Weinig <sam@webkit.org>
Reviewed by Beth Dakin.
Overlay scrollbars crash used with a RenderListBox.
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::layout):
(WebCore::RenderListBox::contentsSize):
(WebCore::RenderListBox::currentMousePosition):
(WebCore::RenderListBox::setHasVerticalScrollbar):
* rendering/RenderListBox.h:
Implement enough of the ScrollableArea interface to get things generally
working.
2011-02-09 Beth Dakin <bdakin@apple.com>
Reviewed by Simon Fraser.
......@@ -141,8 +141,11 @@ void RenderListBox::selectionChanged()
void RenderListBox::layout()
{
RenderBlock::layout();
if (m_scrollToRevealSelectionAfterLayout)
if (m_scrollToRevealSelectionAfterLayout) {
view()->disableLayoutState();
scrollToRevealSelection();
view()->enableLayoutState();
}
}
void RenderListBox::scrollToRevealSelection()
......@@ -695,6 +698,27 @@ IntPoint RenderListBox::convertFromContainingViewToScrollbar(const Scrollbar* sc
return point;
}
IntSize RenderListBox::contentsSize() const
{
return IntSize(scrollWidth(), scrollHeight());
}
IntPoint RenderListBox::currentMousePosition() const
{
RenderView* view = this->view();
if (!view)
return IntPoint();
return view->frameView()->currentMousePosition();
}
bool RenderListBox::scrollbarWillRenderIntoCompositingLayer() const
{
RenderLayer* layer = this->enclosingLayer();
if (!layer)
return false;
return layer->scrollbarWillRenderIntoCompositingLayer();
}
PassRefPtr<Scrollbar> RenderListBox::createScrollbar()
{
RefPtr<Scrollbar> widget;
......@@ -722,10 +746,13 @@ void RenderListBox::setHasVerticalScrollbar(bool hasScrollbar)
if (hasScrollbar == (m_vBar != 0))
return;
if (hasScrollbar)
if (hasScrollbar) {
m_vBar = createScrollbar();
else
ScrollableArea::didAddVerticalScrollbar(m_vBar.get());
} else {
ScrollableArea::willRemoveVerticalScrollbar(m_vBar.get());
destroyScrollbar();
}
if (m_vBar)
m_vBar->styleChanged();
......@@ -737,12 +764,4 @@ void RenderListBox::setHasVerticalScrollbar(bool hasScrollbar)
#endif
}
bool RenderListBox::scrollbarWillRenderIntoCompositingLayer() const
{
RenderLayer* layer = this->enclosingLayer();
if (!layer)
return false;
return layer->scrollbarWillRenderIntoCompositingLayer();
}
} // namespace WebCore
......@@ -106,6 +106,8 @@ private:
virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const;
virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const;
virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); }
virtual IntSize contentsSize() const;
virtual IntPoint currentMousePosition() const;
virtual bool scrollbarWillRenderIntoCompositingLayer() const;
// NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment