Reviewed by Darin.
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Oct 2006 19:59:28 +0000 (19:59 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Oct 2006 19:59:28 +0000 (19:59 +0000)
        Fixed <rdar://problem/4766987>

        - renamed ScrollBar to Scrollbar and scroll bar to scrollbar in every case
        except for file names.

        - fixed RenderLayer to properly tear down scrollbars, removing them from
        their parents.

        * bindings/js/kjs_window.cpp:
        (KJS::showModalDialog):
        (KJS::setWindowFeature):
        (KJS::parseWindowFeatures):
        * bridge/BrowserExtension.h:
        * dom/Document.cpp:
        (WebCore::Document::setInPageCache):
        * html/HTMLFrameElement.cpp:
        (WebCore::HTMLFrameElement::init):
        (WebCore::HTMLFrameElement::parseMappedAttribute):
        * html/HTMLFrameElement.h:
        (WebCore::HTMLFrameElement::scrollingMode):
        * page/Frame.cpp:
        (WebCore::Frame::finishedParsing):
        (WebCore::Frame::scrollbarsVisible):
        * page/FrameView.cpp:
        (WebCore::FrameViewPrivate::FrameViewPrivate):
        (WebCore::FrameViewPrivate::reset):
        (WebCore::FrameView::~FrameView):
        (WebCore::FrameView::resetScrollbars):
        (WebCore::FrameView::clear):
        (WebCore::FrameView::initScrollbars):
        (WebCore::FrameView::applyOverflowToViewport):
        (WebCore::FrameView::layout):
        (WebCore::FrameView::handleMousePressEvent):
        (WebCore::selectCursor):
        (WebCore::FrameView::handleMouseMoveEvent):
        (WebCore::FrameView::setScrollbarsMode):
        (WebCore::FrameView::setVScrollbarMode):
        (WebCore::FrameView::setHScrollbarMode):
        (WebCore::FrameView::restoreScrollbar):
        (WebCore::FrameView::dispatchMouseEvent):
        (WebCore::FrameView::scrollbarMoved):
        * page/FrameView.h:
        * page/MouseEventWithHitTestResults.cpp:
        (WebCore::MouseEventWithHitTestResults::MouseEventWithHitTestResults):
        * page/MouseEventWithHitTestResults.h:
        (WebCore::MouseEventWithHitTestResults::scrollbar):
        * platform/ScrollBar.cpp:
        (WebCore::Scrollbar::Scrollbar):
        (WebCore::Scrollbar::setValue):
        (WebCore::Scrollbar::setProportion):
        (WebCore::Scrollbar::setSteps):
        (WebCore::Scrollbar::scroll):
        * platform/ScrollBar.h:
        (WebCore::):
        (WebCore::ScrollbarClient::~ScrollbarClient):
        (WebCore::Scrollbar::~Scrollbar):
        (WebCore::Scrollbar::orientation):
        (WebCore::Scrollbar::controlSize):
        (WebCore::Scrollbar::hasPlatformScrollbars):
        (WebCore::Scrollbar::client):
        * platform/ScrollBarMode.h:
        (WebCore::):
        * platform/ScrollView.h:
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::isPointInScrollbar):
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::RenderLayer):
        (WebCore::RenderLayer::~RenderLayer):
        (WebCore::RenderLayer::scrollToOffset):
        (WebCore::RenderLayer::horizontaScrollbarWidget):
        (WebCore::RenderLayer::verticalScrollbarWidget):
        (WebCore::RenderLayer::valueChanged):
        (WebCore::RenderLayer::createScrollbar):
        (WebCore::RenderLayer::destroyScrollbar):
        (WebCore::RenderLayer::setHasHorizontalScrollbar):
        (WebCore::RenderLayer::setHasVerticalScrollbar):
        (WebCore::RenderLayer::verticalScrollbarWidth):
        (WebCore::RenderLayer::horizontalScrollbarHeight):
        (WebCore::RenderLayer::updateScrollInfoAfterLayout):
        * rendering/RenderLayer.h:
        (WebCore::RenderLayer::horizontalScrollbar):
        (WebCore::RenderLayer::verticalScrollbar):
        * rendering/RenderListBox.cpp:
        (WebCore::RenderListBox::~RenderListBox):
        (WebCore::RenderListBox::calcMinMaxWidth):
        (WebCore::RenderListBox::isPointInScrollbar):
        (WebCore::RenderListBox::optionAtPoint):
        (WebCore::RenderListBox::valueChanged):
        * rendering/RenderListBox.h:
        * rendering/RenderObject.h:
        (WebCore::RenderObject::NodeInfo::scrollbar):
        (WebCore::RenderObject::NodeInfo::setScrollbar):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16815 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
WebCore/ChangeLog
WebCore/bindings/js/kjs_window.cpp
WebCore/bridge/BrowserExtension.h
WebCore/dom/Document.cpp
WebCore/html/HTMLFrameElement.cpp
WebCore/html/HTMLFrameElement.h
WebCore/page/Frame.cpp
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/page/MouseEventWithHitTestResults.cpp
WebCore/page/MouseEventWithHitTestResults.h
WebCore/platform/ScrollBar.cpp
WebCore/platform/ScrollBar.h
WebCore/platform/ScrollBarMode.h
WebCore/platform/ScrollView.h
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderLayer.cpp
WebCore/rendering/RenderLayer.h
WebCore/rendering/RenderListBox.cpp
WebCore/rendering/RenderListBox.h
WebCore/rendering/RenderObject.h

index bfe8f97..41d34e4 100644 (file)
@@ -1,3 +1,100 @@
+2006-10-05  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Darin.
+        
+        Fixed <rdar://problem/4766987>
+        
+        - renamed ScrollBar to Scrollbar and scroll bar to scrollbar in every case
+        except for file names.
+        
+        - fixed RenderLayer to properly tear down scrollbars, removing them from
+        their parents.
+
+        * bindings/js/kjs_window.cpp:
+        (KJS::showModalDialog):
+        (KJS::setWindowFeature):
+        (KJS::parseWindowFeatures):
+        * bridge/BrowserExtension.h:
+        * dom/Document.cpp:
+        (WebCore::Document::setInPageCache):
+        * html/HTMLFrameElement.cpp:
+        (WebCore::HTMLFrameElement::init):
+        (WebCore::HTMLFrameElement::parseMappedAttribute):
+        * html/HTMLFrameElement.h:
+        (WebCore::HTMLFrameElement::scrollingMode):
+        * page/Frame.cpp:
+        (WebCore::Frame::finishedParsing):
+        (WebCore::Frame::scrollbarsVisible):
+        * page/FrameView.cpp:
+        (WebCore::FrameViewPrivate::FrameViewPrivate):
+        (WebCore::FrameViewPrivate::reset):
+        (WebCore::FrameView::~FrameView):
+        (WebCore::FrameView::resetScrollbars):
+        (WebCore::FrameView::clear):
+        (WebCore::FrameView::initScrollbars):
+        (WebCore::FrameView::applyOverflowToViewport):
+        (WebCore::FrameView::layout):
+        (WebCore::FrameView::handleMousePressEvent):
+        (WebCore::selectCursor):
+        (WebCore::FrameView::handleMouseMoveEvent):
+        (WebCore::FrameView::setScrollbarsMode):
+        (WebCore::FrameView::setVScrollbarMode):
+        (WebCore::FrameView::setHScrollbarMode):
+        (WebCore::FrameView::restoreScrollbar):
+        (WebCore::FrameView::dispatchMouseEvent):
+        (WebCore::FrameView::scrollbarMoved):
+        * page/FrameView.h:
+        * page/MouseEventWithHitTestResults.cpp:
+        (WebCore::MouseEventWithHitTestResults::MouseEventWithHitTestResults):
+        * page/MouseEventWithHitTestResults.h:
+        (WebCore::MouseEventWithHitTestResults::scrollbar):
+        * platform/ScrollBar.cpp:
+        (WebCore::Scrollbar::Scrollbar):
+        (WebCore::Scrollbar::setValue):
+        (WebCore::Scrollbar::setProportion):
+        (WebCore::Scrollbar::setSteps):
+        (WebCore::Scrollbar::scroll):
+        * platform/ScrollBar.h:
+        (WebCore::):
+        (WebCore::ScrollbarClient::~ScrollbarClient):
+        (WebCore::Scrollbar::~Scrollbar):
+        (WebCore::Scrollbar::orientation):
+        (WebCore::Scrollbar::controlSize):
+        (WebCore::Scrollbar::hasPlatformScrollbars):
+        (WebCore::Scrollbar::client):
+        * platform/ScrollBarMode.h:
+        (WebCore::):
+        * platform/ScrollView.h:
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::isPointInScrollbar):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::RenderLayer):
+        (WebCore::RenderLayer::~RenderLayer):
+        (WebCore::RenderLayer::scrollToOffset):
+        (WebCore::RenderLayer::horizontaScrollbarWidget):
+        (WebCore::RenderLayer::verticalScrollbarWidget):
+        (WebCore::RenderLayer::valueChanged):
+        (WebCore::RenderLayer::createScrollbar):
+        (WebCore::RenderLayer::destroyScrollbar):
+        (WebCore::RenderLayer::setHasHorizontalScrollbar):
+        (WebCore::RenderLayer::setHasVerticalScrollbar):
+        (WebCore::RenderLayer::verticalScrollbarWidth):
+        (WebCore::RenderLayer::horizontalScrollbarHeight):
+        (WebCore::RenderLayer::updateScrollInfoAfterLayout):
+        * rendering/RenderLayer.h:
+        (WebCore::RenderLayer::horizontalScrollbar):
+        (WebCore::RenderLayer::verticalScrollbar):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::~RenderListBox):
+        (WebCore::RenderListBox::calcMinMaxWidth):
+        (WebCore::RenderListBox::isPointInScrollbar):
+        (WebCore::RenderListBox::optionAtPoint):
+        (WebCore::RenderListBox::valueChanged):
+        * rendering/RenderListBox.h:
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::NodeInfo::scrollbar):
+        (WebCore::RenderObject::NodeInfo::setScrollbar):
+
 2006-10-05  Don Gibson  <dgibson77@gmail.com>
 
         Reviewed by Adam.
index 440f478..c1ea235 100644 (file)
@@ -640,7 +640,7 @@ static JSValue* showModalDialog(ExecState* exec, Window* openerWindow, const Lis
 
     wargs.dialog = true;
     wargs.resizable = boolFeature(features, "resizable");
-    wargs.scrollBarsVisible = boolFeature(features, "scroll", true);
+    wargs.scrollbarsVisible = boolFeature(features, "scroll", true);
     wargs.statusBarVisible = boolFeature(features, "status", !trusted);
     wargs.menuBarVisible = false;
     wargs.toolBarVisible = false;
@@ -1383,7 +1383,7 @@ static void setWindowFeature(const String& keyString, const String& valueString,
     else if (keyString == "fullscreen")
         windowArgs.fullscreen = value;
     else if (keyString == "scrollbars")
-        windowArgs.scrollBarsVisible = value;
+        windowArgs.scrollbarsVisible = value;
 }
 
 // Though isspace() considers \t and \v to be whitespace, Win IE doesn't.
@@ -1415,7 +1415,7 @@ static void parseWindowFeatures(const String& features, WindowArgs& windowArgs)
         windowArgs.statusBarVisible = true;
         windowArgs.toolBarVisible = true;
         windowArgs.locationBarVisible = true;
-        windowArgs.scrollBarsVisible = true;
+        windowArgs.scrollbarsVisible = true;
         windowArgs.resizable = true;
         
         return;
@@ -1425,7 +1425,7 @@ static void parseWindowFeatures(const String& features, WindowArgs& windowArgs)
     windowArgs.statusBarVisible = false;
     windowArgs.toolBarVisible = false;
     windowArgs.locationBarVisible = false;
-    windowArgs.scrollBarsVisible = false;
+    windowArgs.scrollbarsVisible = false;
     windowArgs.resizable = false;
     
     // Tread lightly in this code -- it was specifically designed to mimic Win IE's parsing behavior.
index 2fd2bbd..6012aa4 100644 (file)
@@ -46,7 +46,7 @@ struct WindowArgs {
     bool statusBarVisible;
     bool toolBarVisible;
     bool locationBarVisible;
-    bool scrollBarsVisible;
+    bool scrollbarsVisible;
     bool resizable;
 
     bool fullscreen;
index 670c1a9..4ea7ea2 100644 (file)
@@ -2570,7 +2570,7 @@ void Document::setInPageCache(bool flag)
         ASSERT(m_savedRenderer == 0);
         m_savedRenderer = renderer();
         if (m_view)
-            m_view->resetScrollBars();
+            m_view->resetScrollbars();
     } else {
         ASSERT(renderer() == 0 || renderer() == m_savedRenderer);
         ASSERT(m_renderArena);
index e23b34b..4674340 100644 (file)
@@ -59,7 +59,7 @@ void HTMLFrameElement::init()
     m_frameBorderSet = false;
     m_marginWidth = -1;
     m_marginHeight = -1;
-    m_scrolling = ScrollBarAuto;
+    m_scrolling = ScrollbarAuto;
     m_noResize = false;
     m_viewSource = false;
 }
@@ -147,9 +147,9 @@ void HTMLFrameElement::parseMappedAttribute(MappedAttribute *attr)
     } else if (attr->name() == scrollingAttr) {
         // Auto and yes both simply mean "allow scrolling." No means "don't allow scrolling."
         if (equalIgnoringCase(attr->value(), "auto") || equalIgnoringCase(attr->value(), "yes"))
-            m_scrolling = ScrollBarAuto;
+            m_scrolling = ScrollbarAuto;
         else if (equalIgnoringCase(attr->value(), "no"))
-            m_scrolling = ScrollBarAlwaysOff;
+            m_scrolling = ScrollbarAlwaysOff;
         // FIXME: If we are already attached, this has no effect.
     } else if (attr->name() == viewsourceAttr) {
         m_viewSource = !attr->isNull();
index f0b6082..8e2ecd0 100644 (file)
@@ -27,7 +27,7 @@
 #define HTMLFrameElement_H
 
 #include "HTMLElement.h"
-#include "ScrollBarMode.h"
+#include "ScrollbarMode.h"
 
 namespace WebCore {
 
@@ -72,7 +72,7 @@ public:
     
     virtual bool isURLAttribute(Attribute*) const;
 
-    ScrollBarMode scrollingMode() const { return m_scrolling; }
+    ScrollbarMode scrollingMode() const { return m_scrolling; }
     int getMarginWidth() const { return m_marginWidth; }
     int getMarginHeight() const { return m_marginHeight; }
 
@@ -113,7 +113,7 @@ protected:
 
     int m_marginWidth;
     int m_marginHeight;
-    ScrollBarMode m_scrolling;
+    ScrollbarMode m_scrolling;
 
     bool m_frameBorder : 1;
     bool m_frameBorderSet : 1;
index 9f7e112..bd14bd7 100644 (file)
@@ -859,7 +859,7 @@ void Frame::finishedParsing()
   // check if the scrollbars are really needed for the content
   // if not, remove them, relayout, and repaint
 
-  d->m_view->restoreScrollBar();
+  d->m_view->restoreScrollbar();
   gotoAnchor();
 }
 
@@ -3201,7 +3201,7 @@ bool Frame::scrollbarsVisible()
     if (!view())
         return false;
     
-    if (view()->hScrollBarMode() == ScrollBarAlwaysOff || view()->vScrollBarMode() == ScrollBarAlwaysOff)
+    if (view()->hScrollbarMode() == ScrollbarAlwaysOff || view()->vScrollbarMode() == ScrollbarAlwaysOff)
         return false;
     
     return true;
index 081eff8..9a65f64 100644 (file)
@@ -87,8 +87,8 @@ public:
         repaintRects = 0;
         isTransparent = false;
         baseBackgroundColor = Color::white;
-        vmode = hmode = ScrollBarAuto;
-        needToInitScrollBars = true;
+        vmode = hmode = ScrollbarAuto;
+        needToInitScrollbars = true;
         reset();
     }
     ~FrameViewPrivate()
@@ -101,13 +101,13 @@ public:
         underMouse = 0;
         oldUnder = 0;
         oldSubframe = 0;
-        oldScrollBar = 0;
+        oldScrollbar = 0;
         linkPressed = false;
         useSlowRepaints = false;
         slowRepaintObjectCount = 0;
         dragTarget = 0;
         borderTouched = false;
-        scrollBarMoved = false;
+        scrollbarMoved = false;
         ignoreWheelEvents = false;
         borderX = 30;
         borderY = 30;
@@ -133,16 +133,16 @@ public:
     RefPtr<Node> underMouse;
     RefPtr<Node> oldUnder;
     RefPtr<Frame> oldSubframe;
-    RefPtr<PlatformScrollBar> oldScrollBar;
+    RefPtr<PlatformScrollbar> oldScrollbar;
 
     bool borderTouched : 1;
     bool borderStart : 1;
-    bool scrollBarMoved : 1;
+    bool scrollbarMoved : 1;
     bool doFullRepaint : 1;
     bool m_hasBorder : 1;
     
-    ScrollBarMode vmode;
-    ScrollBarMode hmode;
+    ScrollbarMode vmode;
+    ScrollbarMode hmode;
     bool linkPressed;
     bool useSlowRepaints;
     unsigned slowRepaintObjectCount;
@@ -161,7 +161,7 @@ public:
     int layoutCount;
 
     bool firstLayout;
-    bool needToInitScrollBars;
+    bool needToInitScrollbars;
     bool mousePressed;
     bool isTransparent;
     Color baseBackgroundColor;
@@ -202,7 +202,7 @@ FrameView::FrameView(Frame *frame)
 
 FrameView::~FrameView()
 {
-    resetScrollBars();
+    resetScrollbars();
 
     ASSERT(m_refCount == 0);
 
@@ -230,14 +230,14 @@ void FrameView::clearPart()
     m_frame = 0;
 }
 
-void FrameView::resetScrollBars()
+void FrameView::resetScrollbars()
 {
     // Reset the document's scrollbars back to our defaults before we yield the floor.
     d->firstLayout = true;
-    suppressScrollBars(true);
-    ScrollView::setVScrollBarMode(d->vmode);
-    ScrollView::setHScrollBarMode(d->hmode);
-    suppressScrollBars(false);
+    suppressScrollbars(true);
+    ScrollView::setVScrollbarMode(d->vmode);
+    ScrollView::setHScrollbarMode(d->hmode);
+    suppressScrollbars(false);
 }
 
 void FrameView::init()
@@ -262,7 +262,7 @@ void FrameView::clear()
 
     cleared();
 
-    suppressScrollBars(true);
+    suppressScrollbars(true);
 }
 
 bool FrameView::didFirstLayout() const
@@ -270,12 +270,12 @@ bool FrameView::didFirstLayout() const
     return !d->firstLayout;
 }
 
-void FrameView::initScrollBars()
+void FrameView::initScrollbars()
 {
-    if (!d->needToInitScrollBars)
+    if (!d->needToInitScrollbars)
         return;
-    d->needToInitScrollBars = false;
-    setScrollBarsMode(hScrollBarMode());
+    d->needToInitScrollbars = false;
+    setScrollbarsMode(hScrollbarMode());
 }
 
 void FrameView::setMarginWidth(int w)
@@ -306,7 +306,7 @@ void FrameView::adjustViewSize()
     }
 }
 
-void FrameView::applyOverflowToViewport(RenderObject* o, ScrollBarMode& hMode, ScrollBarMode& vMode)
+void FrameView::applyOverflowToViewport(RenderObject* o, ScrollbarMode& hMode, ScrollbarMode& vMode)
 {
     // Handle the overflow:hidden/scroll case for the body/html elements.  WinIE treats
     // overflow:hidden and overflow:scroll on <body> as applying to the document's
@@ -314,13 +314,13 @@ void FrameView::applyOverflowToViewport(RenderObject* o, ScrollBarMode& hMode, S
     // use the root element.
     switch (o->style()->overflowX()) {
         case OHIDDEN:
-            hMode = ScrollBarAlwaysOff;
+            hMode = ScrollbarAlwaysOff;
             break;
         case OSCROLL:
-            hMode = ScrollBarAlwaysOn;
+            hMode = ScrollbarAlwaysOn;
             break;
         case OAUTO:
-            hMode = ScrollBarAuto;
+            hMode = ScrollbarAuto;
             break;
         default:
             // Don't set it at all.
@@ -329,13 +329,13 @@ void FrameView::applyOverflowToViewport(RenderObject* o, ScrollBarMode& hMode, S
     
      switch (o->style()->overflowY()) {
         case OHIDDEN:
-            vMode = ScrollBarAlwaysOff;
+            vMode = ScrollbarAlwaysOff;
             break;
         case OSCROLL:
-            vMode = ScrollBarAlwaysOn;
+            vMode = ScrollbarAlwaysOn;
             break;
         case OAUTO:
-            vMode = ScrollBarAuto;
+            vMode = ScrollbarAuto;
             break;
         default:
             // Don't set it at all.
@@ -419,8 +419,8 @@ void FrameView::layout(bool allowSubtree)
         return;
     }
 
-    ScrollBarMode hMode = d->hmode;
-    ScrollBarMode vMode = d->vmode;
+    ScrollbarMode hMode = d->hmode;
+    ScrollbarMode vMode = d->vmode;
     
     if (!subtree) {
         Document* document = static_cast<Document*>(rootNode);
@@ -430,8 +430,8 @@ void FrameView::layout(bool allowSubtree)
             if (body && body->renderer()) {
                 if (body->hasTagName(framesetTag)) {
                     body->renderer()->setNeedsLayout(true);
-                    vMode = ScrollBarAlwaysOff;
-                    hMode = ScrollBarAlwaysOff;
+                    vMode = ScrollbarAlwaysOff;
+                    hMode = ScrollbarAlwaysOff;
                 } else if (body->hasTagName(bodyTag)) {
                     if (!d->firstLayout && m_size.height() != visibleHeight() && static_cast<RenderBox*>(body->renderer())->stretchesToViewHeight())
                         body->renderer()->setChildNeedsLayout(true);
@@ -455,31 +455,31 @@ void FrameView::layout(bool allowSubtree)
     bool didFirstLayout = false;
     if (!subtree) {
         // Now set our scrollbar state for the layout.
-        ScrollBarMode currentHMode = hScrollBarMode();
-        ScrollBarMode currentVMode = vScrollBarMode();
+        ScrollbarMode currentHMode = hScrollbarMode();
+        ScrollbarMode currentVMode = vScrollbarMode();
 
         if (d->firstLayout || (hMode != currentHMode || vMode != currentVMode)) {
-            suppressScrollBars(true);
+            suppressScrollbars(true);
             if (d->firstLayout) {
                 d->firstLayout = false;
                 didFirstLayout = true;
                 
                 // Set the initial vMode to AlwaysOn if we're auto.
-                if (vMode == ScrollBarAuto)
-                    ScrollView::setVScrollBarMode(ScrollBarAlwaysOn); // This causes a vertical scrollbar to appear.
+                if (vMode == ScrollbarAuto)
+                    ScrollView::setVScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
                 // Set the initial hMode to AlwaysOff if we're auto.
-                if (hMode == ScrollBarAuto)
-                    ScrollView::setHScrollBarMode(ScrollBarAlwaysOff); // This causes a horizontal scrollbar to disappear.
+                if (hMode == ScrollbarAuto)
+                    ScrollView::setHScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear.
             }
             
             if (hMode == vMode)
-                ScrollView::setScrollBarsMode(hMode);
+                ScrollView::setScrollbarsMode(hMode);
             else {
-                ScrollView::setHScrollBarMode(hMode);
-                ScrollView::setVScrollBarMode(vMode);
+                ScrollView::setHScrollbarMode(hMode);
+                ScrollView::setVScrollbarMode(vMode);
             }
 
-            suppressScrollBars(false, true);
+            suppressScrollbars(false, true);
         }
 
         IntSize oldSize = m_size;
@@ -620,7 +620,7 @@ void FrameView::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
         if (mev.targetNode()->isShadowNode() && mev.targetNode()->shadowParentNode()->hasTagName(inputTag))
             mev = prepareMouseEvent(true, true, false, mouseEvent);
 
-        PlatformScrollBar* scrollbar = scrollbarUnderMouse(mouseEvent);
+        PlatformScrollbar* scrollbar = scrollbarUnderMouse(mouseEvent);
         if (!scrollbar)
             scrollbar = mev.scrollbar();
         if (!scrollbar || !passMousePressEventToScrollbar(mev, scrollbar))
@@ -676,7 +676,7 @@ static bool nodeIsNotBeingEdited(Node* node, Frame* frame)
     return frame->selectionController()->rootEditableElement() != node->rootEditableElement();
 }
 
-static Cursor selectCursor(const MouseEventWithHitTestResults& event, Frame* frame, bool mousePressed, PlatformScrollBar* scrollbar)
+static Cursor selectCursor(const MouseEventWithHitTestResults& event, Frame* frame, bool mousePressed, PlatformScrollbar* scrollbar)
 {
     // During selection, use an I-beam no matter what we're over.
     if (mousePressed && frame->hasSelection())
@@ -825,15 +825,15 @@ void FrameView::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent)
 
     bool swallowEvent = dispatchMouseEvent(mousemoveEvent, mev.targetNode(), false, 0, mouseEvent, true);
     
-    PlatformScrollBar* scrollbar = scrollbarUnderMouse(mouseEvent);
+    PlatformScrollbar* scrollbar = scrollbarUnderMouse(mouseEvent);
     if (!scrollbar)
         scrollbar = mev.scrollbar();
 
-    if (d->oldScrollBar != scrollbar) {
+    if (d->oldScrollbar != scrollbar) {
         // Send mouse exited to the old scrollbar.
-        if (d->oldScrollBar)
-            d->oldScrollBar->handleMouseOutEvent(mouseEvent);
-        d->oldScrollBar = scrollbar;
+        if (d->oldScrollbar)
+            d->oldScrollbar->handleMouseOutEvent(mouseEvent);
+        d->oldScrollbar = scrollbar;
     }
 
     if (d->m_resizeLayer && d->m_resizeLayer->inResizeMode())
@@ -1100,29 +1100,29 @@ void FrameView::removeSlowRepaintObject()
         setStaticBackground(d->useSlowRepaints);
 }
 
-void FrameView::setScrollBarsMode(ScrollBarMode mode)
+void FrameView::setScrollbarsMode(ScrollbarMode mode)
 {
     d->vmode = mode;
     d->hmode = mode;
     
-    ScrollView::setScrollBarsMode(mode);
+    ScrollView::setScrollbarsMode(mode);
 }
 
-void FrameView::setVScrollBarMode(ScrollBarMode mode)
+void FrameView::setVScrollbarMode(ScrollbarMode mode)
 {
     d->vmode = mode;
-    ScrollView::setVScrollBarMode(mode);
+    ScrollView::setVScrollbarMode(mode);
 }
 
-void FrameView::setHScrollBarMode(ScrollBarMode mode)
+void FrameView::setHScrollbarMode(ScrollbarMode mode)
 {
     d->hmode = mode;
-    ScrollView::setHScrollBarMode(mode);
+    ScrollView::setHScrollbarMode(mode);
 }
 
-void FrameView::restoreScrollBar()
+void FrameView::restoreScrollbar()
 {
-    suppressScrollBars(false);
+    suppressScrollbars(false);
 }
 
 void FrameView::setResizingFrameSet(HTMLFrameSetElement* frameSet)
@@ -1169,7 +1169,7 @@ bool FrameView::dispatchMouseEvent(const AtomicString& eventType, Node* targetNo
     if (setUnder) {
         if (d->oldUnder && d->oldUnder->document() != frame()->document()) {
             d->oldUnder = 0;
-            d->oldScrollBar = 0;
+            d->oldScrollbar = 0;
         }
 
         if (d->oldUnder != targetNode) {
@@ -1269,11 +1269,11 @@ void FrameView::handleWheelEvent(PlatformWheelEvent& e)
     }
 }
 
-void FrameView::scrollBarMoved()
+void FrameView::scrollbarMoved()
 {
     // FIXME: Need to arrange for this to be called when the view is scrolled!
     if (!d->scrollingSelf)
-        d->scrollBarMoved = true;
+        d->scrollbarMoved = true;
 }
 
 void FrameView::repaintRectangle(const IntRect& r, bool immediate)
index 20cc769..a0aaee7 100644 (file)
@@ -111,9 +111,9 @@ public:
     void setMarginWidth(int);
     void setMarginHeight(int);
 
-    virtual void setVScrollBarMode(ScrollBarMode);
-    virtual void setHScrollBarMode(ScrollBarMode);
-    virtual void setScrollBarsMode(ScrollBarMode);
+    virtual void setVScrollbarMode(ScrollbarMode);
+    virtual void setHScrollbarMode(ScrollbarMode);
+    virtual void setScrollbarsMode(ScrollbarMode);
     
     void print();
 
@@ -126,7 +126,7 @@ public:
     
     void addRepaintInfo(RenderObject*, const IntRect&);
 
-    void resetScrollBars();
+    void resetScrollbars();
 
     void clear();
 
@@ -145,7 +145,7 @@ public:
     bool passMouseMoveEventToSubframe(MouseEventWithHitTestResults&, Frame*);
     bool passMouseReleaseEventToSubframe(MouseEventWithHitTestResults&, Frame*);
     bool passWheelEventToSubframe(PlatformWheelEvent&, Frame*);
-    bool passMousePressEventToScrollbar(MouseEventWithHitTestResults&, PlatformScrollBar*);
+    bool passMousePressEventToScrollbar(MouseEventWithHitTestResults&, PlatformScrollbar*);
 
     bool mousePressed();
     void setMousePressed(bool);
@@ -178,7 +178,7 @@ public:
     void scheduleHoverStateUpdate();
 
     void adjustViewSize();
-    void initScrollBars();
+    void initScrollbars();
     
     void setHasBorder(bool);
     bool hasBorder() const;
@@ -202,7 +202,7 @@ public:
 
 private:
     void cleared();
-    void scrollBarMoved();
+    void scrollbarMoved();
 
     void resetCursor();
     void invalidateClick();
@@ -233,7 +233,7 @@ private:
 
     Node *nodeUnderMouse() const;
 
-    void restoreScrollBar();
+    void restoreScrollbar();
 
     MouseEventWithHitTestResults prepareMouseEvent(bool readonly, bool active, bool mouseMove, const PlatformMouseEvent&);
 
@@ -242,7 +242,7 @@ private:
     bool dispatchDragEvent(const AtomicString& eventType, Node* target,
         const PlatformMouseEvent&, Clipboard*);
 
-    void applyOverflowToViewport(RenderObject* o, ScrollBarMode& hMode, ScrollBarMode& vMode);
+    void applyOverflowToViewport(RenderObject* o, ScrollbarMode& hMode, ScrollbarMode& vMode);
 
     virtual bool isFrameView() const;
 
index dc6e1e2..e3f1c1a 100644 (file)
@@ -35,7 +35,7 @@ static inline Element* targetElement(Node* node)
 }
 
 MouseEventWithHitTestResults::MouseEventWithHitTestResults(const PlatformMouseEvent& event,
-        PassRefPtr<Node> node, PlatformScrollBar* scrollbar, bool isOverLink)
+        PassRefPtr<Node> node, PlatformScrollbar* scrollbar, bool isOverLink)
     : m_event(event)
     , m_targetNode(node)
     , m_targetElement(targetElement(m_targetNode.get()))
index bbfcf67..a10a943 100644 (file)
 
 namespace WebCore {
 
-class PlatformScrollBar;
+class PlatformScrollbar;
 
 class MouseEventWithHitTestResults {
 public:
-    MouseEventWithHitTestResults(const PlatformMouseEvent&, PassRefPtr<Node>, PlatformScrollBar*, bool isOverLink);
+    MouseEventWithHitTestResults(const PlatformMouseEvent&, PassRefPtr<Node>, PlatformScrollbar*, bool isOverLink);
 
     const PlatformMouseEvent& event() const { return m_event; }
     Node* targetNode() const;
-    PlatformScrollBar* scrollbar() const { return m_scrollbar; }
+    PlatformScrollbar* scrollbar() const { return m_scrollbar; }
     bool isOverLink() const { return m_isOverLink; }
 
 private:
     PlatformMouseEvent m_event;
     RefPtr<Node> m_targetNode;
     RefPtr<Element> m_targetElement;
-    PlatformScrollBar* m_scrollbar;
+    PlatformScrollbar* m_scrollbar;
     bool m_isOverLink;
 };
 
index 17a0829..fa90b06 100644 (file)
@@ -28,7 +28,7 @@
 
 namespace WebCore {
 
-ScrollBar::ScrollBar(ScrollBarClient* client, ScrollBarOrientation orientation, ScrollBarControlSize controlSize)
+Scrollbar::Scrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
     : m_client(client)
     , m_orientation(orientation)
     , m_controlSize(controlSize)
@@ -40,7 +40,7 @@ ScrollBar::ScrollBar(ScrollBarClient* client, ScrollBarOrientation orientation,
 {
 }
 
-bool ScrollBar::setValue(int v)
+bool Scrollbar::setValue(int v)
 {
     int maxPos = m_totalSize - m_visibleSize;
     if (v > maxPos)
@@ -59,7 +59,7 @@ bool ScrollBar::setValue(int v)
     return true;
 }
 
-void ScrollBar::setProportion(int visibleSize, int totalSize)
+void Scrollbar::setProportion(int visibleSize, int totalSize)
 {
     m_visibleSize = visibleSize;
     m_totalSize = totalSize;
@@ -67,16 +67,16 @@ void ScrollBar::setProportion(int visibleSize, int totalSize)
     updateThumbProportion();
 }
 
-void ScrollBar::setSteps(int lineStep, int pageStep)
+void Scrollbar::setSteps(int lineStep, int pageStep)
 {
     m_lineStep = lineStep;
     m_pageStep = pageStep;
 }
 
-bool ScrollBar::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
+bool Scrollbar::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
 {
     float delta = 0.0;
-    if ((direction == ScrollUp && m_orientation == VerticalScrollBar) || (direction == ScrollLeft && m_orientation == HorizontalScrollBar)) {
+    if ((direction == ScrollUp && m_orientation == VerticalScrollbar) || (direction == ScrollLeft && m_orientation == HorizontalScrollbar)) {
         if (granularity == ScrollByLine) {
             delta = -m_lineStep;
         } else if (granularity == ScrollByPage) {
@@ -86,7 +86,7 @@ bool ScrollBar::scroll(ScrollDirection direction, ScrollGranularity granularity,
         } else if (granularity == ScrollByWheel) {
             delta = -m_lineStep;
         }
-    } else if ((direction == ScrollDown && m_orientation == VerticalScrollBar) || (direction == ScrollRight && m_orientation == HorizontalScrollBar)) {
+    } else if ((direction == ScrollDown && m_orientation == VerticalScrollbar) || (direction == ScrollRight && m_orientation == HorizontalScrollbar)) {
         if (granularity == ScrollByLine) {
             delta = m_lineStep;
         } else if (granularity == ScrollByPage) {
index ff5e70b..9abf8e3 100644 (file)
@@ -23,8 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef ScrollBar_h
-#define ScrollBar_h
+#ifndef Scrollbar_h
+#define Scrollbar_h
 
 #include "Shared.h"
 
@@ -32,7 +32,7 @@ namespace WebCore {
 
 class GraphicsContext;
 class IntRect;
-class ScrollBar;
+class Scrollbar;
 class PlatformMouseEvent;
 
 // These match the numbers we use over in WebKit (WebFrameView.m).
@@ -53,29 +53,29 @@ enum ScrollGranularity {
     ScrollByWheel
 };
 
-enum ScrollBarOrientation { HorizontalScrollBar, VerticalScrollBar };
+enum ScrollbarOrientation { HorizontalScrollbar, VerticalScrollbar };
 
-enum ScrollBarControlSize { RegularScrollBar, SmallScrollBar, MiniScrollBar };
+enum ScrollbarControlSize { RegularScrollbar, SmallScrollbar, MiniScrollbar };
 
-class ScrollBarClient {
+class ScrollbarClient {
 public:
-    virtual ~ScrollBarClient() {}
-    virtual void valueChanged(ScrollBar*) = 0;
+    virtual ~ScrollbarClient() {}
+    virtual void valueChanged(Scrollbar*) = 0;
 };
 
-class ScrollBar : public Shared<ScrollBar> {
+class Scrollbar : public Shared<Scrollbar> {
 protected:
-    ScrollBar(ScrollBarClient*, ScrollBarOrientation, ScrollBarControlSize);
+    Scrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
 
 public:
-    virtual ~ScrollBar() {}
+    virtual ~Scrollbar() {}
 
     virtual bool isWidget() const = 0;
 
-    ScrollBarOrientation orientation() const { return m_orientation; }
+    ScrollbarOrientation orientation() const { return m_orientation; }
     int value() const { return m_currentPos; } 
     
-    ScrollBarControlSize controlSize() const { return m_controlSize; }
+    ScrollbarControlSize controlSize() const { return m_controlSize; }
 
     void setSteps(int lineStep, int pageStep);
     
@@ -90,7 +90,7 @@ public:
     virtual void setEnabled(bool) = 0;
     virtual void paint(GraphicsContext*, const IntRect& damageRect) = 0;
 
-    static bool hasPlatformScrollBars() {
+    static bool hasPlatformScrollbars() {
         // To use the platform's built-in scrollbars by default, return true.  We may
         // support styled engine scrollbars someday, and some platforms may wish to not
         // implement a platform scrollbar at all by default.  That's what this method is for.
@@ -107,11 +107,11 @@ protected:
     virtual void updateThumbPosition() = 0;
     virtual void updateThumbProportion() = 0;
 
-    ScrollBarClient* client() const { return m_client; }
+    ScrollbarClient* client() const { return m_client; }
 
-    ScrollBarClient* m_client;
-    ScrollBarOrientation m_orientation;
-    ScrollBarControlSize m_controlSize;
+    ScrollbarClient* m_client;
+    ScrollbarOrientation m_orientation;
+    ScrollbarControlSize m_controlSize;
     int m_visibleSize;
     int m_totalSize;
     int m_currentPos;
index da4d52b..16c5210 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef ScrollBarMode_h
-#define ScrollBarMode_h
+#ifndef ScrollbarMode_h
+#define ScrollbarMode_h
 
 namespace WebCore {
 
-    enum ScrollBarMode { ScrollBarAuto, ScrollBarAlwaysOff, ScrollBarAlwaysOn };
+    enum ScrollbarMode { ScrollbarAuto, ScrollbarAlwaysOff, ScrollbarAlwaysOn };
 
 }
 
index 9f18dc0..5859355 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef ScrollView_H
 #define ScrollView_H
 
-#include "ScrollBarMode.h"
+#include "ScrollbarMode.h"
 #include "ScrollBar.h"
 #include "Widget.h"
 #include <wtf/Platform.h>
@@ -38,7 +38,7 @@ class QScrollArea;
 namespace WebCore {
     class FloatRect;
     class PlatformWheelEvent;
-    class PlatformScrollBar;
+    class PlatformScrollbar;
 
     class ScrollView : public Widget {
     public:
@@ -55,17 +55,17 @@ namespace WebCore {
 
         virtual void setContentsPos(int x, int y);
 
-        virtual void setVScrollBarMode(ScrollBarMode);
-        virtual void setHScrollBarMode(ScrollBarMode);
+        virtual void setVScrollbarMode(ScrollbarMode);
+        virtual void setHScrollbarMode(ScrollbarMode);
 
-        // Set the mode for both scroll bars at once.
-        virtual void setScrollBarsMode(ScrollBarMode);
+        // Set the mode for both scrollbars at once.
+        virtual void setScrollbarsMode(ScrollbarMode);
 
         // This gives us a means of blocking painting on our scrollbars until the first layout has occurred.
-        void suppressScrollBars(bool suppressed, bool repaintOnUnsuppress = false);
+        void suppressScrollbars(bool suppressed, bool repaintOnUnsuppress = false);
         
-        ScrollBarMode vScrollBarMode() const;
-        ScrollBarMode hScrollBarMode() const;
+        ScrollbarMode vScrollbarMode() const;
+        ScrollbarMode hScrollbarMode() const;
 
         void addChild(Widget*, int x = 0, int y = 0);
         void removeChild(Widget*);
@@ -84,7 +84,7 @@ namespace WebCore {
         bool inWindow() const;
 
         // For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
-        PlatformScrollBar* scrollbarUnderMouse(const PlatformMouseEvent& mouseEvent);
+        PlatformScrollbar* scrollbarUnderMouse(const PlatformMouseEvent& mouseEvent);
 
         // This method exists for scrollviews that need to handle wheel events manually.
         // On Mac the underlying NSScrollView just does the scrolling, but on other platforms
@@ -110,7 +110,7 @@ namespace WebCore {
         virtual void scrolled() const;
 
     private:
-        void updateScrollBars(const IntSize& desiredOffset);
+        void updateScrollbars(const IntSize& desiredOffset);
         IntSize maximumScroll() const;
         class ScrollViewPrivate;
         ScrollViewPrivate* m_data;
@@ -123,7 +123,7 @@ namespace WebCore {
         ScrollView();
         ~ScrollView();
     private:
-        void updateScrollBars();
+        void updateScrollbars();
         IntSize maximumScroll() const;
         int updateScrollInfo(short type, int current, int max, int pageSize);
         class ScrollViewPrivate;
index 9224653..9ada1ac 100644 (file)
@@ -2508,7 +2508,7 @@ bool RenderBlock::isPointInScrollbar(NodeInfo& info, int _x, int _y, int _tx, in
                         width() - borderLeft() - borderRight() - m_layer->verticalScrollbarWidth(),
                         m_layer->horizontalScrollbarHeight());
         if (horizRect.contains(_x, _y)) {
-            info.setScrollbar(m_layer->horizontalScrollbarWidget());
+            info.setScrollbar(m_layer->horizontaScrollbarWidget());
             return true;
         }
     }
index 1361cb0..3296a09 100644 (file)
@@ -126,8 +126,6 @@ m_scrollOriginX(0),
 m_scrollLeftOverflow(0),
 m_scrollWidth(0),
 m_scrollHeight(0),
-m_hBar(0),
-m_vBar(0),
 m_inResizeMode(false),
 m_resizeCornerImage(0),
 m_posZOrderList(0),
@@ -148,10 +146,12 @@ m_marquee(0)
 
 RenderLayer::~RenderLayer()
 {
+    destroyScrollbar(HorizontalScrollbar);
+    destroyScrollbar(VerticalScrollbar);
+
     // Child layers will be deleted by their corresponding render objects, so
-    // our destructor doesn't have to do anything.
-    delete m_hBar;
-    delete m_vBar;
+    // we don't need to delete them ourselves.
+
     delete m_resizeCornerImage;
     delete m_posZOrderList;
     delete m_negZOrderList;
@@ -603,7 +603,7 @@ void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repai
     
     RenderView* view = renderer()->view();
     if (view) {
-#if __APPLE__
+#if PLATFORM(MAC)
         // Update dashboard regions, scrolling may change the clip of a
         // particular region.
         view->frameView()->updateDashboardRegions();
@@ -847,23 +847,23 @@ void RenderLayer::resize(const PlatformMouseEvent& evt, const IntSize& offsetFro
     }
 }
 
-PlatformScrollBar* RenderLayer::horizontalScrollbarWidget() const
+PlatformScrollbar* RenderLayer::horizontaScrollbarWidget() const
 {
     if (m_hBar && m_hBar->isWidget())
-        return static_cast<PlatformScrollBar*>(m_hBar);
+        return static_cast<PlatformScrollbar*>(m_hBar.get());
     return 0;
 }
 
-PlatformScrollBar* RenderLayer::verticalScrollbarWidget() const
+PlatformScrollbar* RenderLayer::verticalScrollbarWidget() const
 {
     if (m_vBar && m_vBar->isWidget())
-        return static_cast<PlatformScrollBar*>(m_vBar);
+        return static_cast<PlatformScrollbar*>(m_vBar.get());
     return 0;
 }
 
-void RenderLayer::valueChanged(ScrollBar*)
+void RenderLayer::valueChanged(Scrollbar*)
 {
-    // Update scroll position from scroll bars.
+    // Update scroll position from scrollbars.
 
     bool needUpdate = false;
     int newX = scrollXOffset();
@@ -885,37 +885,32 @@ void RenderLayer::valueChanged(ScrollBar*)
         scrollToOffset(newX, newY, false);
 }
 
-ScrollBar* RenderLayer::createScrollbar(ScrollBarOrientation orientation)
+PassRefPtr<Scrollbar> RenderLayer::createScrollbar(ScrollbarOrientation orientation)
 {
-    if (ScrollBar::hasPlatformScrollBars()) {
-        PlatformScrollBar* widget = new PlatformScrollBar(this, orientation, RegularScrollBar);
-        widget->ref();
-        m_object->element()->document()->view()->addChild(widget);
-        return widget;
+    if (Scrollbar::hasPlatformScrollbars()) {
+        RefPtr<PlatformScrollbar> widget = new PlatformScrollbar(this, orientation, RegularScrollbar);
+        m_object->element()->document()->view()->addChild(widget.get());
+        return widget.release();
     }
     
     // FIXME: Create scrollbars using the engine.
     return 0;
 }
 
-void RenderLayer::destroyScrollbar(ScrollBarOrientation orientation)
+void RenderLayer::destroyScrollbar(ScrollbarOrientation orientation)
 {
-    if (orientation == HorizontalScrollBar) {
-        if (m_hBar->isWidget()) {
-            m_object->element()->document()->view()->removeChild(horizontalScrollbarWidget());
-            m_hBar->deref();
-            m_hBar = 0;
-        }
-        
-        // FIXME: Destroy the engine scrollbar.
-    } else {
-        if (m_vBar->isWidget()) {
-            m_object->element()->document()->view()->removeChild(verticalScrollbarWidget());
-            m_vBar->deref();
-            m_vBar = 0;
+    RefPtr<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar : m_vBar;
+
+    if (scrollbar) {
+        if (scrollbar->isWidget()) {
+            PlatformScrollbar* scrollbarWidget = static_cast<PlatformScrollbar*>(scrollbar.get());
+            if (scrollbarWidget->parent()->isFrameView())
+                static_cast<FrameView*>(scrollbarWidget->parent())->removeChild(scrollbarWidget);
+            scrollbarWidget->setParent(0);
         }
-        
         // FIXME: Destroy the engine scrollbar.
+
+        scrollbar = 0;
     }
 }
 
@@ -925,11 +920,11 @@ void RenderLayer::setHasHorizontalScrollbar(bool hasScrollbar)
         return;
 
     if (hasScrollbar)
-        m_hBar = createScrollbar(HorizontalScrollBar);
+        m_hBar = createScrollbar(HorizontalScrollbar);
     else
-        destroyScrollbar(HorizontalScrollBar);
+        destroyScrollbar(HorizontalScrollbar);
 
-#if __APPLE__
+#if PLATFORM(MAC)
     // Force an update since we know the scrollbars have changed things.
     if (m_object->document()->hasDashboardRegions())
         m_object->document()->setDashboardRegionsDirty(true);
@@ -942,12 +937,12 @@ void RenderLayer::setHasVerticalScrollbar(bool hasScrollbar)
     if (hasScrollbar == (m_vBar != 0))
         return;
 
-    if (hasScrollbar) {
-        m_vBar = createScrollbar(VerticalScrollBar);
-    else
-        destroyScrollbar(VerticalScrollBar);
+    if (hasScrollbar)
+        m_vBar = createScrollbar(VerticalScrollbar);
+    else
+        destroyScrollbar(VerticalScrollbar);
 
-#if __APPLE__
+#if PLATFORM(MAC)
     // Force an update since we know the scrollbars have changed things.
     if (m_object->document()->hasDashboardRegions())
         m_object->document()->setDashboardRegionsDirty(true);
@@ -955,21 +950,17 @@ void RenderLayer::setHasVerticalScrollbar(bool hasScrollbar)
 
 }
 
-int
-RenderLayer::verticalScrollbarWidth()
+int RenderLayer::verticalScrollbarWidth() const
 {
     if (!m_vBar)
         return 0;
-
     return m_vBar->width();
 }
 
-int
-RenderLayer::horizontalScrollbarHeight()
+int RenderLayer::horizontalScrollbarHeight() const
 {
     if (!m_hBar)
         return 0;
-
     return m_hBar->height();
 }
 
@@ -1126,7 +1117,7 @@ RenderLayer::updateScrollInfoAfterLayout()
         if (m_object->hasAutoVerticalScrollbar())
             setHasVerticalScrollbar(verticalOverflow);
 
-#if __APPLE__
+#if PLATFORM(MAC)
         // Force an update since we know the scrollbars have changed things.
         if (m_object->document()->hasDashboardRegions())
             m_object->document()->setDashboardRegionsDirty(true);
index 1a9a8f7..3916925 100644 (file)
@@ -57,11 +57,9 @@ class RenderObject;
 class RenderStyle;
 class RenderTable;
 class RenderText;
-class ScrollBar;
-class PlatformScrollBar;
+class PlatformScrollbar;
 
-class ClipRects
-{
+class ClipRects {
 public:
     ClipRects(const IntRect& r) :m_overflowClipRect(r), m_fixedClipRect(r), m_posClipRect(r), m_refCnt(0) {}
     ClipRects(const IntRect& o, const IntRect& f, const IntRect& p)
@@ -140,7 +138,7 @@ private:
     EMarqueeDirection m_direction : 4;
 };
 
-class RenderLayer : public ScrollBarClient {
+class RenderLayer : public ScrollbarClient {
 public:
     enum ScrollBehavior {
         noScroll,
@@ -230,16 +228,16 @@ public:
     void scrollToYOffset(int y) { scrollToOffset(m_scrollX + m_scrollOriginX, y); }
     void scrollRectToVisible(const IntRect &r, const ScrollAlignment& alignX = gAlignCenterIfNeeded, const ScrollAlignment& alignY = gAlignCenterIfNeeded);
     IntRect getRectToExpose(const IntRect &visibleRect,  const IntRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY);    
-    void setHasHorizontalScrollbar(bool hasScrollbar);
-    void setHasVerticalScrollbar(bool hasScrollbar);
-    ScrollBar* createScrollbar(ScrollBarOrientation orientation);
-    void destroyScrollbar(ScrollBarOrientation orientation);
-    ScrollBar* horizontalScrollbar() { return m_hBar; }
-    ScrollBar* verticalScrollbar() { return m_vBar; }
-    PlatformScrollBar* horizontalScrollbarWidget() const;
-    PlatformScrollBar* verticalScrollbarWidget() const;
-    int verticalScrollbarWidth();
-    int horizontalScrollbarHeight();
+    void setHasHorizontalScrollbar(bool);
+    void setHasVerticalScrollbar(bool);
+    PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
+    void destroyScrollbar(ScrollbarOrientation);
+    Scrollbar* horizontalScrollbar() { return m_hBar.get(); }
+    Scrollbar* verticalScrollbar() { return m_vBar.get(); }
+    PlatformScrollbar* horizontaScrollbarWidget() const;
+    PlatformScrollbar* verticalScrollbarWidget() const;
+    int verticalScrollbarWidth() const;
+    int horizontalScrollbarHeight() const;
     void positionScrollbars(const IntRect& absBounds);
     void positionResizeControl();
     bool isPointInResizeControl(const IntPoint&);
@@ -341,7 +339,7 @@ private:
 
     bool shouldBeOverflowOnly() const;
 
-    virtual void valueChanged(ScrollBar*);
+    virtual void valueChanged(Scrollbar*);
 
     void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
 protected:   
@@ -382,8 +380,8 @@ protected:
     int m_scrollHeight;
     
     // For layers with overflow, we have a pair of scrollbars.
-    ScrollBar* m_hBar;
-    ScrollBar* m_vBar;
+    RefPtr<Scrollbar> m_hBar;
+    RefPtr<Scrollbar> m_vBar;
     
     // The rectangle for the control to resize layers that have overflow.
     IntRect m_resizeControlRect;
index 89631b4..626dd48 100644 (file)
@@ -62,7 +62,7 @@ RenderListBox::RenderListBox(HTMLSelectElement* element)
 RenderListBox::~RenderListBox()
 {
     if (m_vBar && m_vBar->isWidget()) {
-        element()->document()->view()->removeChild(static_cast<PlatformScrollBar*>(m_vBar));
+        element()->document()->view()->removeChild(static_cast<PlatformScrollbar*>(m_vBar));
         m_vBar->deref();
     }
 }
@@ -109,8 +109,8 @@ void RenderListBox::updateFromElement()
 void RenderListBox::calcMinMaxWidth()
 {
     if (!m_vBar) {
-        if (ScrollBar::hasPlatformScrollBars()) {
-            PlatformScrollBar* widget = new PlatformScrollBar(this, VerticalScrollBar, SmallScrollBar);
+        if (Scrollbar::hasPlatformScrollbars()) {
+            PlatformScrollbar* widget = new PlatformScrollbar(this, VerticalScrollbar, SmallScrollbar);
             widget->ref();
             node()->document()->view()->addChild(widget);
             m_vBar = widget;
@@ -334,7 +334,7 @@ bool RenderListBox::isPointInScrollbar(NodeInfo& info, int _x, int _y, int _tx,
                    height() + borderTopExtra() + borderBottomExtra() - borderTop() - borderBottom());
 
     if (vertRect.contains(_x, _y)) {
-        info.setScrollbar(m_vBar->isWidget() ? static_cast<PlatformScrollBar*>(m_vBar) : 0);
+        info.setScrollbar(m_vBar->isWidget() ? static_cast<PlatformScrollbar*>(m_vBar) : 0);
         return true;
     }
     return false;
@@ -347,8 +347,8 @@ HTMLOptionElement* RenderListBox::optionAtPoint(int x, int y)
     int yOffset = y - absoluteBoundingBoxRect().y();
     int newOffset = max(0, yOffset / (style()->font().height() + optionsSpacingMiddle)) + m_indexOffset;
     newOffset = max(0, min((int)listItems.size() - 1, newOffset));
-    int scrollBarWidth = m_vBar ? m_vBar->width() : 0;
-    if (x >= absoluteBoundingBoxRect().x() + borderLeft() + paddingLeft() && x < absoluteBoundingBoxRect().right() - borderRight() - paddingRight() - scrollBarWidth)
+    int scrollbarWidth = m_vBar ? m_vBar->width() : 0;
+    if (x >= absoluteBoundingBoxRect().x() + borderLeft() + paddingLeft() && x < absoluteBoundingBoxRect().right() - borderRight() - paddingRight() - scrollbarWidth)
         return static_cast<HTMLOptionElement*>(listItems[newOffset]);
     return 0;
 }
@@ -412,7 +412,7 @@ void RenderListBox::valueChanged(unsigned listIndex)
     select->onChange();
 }
 
-void RenderListBox::valueChanged(ScrollBar*)
+void RenderListBox::valueChanged(Scrollbar*)
 {
     if (m_vBar) {
         int newOffset = max(0, m_vBar->value() / (style()->font().height() + optionsSpacingMiddle));
index 4d840b0..06668d6 100644 (file)
@@ -30,7 +30,7 @@ namespace WebCore {
 class HTMLSelectElement;
 class HTMLOptionElement;
 
-class RenderListBox : public RenderBlock, public ScrollBarClient {
+class RenderListBox : public RenderBlock, public ScrollbarClient {
 public:
     RenderListBox(HTMLSelectElement*);
     ~RenderListBox();
@@ -53,7 +53,7 @@ public:
     virtual void calcHeight();
     void setOptionsChanged(bool c) { m_optionsChanged = c; }
     void valueChanged(unsigned listIndex);
-    virtual void valueChanged(ScrollBar*);
+    virtual void valueChanged(Scrollbar*);
     
     HTMLOptionElement* optionAtPoint(int x, int y);
     
@@ -77,7 +77,7 @@ private:
     void paintItemForeground(PaintInfo&, int tx, int ty, int listIndex);
     void paintItemBackground(PaintInfo&, int tx, int ty, int listIndex);
     
-    ScrollBar* m_vBar;
+    Scrollbar* m_vBar;
 };
 
 }
index 62d3519..c6814c2 100644 (file)
@@ -57,7 +57,7 @@ class FrameView;
 class HTMLAreaElement;
 class InlineBox;
 class InlineFlowBox;
-class PlatformScrollBar;
+class PlatformScrollbar;
 class Position;
 class RenderArena;
 class RenderBlock;
@@ -500,7 +500,7 @@ public:
         Node* innerNode() const { return m_innerNode; }
         Node* innerNonSharedNode() const { return m_innerNonSharedNode; }
         Element* URLElement() const { return m_innerURLElement; }
-        PlatformScrollBar* scrollbar() const { return m_scrollbar; }
+        PlatformScrollbar* scrollbar() const { return m_scrollbar; }
         bool readonly() const { return m_readonly; }
         bool active() const { return m_active; }
         bool mouseMove() const { return m_mouseMove; }
@@ -508,13 +508,13 @@ public:
         void setInnerNode(Node* n) { m_innerNode = n; }
         void setInnerNonSharedNode(Node* n) { m_innerNonSharedNode = n; }
         void setURLElement(Element* n) { m_innerURLElement = n; }
-        void setScrollbar(PlatformScrollBar* s) { m_scrollbar = s; }
+        void setScrollbar(PlatformScrollbar* s) { m_scrollbar = s; }
 
     private:
         Node* m_innerNode;
         Node* m_innerNonSharedNode;
         Element* m_innerURLElement;
-        PlatformScrollBar* m_scrollbar;
+        PlatformScrollbar* m_scrollbar;
         bool m_readonly;
         bool m_active;
         bool m_mouseMove;