Commit d6df5850 authored by hyatt's avatar hyatt
Browse files

Fix for bug 9222, cursor is wrong when mousing over overflow...

        Fix for bug 9222, cursor is wrong when mousing over overflow scrollbars in textareas.  Make sure
        selectCursor checks for whether or not a scrollbar was hit.  Also stub out a mouseMoved method for
        scrollbars to provide hover feedback if needed.

        Reviewed by Eric

        * page/FrameView.cpp:
        (WebCore::selectCursor):
        (WebCore::FrameView::handleMouseMoveEvent):
        * platform/ScrollBar.h:
        (WebCore::ScrollBar::mouseMoved):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16611 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c9fc627a
2006-09-27 David Hyatt <hyatt@apple.com>
Fix for bug 9222, cursor is wrong when mousing over overflow scrollbars in textareas. Make sure
selectCursor checks for whether or not a scrollbar was hit. Also stub out a mouseMoved method for
scrollbars to provide hover feedback if needed.
Reviewed by Eric
* page/FrameView.cpp:
(WebCore::selectCursor):
(WebCore::FrameView::handleMouseMoveEvent):
* platform/ScrollBar.h:
(WebCore::ScrollBar::mouseMoved):
2006-09-27 MorganL <morganl.webkit@yahoo.com>
 
Reviewed by Maciej and Adam, landed by Adam
......@@ -40,6 +40,7 @@
#include "MouseEventWithHitTestResults.h"
#include "OverflowEvent.h"
#include "PlatformKeyboardEvent.h"
#include "PlatformScrollBar.h"
#include "PlatformWheelEvent.h"
#include "RenderArena.h"
#include "RenderPart.h"
......@@ -98,6 +99,7 @@ public:
underMouse = 0;
oldUnder = 0;
oldSubframe = 0;
oldScrollBar = 0;
linkPressed = false;
useSlowRepaints = false;
slowRepaintObjectCount = 0;
......@@ -128,6 +130,7 @@ public:
RefPtr<Node> underMouse;
RefPtr<Node> oldUnder;
RefPtr<Frame> oldSubframe;
RefPtr<PlatformScrollBar> oldScrollBar;
bool borderTouched : 1;
bool borderStart : 1;
......@@ -690,7 +693,7 @@ static Cursor selectCursor(const MouseEventWithHitTestResults& event, Frame* fra
bool inResizer = false;
if (frame->view() && layer && layer->isPointInResizeControl(frame->view()->viewportToContents(event.event().pos())))
inResizer = true;
if ((editable || (renderer && renderer->isText() && renderer->canSelect())) && !inResizer)
if ((editable || (renderer && renderer->isText() && renderer->canSelect())) && !inResizer && !RenderLayer::gScrollBar)
return iBeamCursor();
// FIXME: If the point is in a layer's overflow scrollbars, we should use the pointer cursor
return pointerCursor();
......@@ -783,9 +786,12 @@ void FrameView::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent)
if (newSubframe && d->oldSubframe != newSubframe)
m_frame->passSubframeEventToSubframe(mev, newSubframe.get());
else
else {
if (RenderLayer::gScrollBar && !d->mousePressed)
RenderLayer::gScrollBar->mouseMoved(mouseEvent); // Handle hover effects on platforms that support visual feedback on scrollbar hovering.
setCursor(selectCursor(mev, m_frame.get(), d->mousePressed));
}
d->oldSubframe = newSubframe;
}
......@@ -1148,8 +1154,10 @@ bool FrameView::dispatchMouseEvent(const AtomicString& eventType, Node* targetNo
// mouseout/mouseover
if (setUnder) {
if (d->oldUnder && d->oldUnder->document() != frame()->document())
if (d->oldUnder && d->oldUnder->document() != frame()->document()) {
d->oldUnder = 0;
d->oldScrollBar = 0;
}
if (d->oldUnder != targetNode) {
// send mouseout event to the old node
......@@ -1160,6 +1168,13 @@ bool FrameView::dispatchMouseEvent(const AtomicString& eventType, Node* targetNo
EventTargetNodeCast(targetNode)->dispatchMouseEvent(mouseEvent, mouseoverEvent, 0, d->oldUnder.get());
}
d->oldUnder = targetNode;
if (d->oldScrollBar != RenderLayer::gScrollBar) {
// Send mouse exited to the old scrollbar.
if (d->oldScrollBar)
d->oldScrollBar->mouseExited();
d->oldScrollBar = RenderLayer::gScrollBar;
}
}
bool swallowEvent = false;
......
......@@ -26,11 +26,14 @@
#ifndef ScrollBar_h
#define ScrollBar_h
#include "Shared.h"
namespace WebCore {
class GraphicsContext;
class IntRect;
class ScrollBar;
class PlatformMouseEvent;
// These match the numbers we use over in WebKit (WebFrameView.m).
#define LINE_STEP 40
......@@ -58,7 +61,7 @@ public:
virtual void valueChanged(ScrollBar*) = 0;
};
class ScrollBar {
class ScrollBar : public Shared<ScrollBar> {
protected:
ScrollBar(ScrollBarClient*, ScrollBarOrientation);
......@@ -90,6 +93,12 @@ public:
return true;
}
// These methods are used for platform scrollbars to give :hover feedback. They will not get called
// when the mouse went down in a scrollbar, since it is assumed the scrollbar will start
// grabbing all events in that case anyway.
virtual void mouseMoved(const PlatformMouseEvent&) {};
virtual void mouseExited() {};
protected:
virtual void updateThumbPosition() = 0;
virtual void updateThumbProportion() = 0;
......
......@@ -898,6 +898,7 @@ ScrollBar* RenderLayer::createScrollbar(ScrollBarOrientation orientation)
{
if (ScrollBar::hasPlatformScrollBars()) {
PlatformScrollBar* widget = new PlatformScrollBar(this, orientation);
widget->ref();
m_object->element()->document()->view()->addChild(widget);
return widget;
}
......@@ -911,7 +912,7 @@ void RenderLayer::destroyScrollbar(ScrollBarOrientation orientation)
if (orientation == HorizontalScrollBar) {
if (m_hBar->isWidget()) {
m_object->element()->document()->view()->removeChild(horizontalScrollbarWidget());
delete m_hBar;
m_hBar->deref();
m_hBar = 0;
}
......@@ -919,7 +920,7 @@ void RenderLayer::destroyScrollbar(ScrollBarOrientation orientation)
} else {
if (m_vBar->isWidget()) {
m_object->element()->document()->view()->removeChild(verticalScrollbarWidget());
delete m_vBar;
m_vBar->deref();
m_vBar = 0;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment