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
+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.
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;
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.
windowArgs.statusBarVisible = true;
windowArgs.toolBarVisible = true;
windowArgs.locationBarVisible = true;
- windowArgs.scrollBarsVisible = true;
+ windowArgs.scrollbarsVisible = true;
windowArgs.resizable = true;
return;
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.
bool statusBarVisible;
bool toolBarVisible;
bool locationBarVisible;
- bool scrollBarsVisible;
+ bool scrollbarsVisible;
bool resizable;
bool fullscreen;
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);
m_frameBorderSet = false;
m_marginWidth = -1;
m_marginHeight = -1;
- m_scrolling = ScrollBarAuto;
+ m_scrolling = ScrollbarAuto;
m_noResize = false;
m_viewSource = false;
}
} 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();
#define HTMLFrameElement_H
#include "HTMLElement.h"
-#include "ScrollBarMode.h"
+#include "ScrollbarMode.h"
namespace WebCore {
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; }
int m_marginWidth;
int m_marginHeight;
- ScrollBarMode m_scrolling;
+ ScrollbarMode m_scrolling;
bool m_frameBorder : 1;
bool m_frameBorderSet : 1;
// 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();
}
if (!view())
return false;
- if (view()->hScrollBarMode() == ScrollBarAlwaysOff || view()->vScrollBarMode() == ScrollBarAlwaysOff)
+ if (view()->hScrollbarMode() == ScrollbarAlwaysOff || view()->vScrollbarMode() == ScrollbarAlwaysOff)
return false;
return true;
repaintRects = 0;
isTransparent = false;
baseBackgroundColor = Color::white;
- vmode = hmode = ScrollBarAuto;
- needToInitScrollBars = true;
+ vmode = hmode = ScrollbarAuto;
+ needToInitScrollbars = true;
reset();
}
~FrameViewPrivate()
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;
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;
int layoutCount;
bool firstLayout;
- bool needToInitScrollBars;
+ bool needToInitScrollbars;
bool mousePressed;
bool isTransparent;
Color baseBackgroundColor;
FrameView::~FrameView()
{
- resetScrollBars();
+ resetScrollbars();
ASSERT(m_refCount == 0);
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()
cleared();
- suppressScrollBars(true);
+ suppressScrollbars(true);
}
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)
}
}
-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
// 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.
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.
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);
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);
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;
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))
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())
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())
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)
if (setUnder) {
if (d->oldUnder && d->oldUnder->document() != frame()->document()) {
d->oldUnder = 0;
- d->oldScrollBar = 0;
+ d->oldScrollbar = 0;
}
if (d->oldUnder != targetNode) {
}
}
-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)
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();
void addRepaintInfo(RenderObject*, const IntRect&);
- void resetScrollBars();
+ void resetScrollbars();
void clear();
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);
void scheduleHoverStateUpdate();
void adjustViewSize();
- void initScrollBars();
+ void initScrollbars();
void setHasBorder(bool);
bool hasBorder() const;
private:
void cleared();
- void scrollBarMoved();
+ void scrollbarMoved();
void resetCursor();
void invalidateClick();
Node *nodeUnderMouse() const;
- void restoreScrollBar();
+ void restoreScrollbar();
MouseEventWithHitTestResults prepareMouseEvent(bool readonly, bool active, bool mouseMove, const PlatformMouseEvent&);
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;
}
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()))
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;
};
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)
{
}
-bool ScrollBar::setValue(int v)
+bool Scrollbar::setValue(int v)
{
int maxPos = m_totalSize - m_visibleSize;
if (v > maxPos)
return true;
}
-void ScrollBar::setProportion(int visibleSize, int totalSize)
+void Scrollbar::setProportion(int visibleSize, int totalSize)
{
m_visibleSize = visibleSize;
m_totalSize = 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) {
} 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) {
* 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"
class GraphicsContext;
class IntRect;
-class ScrollBar;
+class Scrollbar;
class PlatformMouseEvent;
// These match the numbers we use over in WebKit (WebFrameView.m).
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);
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.
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;
* 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 };
}
#ifndef ScrollView_H
#define ScrollView_H
-#include "ScrollBarMode.h"
+#include "ScrollbarMode.h"
#include "ScrollBar.h"
#include "Widget.h"
#include <wtf/Platform.h>
namespace WebCore {
class FloatRect;
class PlatformWheelEvent;
- class PlatformScrollBar;
+ class PlatformScrollbar;
class ScrollView : public Widget {
public:
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*);
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
virtual void scrolled() const;
private:
- void updateScrollBars(const IntSize& desiredOffset);
+ void updateScrollbars(const IntSize& desiredOffset);
IntSize maximumScroll() const;
class ScrollViewPrivate;
ScrollViewPrivate* m_data;
ScrollView();
~ScrollView();
private:
- void updateScrollBars();
+ void updateScrollbars();
IntSize maximumScroll() const;
int updateScrollInfo(short type, int current, int max, int pageSize);
class ScrollViewPrivate;
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;
}
}
m_scrollLeftOverflow(0),
m_scrollWidth(0),
m_scrollHeight(0),
-m_hBar(0),
-m_vBar(0),
m_inResizeMode(false),
m_resizeCornerImage(0),
m_posZOrderList(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;
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();
}
}
-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();
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;
}
}
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);
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);
}
-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();
}
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);
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)
EMarqueeDirection m_direction : 4;
};
-class RenderLayer : public ScrollBarClient {
+class RenderLayer : public ScrollbarClient {
public:
enum ScrollBehavior {
noScroll,
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&);
bool shouldBeOverflowOnly() const;
- virtual void valueChanged(ScrollBar*);
+ virtual void valueChanged(Scrollbar*);
void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
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;
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();
}
}
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;
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;
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;
}
select->onChange();
}
-void RenderListBox::valueChanged(ScrollBar*)
+void RenderListBox::valueChanged(Scrollbar*)
{
if (m_vBar) {
int newOffset = max(0, m_vBar->value() / (style()->font().height() + optionsSpacingMiddle));
class HTMLSelectElement;
class HTMLOptionElement;
-class RenderListBox : public RenderBlock, public ScrollBarClient {
+class RenderListBox : public RenderBlock, public ScrollbarClient {
public:
RenderListBox(HTMLSelectElement*);
~RenderListBox();
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);
void paintItemForeground(PaintInfo&, int tx, int ty, int listIndex);
void paintItemBackground(PaintInfo&, int tx, int ty, int listIndex);
- ScrollBar* m_vBar;
+ Scrollbar* m_vBar;
};
}
class HTMLAreaElement;
class InlineBox;
class InlineFlowBox;
-class PlatformScrollBar;
+class PlatformScrollbar;
class Position;
class RenderArena;
class RenderBlock;
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; }
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;