Changeset 13302 in webkit
- Timestamp:
- Mar 15, 2006 1:05:41 AM (18 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r13301 r13302 1 2006-03-15 Adele Peterson <adele@apple.com> 2 3 Reviewed by Maciej. 4 5 - Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=7114 6 Dragging to scroll doesn't work for overflow areas 7 8 No test case. There doesn't appear to be a way to trigger the autoscroll with the EventSender. 9 10 * bridge/mac/MacFrame.mm: 11 (WebCore::MacFrame::khtmlMouseMoveEvent): If we have a layer that can scroll, let the layer handle its autoscroll. 12 Otherwise, call over the bridge to let AppKit scroll the view. 13 (WebCore::MacFrame::khtmlMouseReleaseEvent): Stops the autoscroll timer. 14 * page/Frame.cpp: 15 (WebCore::Frame::khtmlMouseReleaseEvent): Stops the autoscroll timer. 16 (WebCore::Frame::handleAutoscroll): Added. Saves the layer, and starts the timer. 17 (WebCore::Frame::autoscrollTimerFired): Added. Calls autoscroll() on the layer. 18 (WebCore::Frame::startAutoscrollTimer): Added. 19 (WebCore::Frame::stopAutoscrollTimer): Added. 20 * page/Frame.h: Added new autoscroll methods. 21 * page/FramePrivate.h: (WebCore::FramePrivate::FramePrivate): Initialize m_autoscrollTimer and m_autoscrollLayer. 22 * rendering/render_layer.cpp: 23 (WebCore::RenderLayer::autoscroll): Calculates how much the layer should scroll, and actually scrolls. 24 (WebCore::RenderLayer::shouldAutoscroll): If the layer has overflow then it should be able to scroll. 25 Except for overflow:hidden areas that aren't editable. 26 In the future, we may want to have a css property that indicates an overflow:hidden style that should also scroll. 27 * rendering/render_layer.h: Added new autoscroll methods. 28 1 29 2006-03-14 Justin Garcia <justin.garcia@apple.com> 2 30 -
trunk/WebCore/bridge/mac/MacFrame.mm
r13260 r13302 1763 1763 d->m_view->invalidateClick(); 1764 1764 1765 // We use khtml's selection but our own autoscrolling. 1766 [_bridge handleAutoscrollForMouseDragged:_currentEvent]; 1765 NodeImpl* node = event->innerNode(); 1766 RenderLayer* layer = 0; 1767 if (node && node->renderer()) 1768 layer = node->renderer()->enclosingLayer(); 1769 1770 // If the selection began in a layer that can scroll, the layer should handle the autoscroll 1771 // Otherwise, let the bridge handle it so the view can scroll itself. 1772 if (layer && layer->shouldAutoscroll()) 1773 handleAutoscroll(layer); 1774 else 1775 [_bridge handleAutoscrollForMouseDragged:_currentEvent]; 1776 1767 1777 } else { 1768 1778 // If we allowed the other side of the bridge to handle a drag … … 1858 1868 return; 1859 1869 } 1870 stopAutoscrollTimer(); 1860 1871 1861 1872 _sendingEventToSubview = true; -
trunk/WebCore/page/Frame.cpp
r13301 r13302 72 72 #include "render_canvas.h" 73 73 #include "render_frames.h" 74 #include "render_layer.h" 74 75 #include "visible_text.h" 75 76 #include "visible_units.h" … … 103 104 104 105 const double caretBlinkFrequency = 0.5; 106 const double autoscrollInterval = 0.1; 105 107 106 108 class UserStyleSheetLoader : public CachedObjectClient { … … 1880 1882 void Frame::khtmlMouseReleaseEvent(MouseEventWithHitTestResults* event) 1881 1883 { 1884 stopAutoscrollTimer(); 1885 1882 1886 // Used to prevent mouseMoveEvent from initiating a drag before 1883 1887 // the mouse is pressed again. … … 2671 2675 } 2672 2676 2677 void Frame::handleAutoscroll(RenderLayer* layer) 2678 { 2679 if (d->m_autoscrollTimer.isActive()) 2680 return; 2681 d->m_autoscrollLayer = layer; 2682 startAutoscrollTimer(); 2683 } 2684 2685 void Frame::autoscrollTimerFired(Timer<Frame>*) 2686 { 2687 bool isStillDown = CGEventSourceButtonState(kCGEventSourceStateCombinedSessionState, kCGMouseButtonLeft); 2688 if (!isStillDown){ 2689 stopAutoscrollTimer(); 2690 return; 2691 } 2692 if (d->m_autoscrollLayer) { 2693 d->m_autoscrollLayer->autoscroll(); 2694 } 2695 } 2696 2697 void Frame::startAutoscrollTimer() 2698 { 2699 d->m_autoscrollTimer.startRepeating(autoscrollInterval); 2700 } 2701 2702 void Frame::stopAutoscrollTimer() 2703 { 2704 d->m_autoscrollTimer.stop(); 2705 } 2706 2673 2707 // FIXME: why is this here instead of on the FrameView? 2674 2708 void Frame::paint(GraphicsContext* p, const IntRect& rect) -
trunk/WebCore/page/Frame.h
r13260 r13302 70 70 class MouseEventWithHitTestResults; 71 71 class RangeImpl; 72 class RenderLayer; 72 73 class Selection; 73 74 class SelectionController; … … 778 779 virtual void startRedirectionTimer(); 779 780 virtual void stopRedirectionTimer(); 781 782 void handleAutoscroll(RenderLayer*); 783 void startAutoscrollTimer(); 784 void stopAutoscrollTimer(); 780 785 781 786 private: … … 800 805 801 806 virtual void setStatusBarText(const String&); 807 808 void autoscrollTimerFired(Timer<Frame>*); 802 809 803 810 public: -
trunk/WebCore/page/FramePrivate.h
r13260 r13302 95 95 , m_lifeSupportTimer(thisFrame, &Frame::lifeSupportTimerFired) 96 96 , m_userStyleSheetLoader(0) 97 , m_autoscrollTimer(thisFrame, &Frame::autoscrollTimerFired) 98 , m_autoscrollLayer(0) 97 99 { 98 100 } … … 202 204 203 205 UserStyleSheetLoader* m_userStyleSheetLoader; 206 207 Timer<Frame> m_autoscrollTimer; 208 RenderLayer* m_autoscrollLayer; 204 209 }; 205 210 -
trunk/WebCore/rendering/render_layer.cpp
r13291 r13302 48 48 #include "EventNames.h" 49 49 #include "FrameView.h" 50 #include "Frame.h" 50 51 #include "GraphicsContext.h" 51 52 #include "dom2_eventsimpl.h" … … 56 57 #include "render_inline.h" 57 58 #include "render_theme.h" 59 #include "SelectionController.h" 58 60 #include <assert.h> 59 61 #include <kxmlcore/Vector.h> … … 725 727 726 728 return IntRect(IntPoint(x, y), visibleRect.size()); 729 } 730 731 void RenderLayer::autoscroll() 732 { 733 int xOffset = scrollXOffset(); 734 int yOffset = scrollYOffset(); 735 736 // Get the rectangle for the extent of the selection 737 SelectionController sel = renderer()->document()->frame()->selection(); 738 IntRect extentRect = SelectionController(sel.extent(), sel.affinity()).caretRect(); 739 extentRect.move(xOffset, yOffset); 740 741 IntRect bounds = IntRect(xPos() + xOffset, yPos() + yOffset, width() - verticalScrollbarWidth(), height() - horizontalScrollbarHeight()); 742 743 // Calculate how much the layer should scroll horizontally. 744 int diffX = 0; 745 if (extentRect.right() > bounds.right()) 746 diffX = extentRect.right() - bounds.right(); 747 else if (extentRect.x() < bounds.x()) 748 diffX = extentRect.x() - bounds.x(); 749 750 // Calculate how much the layer should scroll vertically. 751 int diffY = 0; 752 if (extentRect.bottom() > bounds.bottom()) 753 diffY = extentRect.bottom() - bounds.bottom(); 754 else if (extentRect.y() < bounds.y()) 755 diffY = extentRect.y() - bounds.y(); 756 757 scrollToOffset(xOffset + diffX, yOffset + diffY); 758 } 759 760 bool RenderLayer::shouldAutoscroll() 761 { 762 if (renderer()->hasOverflowClip() && (m_object->style()->overflow() != OHIDDEN || renderer()->node()->isContentEditable())) 763 return true; 764 return false; 727 765 } 728 766 -
trunk/WebCore/rendering/render_layer.h
r13291 r13302 247 247 void slotValueChanged(int); 248 248 bool scroll(KWQScrollDirection direction, KWQScrollGranularity granularity, float multiplier=1.0); 249 void autoscroll(); 250 bool shouldAutoscroll(); 249 251 250 252 void updateLayerPosition();
Note: See TracChangeset
for help on using the changeset viewer.