Commit 456dd87f authored by hyatt@apple.com's avatar hyatt@apple.com

WebCore:

2008-10-13  David Hyatt  <hyatt@apple.com>

        Make RenderListBox work with CSS scrollbars.  Refactoring this code to support creation/destruction in
        the same way RenderLayer does also fixes a bug where the PLT would assert on the next-to-last page (no
        idea how to make a test case for that, though, since I couldn't repro without running the whole PLT).

        Reviewed by Tim Hatcher

        Added scrollbars/listbox-scrollbar-combinations.html

        * rendering/RenderListBox.cpp:
        (WebCore::RenderListBox::~RenderListBox):
        (WebCore::RenderListBox::updateFromElement):
        (WebCore::RenderListBox::createScrollbar):
        (WebCore::RenderListBox::destroyScrollbar):
        (WebCore::RenderListBox::setHasVerticalScrollbar):
        * rendering/RenderListBox.h:

LayoutTests:

2008-10-13  David Hyatt  <hyatt@apple.com>

        Add test case for custom CSS listbox scrollbars.

        Reviewed by Tim Hatcher

        * platform/mac/scrollbars/listbox-scrollbar-combinations-expected.checksum: Added.
        * platform/mac/scrollbars/listbox-scrollbar-combinations-expected.png: Added.
        * platform/mac/scrollbars/listbox-scrollbar-combinations-expected.txt: Added.
        * scrollbars/listbox-scrollbar-combinations.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37566 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3cd5ad92
2008-10-13 David Hyatt <hyatt@apple.com>
Add test case for custom CSS listbox scrollbars.
Reviewed by Tim Hatcher
* platform/mac/scrollbars/listbox-scrollbar-combinations-expected.checksum: Added.
* platform/mac/scrollbars/listbox-scrollbar-combinations-expected.png: Added.
* platform/mac/scrollbars/listbox-scrollbar-combinations-expected.txt: Added.
* scrollbars/listbox-scrollbar-combinations.html: Added.
2008-10-13 Timothy Hatcher <timothy@apple.com>
Adds an complex styled scrollbar test that exercises all pseudo-elements and pseudo-classes.
......
d049e0219c8c4f3d70fc93f3a358e00f
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderListBox {SELECT} at (20,20) size 125x100 [color=#DCDCDC] [bgcolor=#718D93] [border: (1px solid #D3D3D3)]
RenderText {#text} at (165,0) size 4x18
text run at (165,0) width 4: " "
RenderListBox {SELECT} at (189,20) size 125x100 [color=#DCDCDC] [bgcolor=#718D93] [border: (1px solid #D3D3D3)]
RenderText {#text} at (334,0) size 4x18
text run at (334,0) width 4: " "
RenderListBox {SELECT} at (358,20) size 125x100 [color=#DCDCDC] [bgcolor=#718D93] [border: (1px solid #D3D3D3)]
RenderText {#text} at (503,0) size 4x18
text run at (503,0) width 4: " "
RenderListBox {SELECT} at (527,20) size 125x100 [color=#DCDCDC] [bgcolor=#718D93] [border: (1px solid #D3D3D3)]
RenderText {#text} at (0,0) size 0x0
RenderListBox {SELECT} at (20,160) size 125x100 [color=#DCDCDC] [bgcolor=#718D93] [border: (1px solid #D3D3D3)]
RenderText {#text} at (165,140) size 4x18
text run at (165,140) width 4: " "
RenderListBox {SELECT} at (189,160) size 125x100 [color=#DCDCDC] [bgcolor=#718D93] [border: (1px solid #D3D3D3)]
RenderText {#text} at (334,140) size 4x18
text run at (334,140) width 4: " "
RenderListBox {SELECT} at (358,160) size 125x100 [color=#DCDCDC] [bgcolor=#718D93] [border: (1px solid #D3D3D3)]
RenderText {#text} at (0,0) size 0x0
This diff is collapsed.
2008-10-13 David Hyatt <hyatt@apple.com>
Make RenderListBox work with CSS scrollbars. Refactoring this code to support creation/destruction in
the same way RenderLayer does also fixes a bug where the PLT would assert on the next-to-last page (no
idea how to make a test case for that, though, since I couldn't repro without running the whole PLT).
Reviewed by Tim Hatcher
Added scrollbars/listbox-scrollbar-combinations.html
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::~RenderListBox):
(WebCore::RenderListBox::updateFromElement):
(WebCore::RenderListBox::createScrollbar):
(WebCore::RenderListBox::destroyScrollbar):
(WebCore::RenderListBox::setHasVerticalScrollbar):
* rendering/RenderListBox.h:
2008-10-13 David Hyatt <hyatt@apple.com>
In order to always match the :corner-present pseudo-class properly, delay initial updating of
......
......@@ -46,6 +46,7 @@
#include "HTMLSelectElement.h"
#include "HitTestResult.h"
#include "Page.h"
#include "RenderScrollbar.h"
#include "RenderTheme.h"
#include "RenderView.h"
#include "Scrollbar.h"
......@@ -83,11 +84,7 @@ RenderListBox::RenderListBox(HTMLSelectElement* element)
RenderListBox::~RenderListBox()
{
if (m_vBar) {
if (FrameView* view = node()->document()->view())
view->removeChild(m_vBar.get());
m_vBar->setClient(0);
}
setHasVerticalScrollbar(false);
}
void RenderListBox::styleDidChange(RenderStyle::Diff diff, const RenderStyle* oldStyle)
......@@ -125,13 +122,8 @@ void RenderListBox::updateFromElement()
m_optionsWidth = static_cast<int>(ceilf(width));
m_optionsChanged = false;
if (!m_vBar)
if (FrameView* view = node()->document()->view()) {
RefPtr<Scrollbar> widget = Scrollbar::createNativeScrollbar(this, VerticalScrollbar, SmallScrollbar);
view->addChild(widget.get());
m_vBar = widget.release();
}
setHasVerticalScrollbar(true);
setNeedsLayoutAndPrefWidthsRecalc();
}
}
......@@ -615,4 +607,46 @@ bool RenderListBox::isScrollable() const
return RenderObject::isScrollable();
}
PassRefPtr<Scrollbar> RenderListBox::createScrollbar()
{
RefPtr<Scrollbar> widget;
bool hasCustomScrollbarStyle = style()->hasPseudoStyle(RenderStyle::SCROLLBAR);
if (hasCustomScrollbarStyle)
widget = RenderScrollbar::createCustomScrollbar(this, VerticalScrollbar, this);
else
widget = Scrollbar::createNativeScrollbar(this, VerticalScrollbar, SmallScrollbar);
document()->view()->addChild(widget.get());
return widget.release();
}
void RenderListBox::destroyScrollbar()
{
if (!m_vBar)
return;
m_vBar->removeFromParent();
m_vBar->setClient(0);
m_vBar = 0;
}
void RenderListBox::setHasVerticalScrollbar(bool hasScrollbar)
{
if (hasScrollbar == (m_vBar != 0))
return;
if (hasScrollbar)
m_vBar = createScrollbar();
else
destroyScrollbar();
if (m_vBar)
m_vBar->styleChanged();
#if ENABLE(DASHBOARD_SUPPORT)
// Force an update since we know the scrollbars have changed things.
if (document()->hasDashboardRegions())
document()->setDashboardRegionsDirty(true);
#endif
}
} // namespace WebCore
......@@ -103,6 +103,10 @@ private:
virtual bool isActive() const;
virtual bool scrollbarCornerPresent() const { return false; } // We don't support resize on list boxes yet. If we did this would have to change.
void setHasVerticalScrollbar(bool hasScrollbar);
PassRefPtr<Scrollbar> createScrollbar();
void destroyScrollbar();
int itemHeight() const;
void valueChanged(unsigned listIndex);
int size() const;
......
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