summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderScrollbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/RenderScrollbar.cpp')
-rw-r--r--Source/WebCore/rendering/RenderScrollbar.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/WebCore/rendering/RenderScrollbar.cpp b/Source/WebCore/rendering/RenderScrollbar.cpp
index 0c50c0d39..68d4a3bee 100644
--- a/Source/WebCore/rendering/RenderScrollbar.cpp
+++ b/Source/WebCore/rendering/RenderScrollbar.cpp
@@ -34,16 +34,18 @@
namespace WebCore {
-PassRefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame)
+PassRefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, Node* ownerNode, Frame* owningFrame)
{
- return adoptRef(new RenderScrollbar(scrollableArea, orientation, renderer, owningFrame));
+ return adoptRef(new RenderScrollbar(scrollableArea, orientation, ownerNode, owningFrame));
}
-RenderScrollbar::RenderScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame)
+RenderScrollbar::RenderScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, Node* ownerNode, Frame* owningFrame)
: Scrollbar(scrollableArea, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme())
- , m_owner(renderer)
+ , m_owner(ownerNode)
, m_owningFrame(owningFrame)
{
+ ASSERT(ownerNode || owningFrame);
+
// FIXME: We need to do this because RenderScrollbar::styleChanged is called as soon as the scrollbar is created.
// Update the scrollbar size.
@@ -81,7 +83,7 @@ RenderBox* RenderScrollbar::owningRenderer() const
RenderBox* currentRenderer = m_owningFrame->ownerRenderer();
return currentRenderer;
}
- return m_owner;
+ return m_owner && m_owner->renderer() ? m_owner->renderer()->enclosingBox() : 0;
}
void RenderScrollbar::setParent(ScrollView* parent)
@@ -268,9 +270,11 @@ void RenderScrollbar::updateScrollbarPart(ScrollbarPart partType, bool destroy)
RenderScrollbarPart* partRenderer = m_parts.get(partType);
if (!partRenderer && needRenderer) {
partRenderer = new (owningRenderer()->renderArena()) RenderScrollbarPart(owningRenderer()->document(), this, partType);
+ partRenderer->setParent(owningRenderer());
m_parts.set(partType, partRenderer);
} else if (partRenderer && !needRenderer) {
m_parts.remove(partType);
+ partRenderer->setParent(0);
partRenderer->destroy();
partRenderer = 0;
}