Reviewed by Beth.
- Fix for <rdar://problem/
4707489> After timers fix, crash below RenderLayer::autoscroll after moving/destroying active <input type=text>
and <rdar://problem/
4707519> After timers fix, crash below RenderLayer::autoscroll after moving/destroying active textarea
Moved autoscroll code to the Frame class
* bridge/mac/FrameMac.h: Moved _mouseDownMayStartDrag and _mouseDownMayStartAutoscroll flags to the frame.
* bridge/mac/FrameMac.mm: Use new getters and setters for drag and autoscroll flags. Moved autoscroll code to Frame::handleMouseMoveEvent.
(WebCore::FrameMac::FrameMac):
(WebCore::FrameMac::handleMousePressEvent):
(WebCore::FrameMac::eventMayStartDrag):
(WebCore::FrameMac::handleMouseMoveEvent):
(WebCore::FrameMac::mouseDown):
* bridge/mac/WebCoreFrameBridge.h: Removed handleAutoscrollForMouseDragged, which called over the bridge for AppKit to do autoscroll for us.
Now we scroll our views in WebCore.
* page/Frame.cpp:
(WebCore::Frame::handleMousePressEvent): Initialize the mouseDownMayStartAutoscroll flag.
(WebCore::Frame::handleMouseMoveEvent): Now kicks off autoscroll if appropriate. Moved from FrameMac.
(WebCore::Frame::updateSelectionForMouseDragOverPosition): Factored code out from handleMouseMoveEvent so we can update the selection from autoscroll too.
(WebCore::Frame::mouseDownMayStartAutoscroll): Added.
(WebCore::Frame::setMouseDownMayStartAutoscroll): Added.
(WebCore::Frame::mouseDownMayStartDrag): Added.
(WebCore::Frame::setMouseDownMayStartDrag): Added.
(WebCore::Frame::autoscrollRenderer): Added
(WebCore::Frame::setAutoscrollRenderer): Added.
(WebCore::Frame::handleAutoscroll): Updated to use autoscrollRenderer getter and setter.
(WebCore::Frame::autoscrollTimerFired): ditto.
(WebCore::Frame::stopAutoscrollTimer): ditto.
* page/Frame.h: Made autoscrollRenderer and stopAutoscrollTimer public, so the renderer being autoscrolled can kill the timer when it dies.
* page/FramePrivate.h:
(WebCore::FramePrivate::FramePrivate): Added mouseDownMayStartDrag and mouseDownMayStartAutoscroll flags. Moved from FrameMac.
* page/FrameView.cpp: Store the current mouse position in window coordinates. The callers can convert to their own coordinate space.
(WebCore::FrameView::handleMousePressEvent):
(WebCore::FrameView::handleMouseDoubleClickEvent):
(WebCore::FrameView::handleMouseMoveEvent):
(WebCore::FrameView::handleMouseReleaseEvent):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::autoscroll): Rewrote this to scroll recursively, and to scroll based on the mouse position (not the selection).
We also need to update the selection here, since autoscroll can occur without a mouseMove event, and the selection needs to get reset as we scroll.
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::autoscroll): Convert the mouse coordinates to the right space.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::shouldAutoscroll): Also return true if the renderer is a root (so we know to autoscroll views too)
(WebCore::RenderObject::destroy): If this renderer is being autoscrolled, stop the frame's autoscroll timer.
WebKit:
Reviewed by Beth.
Removed handleAutoscrollForMouseDragged. Except for autoscroll caused by drag and drop, all other
autoscrolling should be done in WebCore instead of in AppKit.
* WebCoreSupport/WebFrameBridge.m:
* WebView/WebHTMLView.m:
* WebView/WebHTMLViewPrivate.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16975
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-10-10 Adele Peterson <adele@apple.com>
+
+ Reviewed by Beth.
+
+
+ - Fix for <rdar://problem/4707489> After timers fix, crash below RenderLayer::autoscroll after moving/destroying active <input type=text>
+ and <rdar://problem/4707519> After timers fix, crash below RenderLayer::autoscroll after moving/destroying active textarea
+
+ Moved autoscroll code to the Frame class
+
+ * bridge/mac/FrameMac.h: Moved _mouseDownMayStartDrag and _mouseDownMayStartAutoscroll flags to the frame.
+ * bridge/mac/FrameMac.mm: Use new getters and setters for drag and autoscroll flags. Moved autoscroll code to Frame::handleMouseMoveEvent.
+ (WebCore::FrameMac::FrameMac):
+ (WebCore::FrameMac::handleMousePressEvent):
+ (WebCore::FrameMac::eventMayStartDrag):
+ (WebCore::FrameMac::handleMouseMoveEvent):
+ (WebCore::FrameMac::mouseDown):
+
+ * bridge/mac/WebCoreFrameBridge.h: Removed handleAutoscrollForMouseDragged, which called over the bridge for AppKit to do autoscroll for us.
+ Now we scroll our views in WebCore.
+
+ * page/Frame.cpp:
+ (WebCore::Frame::handleMousePressEvent): Initialize the mouseDownMayStartAutoscroll flag.
+ (WebCore::Frame::handleMouseMoveEvent): Now kicks off autoscroll if appropriate. Moved from FrameMac.
+ (WebCore::Frame::updateSelectionForMouseDragOverPosition): Factored code out from handleMouseMoveEvent so we can update the selection from autoscroll too.
+ (WebCore::Frame::mouseDownMayStartAutoscroll): Added.
+ (WebCore::Frame::setMouseDownMayStartAutoscroll): Added.
+ (WebCore::Frame::mouseDownMayStartDrag): Added.
+ (WebCore::Frame::setMouseDownMayStartDrag): Added.
+ (WebCore::Frame::autoscrollRenderer): Added
+ (WebCore::Frame::setAutoscrollRenderer): Added.
+ (WebCore::Frame::handleAutoscroll): Updated to use autoscrollRenderer getter and setter.
+ (WebCore::Frame::autoscrollTimerFired): ditto.
+ (WebCore::Frame::stopAutoscrollTimer): ditto.
+ * page/Frame.h: Made autoscrollRenderer and stopAutoscrollTimer public, so the renderer being autoscrolled can kill the timer when it dies.
+
+ * page/FramePrivate.h:
+ (WebCore::FramePrivate::FramePrivate): Added mouseDownMayStartDrag and mouseDownMayStartAutoscroll flags. Moved from FrameMac.
+
+ * page/FrameView.cpp: Store the current mouse position in window coordinates. The callers can convert to their own coordinate space.
+ (WebCore::FrameView::handleMousePressEvent):
+ (WebCore::FrameView::handleMouseDoubleClickEvent):
+ (WebCore::FrameView::handleMouseMoveEvent):
+ (WebCore::FrameView::handleMouseReleaseEvent):
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::autoscroll): Rewrote this to scroll recursively, and to scroll based on the mouse position (not the selection).
+ We also need to update the selection here, since autoscroll can occur without a mouseMove event, and the selection needs to get reset as we scroll.
+
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::autoscroll): Convert the mouse coordinates to the right space.
+
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::shouldAutoscroll): Also return true if the renderer is a root (so we know to autoscroll views too)
+ (WebCore::RenderObject::destroy): If this renderer is being autoscrolled, stop the frame's autoscroll timer.
+
2006-10-10 Darin Adler <darin@apple.com>
Rubber stamped by Maciej.
NSView* _mouseDownView;
bool _mouseDownWasInSubframe;
bool _sendingEventToSubview;
- bool _mouseDownMayStartDrag;
bool _mouseDownMayStartSelect;
- bool _mouseDownMayStartAutoscroll;
PlatformMouseEvent m_mouseDown;
// in our view's coords
IntPoint m_mouseDownPos;
, _bridge(nil)
, _mouseDownView(nil)
, _sendingEventToSubview(false)
- , _mouseDownMayStartDrag(false)
, _mouseDownMayStartSelect(false)
- , _mouseDownMayStartAutoscroll(false)
, _activationEventNumber(0)
, _bindingRoot(0)
, _windowScriptObject(0)
_mouseDownMayStartSelect = canMouseDownStartSelect(event.targetNode());
// Careful that the drag starting logic stays in sync with eventMayStartDrag()
- _mouseDownMayStartDrag = singleClick;
+ setMouseDownMayStartDrag(singleClick);
d->m_mousePressNode = event.targetNode();
-
- _mouseDownMayStartAutoscroll = d->m_mousePressNode && d->m_mousePressNode->renderer() && d->m_mousePressNode->renderer()->shouldAutoscroll();
if (!passWidgetMouseDownEventToWidget(event)) {
// We don't do this at the start of mouse down handling (before calling into WebCore),
bool FrameMac::eventMayStartDrag(NSEvent *event) const
{
// This is a pre-flight check of whether the event might lead to a drag being started. Be careful
- // that its logic needs to stay in sync with handleMouseMoveEvent() and the way we set
- // _mouseDownMayStartDrag in handleMousePressEvent
+ // that its logic needs to stay in sync with handleMouseMoveEvent() and the way we setMouseDownMayStartDrag
+ // in handleMousePressEvent
if ([event type] != NSLeftMouseDown || [event clickCount] != 1) {
return false;
// Careful that the drag starting logic stays in sync with eventMayStartDrag()
- if (_mouseDownMayStartDrag && !_dragSrc) {
+ if (mouseDownMayStartDrag() && !_dragSrc) {
BOOL tempFlag1, tempFlag2;
[_bridge allowDHTMLDrag:&tempFlag1 UADrag:&tempFlag2];
_dragSrcMayBeDHTML = tempFlag1;
_dragSrcMayBeUA = tempFlag2;
if (!_dragSrcMayBeDHTML && !_dragSrcMayBeUA) {
- _mouseDownMayStartDrag = false; // no element is draggable
+ setMouseDownMayStartDrag(false); // no element is draggable
}
}
- if (_mouseDownMayStartDrag && !_dragSrc) {
+ if (mouseDownMayStartDrag() && !_dragSrc) {
// try to find an element that wants to be dragged
RenderObject::NodeInfo nodeInfo(true, false);
renderer()->layer()->hitTest(nodeInfo, m_mouseDownPos);
Node *node = nodeInfo.innerNode();
_dragSrc = (node && node->renderer()) ? node->renderer()->draggableNode(_dragSrcMayBeDHTML, _dragSrcMayBeUA, m_mouseDownPos.x(), m_mouseDownPos.y(), _dragSrcIsDHTML) : 0;
if (!_dragSrc) {
- _mouseDownMayStartDrag = false; // no element is draggable
+ setMouseDownMayStartDrag(false); // no element is draggable
} else {
// remember some facts about this source, while we have a NodeInfo handy
node = nodeInfo.URLElement();
// For drags starting in the selection, the user must wait between the mousedown and mousedrag,
// or else we bail on the dragging stuff and allow selection to occur
- if (_mouseDownMayStartDrag && _dragSrcInSelection && [_currentEvent timestamp] - _mouseDownTimestamp < TextDragDelay) {
- _mouseDownMayStartDrag = false;
+ if (mouseDownMayStartDrag() && _dragSrcInSelection && [_currentEvent timestamp] - _mouseDownTimestamp < TextDragDelay) {
+ setMouseDownMayStartDrag(false);
// ...but if this was the first click in the window, we don't even want to start selection
if (_activationEventNumber == [_currentEvent eventNumber]) {
_mouseDownMayStartSelect = false;
}
}
- if (_mouseDownMayStartDrag) {
+ if (mouseDownMayStartDrag()) {
// We are starting a text/image/url drag, so the cursor should be an arrow
d->m_view->setCursor(pointerCursor());
_dragClipboard->setDragImageElement(_dragSrc.get(), IntPoint() + delta);
}
- _mouseDownMayStartDrag = dispatchDragSrcEvent(dragstartEvent, m_mouseDown) && mayCopy();
+ setMouseDownMayStartDrag(dispatchDragSrcEvent(dragstartEvent, m_mouseDown) && mayCopy());
// Invalidate clipboard here against anymore pasteboard writing for security. The drag
// image can still be changed as we drag, but not the pasteboard data.
_dragClipboard->setAccessPolicy(ClipboardMac::ImageWritable);
- if (_mouseDownMayStartDrag) {
+ if (mouseDownMayStartDrag()) {
// gather values from DHTML element, if it set any
_dragClipboard->sourceOperation(&srcOp);
}
}
- if (_mouseDownMayStartDrag) {
+ if (mouseDownMayStartDrag()) {
BOOL startedDrag = [_bridge startDraggingImage:dragImage at:dragLoc operation:srcOp event:_currentEvent sourceIsDHTML:_dragSrcIsDHTML DHTMLWroteData:wcWrotePasteboard];
if (!startedDrag && _dragSrcMayBeDHTML) {
// WebKit canned the drag at the last minute - we owe _dragSrc a DRAGEND event
PlatformMouseEvent event(PlatformMouseEvent::currentEvent);
dispatchDragSrcEvent(dragendEvent, event);
- _mouseDownMayStartDrag = false;
+ setMouseDownMayStartDrag(false);
}
}
- if (!_mouseDownMayStartDrag) {
+ if (!mouseDownMayStartDrag()) {
// something failed to start the drag, cleanup
freeClipboard();
_dragSrc = 0;
// No more default handling (like selection), whether we're past the hysteresis bounds or not
return;
}
- if (!_mouseDownMayStartSelect && !_mouseDownMayStartAutoscroll) {
+ if (!mouseDownMayStartSelect() && !mouseDownMayStartAutoscroll())
return;
- }
-
- // Don't allow dragging or click handling after we've started selecting.
- _mouseDownMayStartDrag = false;
- d->m_view->invalidateClick();
-
- Node* node = event.targetNode();
- RenderObject* renderer = 0;
- if (node)
- renderer = node->renderer();
-
- // If the selection is contained in a layer that can scroll, that layer should handle the autoscroll
- // Otherwise, let the bridge handle it so the view can scroll itself.
- while (renderer && !renderer->shouldAutoscroll())
- renderer = renderer->parent();
- if (renderer)
- handleAutoscroll(renderer);
- else {
- if (!d->m_autoscrollTimer.isActive())
- startAutoscrollTimer();
- [_bridge handleAutoscrollForMouseDragged:_currentEvent];
- }
} else {
// If we allowed the other side of the bridge to handle a drag
m_mouseDownPos = d->m_view->windowToContents(IntPoint(loc));
_mouseDownTimestamp = [event timestamp];
- _mouseDownMayStartDrag = false;
+ setMouseDownMayStartDrag(false);
_mouseDownMayStartSelect = false;
- _mouseDownMayStartAutoscroll = false;
-
+ setMouseDownMayStartAutoscroll(false);
+
v->handleMousePressEvent(event);
ASSERT(_currentEvent == event);
- (void)allowDHTMLDrag:(BOOL *)flagDHTML UADrag:(BOOL *)flagUA;
- (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc operation:(NSDragOperation)op event:(NSEvent *)event sourceIsDHTML:(BOOL)flag DHTMLWroteData:(BOOL)dhtmlWroteData;
-- (void)handleAutoscrollForMouseDragged:(NSEvent *)event;
- (BOOL)mayStartDragAtEventLocation:(NSPoint)location;
- (BOOL)selectWordBeforeMenuEvent;
}
handleMousePressEventSingleClick(event);
}
+
+ setMouseDownMayStartAutoscroll(mouseDownMayStartSelect() ||
+ (d->m_mousePressNode && d->m_mousePressNode->renderer() && d->m_mousePressNode->renderer()->shouldAutoscroll()));
}
void Frame::handleMouseMoveEvent(const MouseEventWithHitTestResults& event)
Node *innerNode = event.targetNode();
- if (event.event().button() != 0 || !innerNode || !innerNode->renderer() || !mouseDownMayStartSelect() || !innerNode->renderer()->shouldSelect())
+ if (event.event().button() != 0 || !innerNode || !innerNode->renderer())
return;
- // handle making selection
+ if (mouseDownMayStartAutoscroll()) {
+ // If the selection is contained in a layer that can scroll, that layer should handle the autoscroll
+ // Otherwise, let the bridge handle it so the view can scroll itself.
+ RenderObject* renderer = innerNode->renderer();
+ while (renderer && !renderer->shouldAutoscroll())
+ renderer = renderer->parent();
+ if (renderer)
+ handleAutoscroll(renderer);
+
+ setMouseDownMayStartDrag(false);
+ view()->invalidateClick();
+ }
+
+ if (mouseDownMayStartSelect() && innerNode->renderer()->shouldSelect()) {
+ // handle making selection
+ IntPoint vPoint = view()->windowToContents(event.event().pos());
+ VisiblePosition pos(innerNode->renderer()->positionForPoint(vPoint));
- IntPoint vPoint = view()->windowToContents(event.event().pos());
- VisiblePosition pos(innerNode->renderer()->positionForPoint(vPoint));
+ updateSelectionForMouseDragOverPosition(pos);
+ }
+}
+
+void Frame::updateSelectionForMouseDragOverPosition(const VisiblePosition& pos)
+{
// Don't modify the selection if we're not on a node.
if (pos.isNull())
return;
}
}
+bool Frame::mouseDownMayStartAutoscroll() const
+{
+ return d->m_mouseDownMayStartAutoscroll;
+}
+
+void Frame::setMouseDownMayStartAutoscroll(bool b)
+{
+ d->m_mouseDownMayStartAutoscroll = b;
+}
+
+bool Frame::mouseDownMayStartDrag() const
+{
+ return d->m_mouseDownMayStartDrag;
+}
+
+void Frame::setMouseDownMayStartDrag(bool b)
+{
+ d->m_mouseDownMayStartDrag = b;
+}
+
void Frame::handleFallbackContent()
{
Element* owner = ownerElement();
{
if (d->m_autoscrollTimer.isActive())
return;
- d->m_autoscrollRenderer = renderer;
+ setAutoscrollRenderer(renderer);
startAutoscrollTimer();
}
stopAutoscrollTimer();
return;
}
- if (d->m_autoscrollRenderer) {
- d->m_autoscrollRenderer->autoscroll();
- }
+ if (RenderObject* r = autoscrollRenderer())
+ r->autoscroll();
+}
+
+RenderObject* Frame::autoscrollRenderer() const
+{
+ return d->m_autoscrollRenderer;
+}
+
+void Frame::setAutoscrollRenderer(RenderObject* renderer)
+{
+ d->m_autoscrollRenderer = renderer;
}
RenderObject::NodeInfo Frame::nodeInfoAtPoint(const IntPoint& point, bool allowShadowContent)
void Frame::stopAutoscrollTimer()
{
- d->m_autoscrollRenderer = 0;
+ setAutoscrollRenderer(0);
d->m_autoscrollTimer.stop();
}
virtual void handleMouseMoveEvent(const MouseEventWithHitTestResults&);
virtual void handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
+ void updateSelectionForMouseDragOverPosition(const VisiblePosition&);
+
void selectClosestWordFromMouseEvent(const PlatformMouseEvent&, Node* innerNode);
virtual void urlSelected(const DeprecatedString& url, const String& target);
void selectFrameElementInParentIfFullySelected();
virtual bool mouseDownMayStartSelect() const { return true; }
+ bool mouseDownMayStartAutoscroll() const;
+ void setMouseDownMayStartAutoscroll(bool b);
+ bool mouseDownMayStartDrag() const;
+ void setMouseDownMayStartDrag(bool b);
+
void handleFallbackContent();
private:
void setNeedsReapplyStyles();
virtual IntRect windowResizerRect() const { return IntRect(); }
+
+ void stopAutoscrollTimer();
+ RenderObject* autoscrollRenderer() const;
protected:
virtual void startRedirectionTimer();
void handleAutoscroll(RenderObject*);
void startAutoscrollTimer();
- void stopAutoscrollTimer();
+ void setAutoscrollRenderer(RenderObject*);
private:
void emitLoadEvent();
, m_iconLoader(0)
, m_autoscrollTimer(thisFrame, &Frame::autoscrollTimerFired)
, m_autoscrollRenderer(0)
+ , m_mouseDownMayStartAutoscroll(false)
+ , m_mouseDownMayStartDrag(false)
, m_paintRestriction(PaintRestrictionNone)
, m_markedTextUsesUnderlines(false)
, m_highlightTextMatches(false)
Timer<Frame> m_autoscrollTimer;
RenderObject* m_autoscrollRenderer;
+ bool m_mouseDownMayStartAutoscroll;
+ bool m_mouseDownMayStartDrag;
RefPtr<Node> m_elementToDraw;
PaintRestriction m_paintRestriction;
RefPtr<FrameView> protector(this);
d->mousePressed = true;
- d->m_currentMousePosition = windowToContents(mouseEvent.pos());
+ d->m_currentMousePosition = mouseEvent.pos();
MouseEventWithHitTestResults mev = prepareMouseEvent(false, true, false, mouseEvent);
// We get this instead of a second mouse-up
d->mousePressed = false;
- d->m_currentMousePosition = windowToContents(mouseEvent.pos());
+ d->m_currentMousePosition = mouseEvent.pos();
MouseEventWithHitTestResults mev = prepareMouseEvent(false, true, false, mouseEvent);
Frame* subframe = subframeForTargetNode(mev.targetNode());
return;
RefPtr<FrameView> protector(this);
- d->m_currentMousePosition = windowToContents(mouseEvent.pos());
+ d->m_currentMousePosition = mouseEvent.pos();
if (d->hoverTimer.isActive())
d->hoverTimer.stop();
RefPtr<FrameView> protector(this);
d->mousePressed = false;
- d->m_currentMousePosition = windowToContents(mouseEvent.pos());
+ d->m_currentMousePosition = mouseEvent.pos();
if (d->resizingFrameSet) {
dispatchMouseEvent(mouseupEvent, d->resizingFrameSet.get(), true, d->clickCount, mouseEvent, false);
}
void RenderLayer::autoscroll()
-{
- int xOffset = scrollXOffset();
- int yOffset = scrollYOffset();
-
- // Get the rectangle for the extent of the selection
- Selection selection(renderer()->document()->frame()->selectionController()->selection());
- IntRect extentRect = VisiblePosition(selection.extent()).caretRect();
- extentRect.move(xOffset, yOffset);
-
- IntRect bounds = IntRect(xPos() + xOffset, yPos() + yOffset, width() - verticalScrollbarWidth(), height() - horizontalScrollbarHeight());
-
- // Calculate how much the layer should scroll horizontally.
- int diffX = 0;
- if (extentRect.right() > bounds.right())
- diffX = extentRect.right() - bounds.right();
- else if (extentRect.x() < bounds.x())
- diffX = extentRect.x() - bounds.x();
+{
+ if (!renderer() || !renderer()->document() || !renderer()->document()->frame() || !renderer()->document()->frame()->view())
+ return;
- // Calculate how much the layer should scroll vertically.
- int diffY = 0;
- if (extentRect.bottom() > bounds.bottom())
- diffY = extentRect.bottom() - bounds.bottom();
- else if (extentRect.y() < bounds.y())
- diffY = extentRect.y() - bounds.y();
-
- scrollToOffset(xOffset + diffX, yOffset + diffY);
+ Frame* currentFrame = renderer()->document()->frame();
+ IntPoint currentPos = currentFrame->view()->windowToContents(currentFrame->view()->currentMousePosition());
+
+ if (currentFrame->mouseDownMayStartSelect()) {
+ VisiblePosition pos(renderer()->positionForPoint(currentPos));
+ currentFrame->updateSelectionForMouseDragOverPosition(pos);
+ }
+
+ scrollRectToVisible(IntRect(currentPos, IntSize(1, 1)), gAlignToEdgeIfNeeded, gAlignToEdgeIfNeeded);
}
void RenderLayer::resize(const PlatformMouseEvent& evt, const IntSize& offsetFromResizeCorner)
void RenderListBox::autoscroll()
{
- int mouseX = document()->frame()->view()->currentMousePosition().x();
- int mouseY = document()->frame()->view()->currentMousePosition().y();
+ IntPoint pos = document()->frame()->view()->windowToContents(document()->frame()->view()->currentMousePosition());
IntRect bounds = absoluteBoundingBoxRect();
HTMLSelectElement* select = static_cast<HTMLSelectElement*>(node());
HTMLOptionElement* element = 0;
int rows = size();
int offset = m_indexOffset;
- if (mouseY < bounds.y() && scrollToRevealElementAtListIndex(offset - 1) && items[offset - 1]->hasTagName(optionTag))
+ if (pos.y() < bounds.y() && scrollToRevealElementAtListIndex(offset - 1) && items[offset - 1]->hasTagName(optionTag))
element = static_cast<HTMLOptionElement*>(items[offset - 1]);
- else if (mouseY > bounds.bottom() && scrollToRevealElementAtListIndex(offset + rows) && items[offset + rows - 1]->hasTagName(optionTag))
+ else if (pos.y() > bounds.bottom() && scrollToRevealElementAtListIndex(offset + rows) && items[offset + rows - 1]->hasTagName(optionTag))
element = static_cast<HTMLOptionElement*>(items[offset + rows - 1]);
else
- element = optionAtPoint(mouseX, mouseY);
+ element = optionAtPoint(pos.x(), pos.y());
if (element) {
select->setSelectedIndex(element->index(), !select->multiple());
bool RenderObject::shouldAutoscroll() const
{
- return (hasOverflowClip() && (scrollsOverflow() || (node() && node()->isContentEditable())));
+ return ((isRoot()) || (hasOverflowClip() && (scrollsOverflow() || (node() && node()->isContentEditable()))));
}
void RenderObject::autoscroll()
void RenderObject::destroy()
{
+ // If this renderer is being autoscrolled, stop the autoscroll timer
+ if (document() && document()->frame() && document()->frame()->autoscrollRenderer() == this)
+ document()->frame()->stopAutoscrollTimer();
+
if (m_hasCounterNodeMap) {
RenderObjectsToCounterNodeMaps* objectsMap = getRenderObjectsToCounterNodeMaps();
if (CounterNodeMap* counterNodesMap = objectsMap->get(this)) {
+2006-10-10 Adele Peterson <adele@apple.com>
+
+ Reviewed by Beth.
+
+ Removed handleAutoscrollForMouseDragged. Except for autoscroll caused by drag and drop, all other
+ autoscrolling should be done in WebCore instead of in AppKit.
+
+ * WebCoreSupport/WebFrameBridge.m:
+ * WebView/WebHTMLView.m:
+ * WebView/WebHTMLViewPrivate.h:
+
2006-10-10 Darin Adler <darin@apple.com>
- corrected an archive regression caused by loader refactoring
return [docView _startDraggingImage:dragImage at:dragLoc operation:op event:event sourceIsDHTML:flag DHTMLWroteData:dhtmlWroteData];
}
-- (void)handleAutoscrollForMouseDragged:(NSEvent *)event;
-{
- WebHTMLView *docView = (WebHTMLView *)[[_frame frameView] documentView];
-
- ASSERT([docView isKindOfClass:[WebHTMLView class]]);
-
- [docView _handleAutoscrollForMouseDragged:event];
-}
-
- (BOOL)mayStartDragAtEventLocation:(NSPoint)location
{
WebHTMLView *docView = (WebHTMLView *)[[_frame frameView] documentView];
return startedDrag;
}
-- (void)_handleAutoscrollForMouseDragged:(NSEvent *)event
-{
- [self autoscroll:event];
- [self _startAutoscrollTimer:event];
-}
-
- (BOOL)_mayStartDragAtEventLocation:(NSPoint)location
{
WebHTMLView *topHTMLView = [self _topHTMLView];
- (NSImage *)_dragImageForLinkElement:(NSDictionary *)element;
- (BOOL)_startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc operation:(NSDragOperation)op event:(NSEvent *)event sourceIsDHTML:(BOOL)flag DHTMLWroteData:(BOOL)dhtmlWroteData;
-- (void)_handleAutoscrollForMouseDragged:(NSEvent *)event;
- (BOOL)_mayStartDragAtEventLocation:(NSPoint)location;
- (WebPluginController *)_pluginController;