Changeset 30060 in webkit
- Timestamp:
- Feb 6, 2008 8:12:36 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r30059 r30060 1 2008-02-06 Kevin Ollivier <kevino@theolliviers.com> 2 3 Reviewed by Darin Adler. 4 5 Rather than directly handing scroll wheel events, use 6 PlatformWheelEvent to send them to WebCore first, so that 7 mouse wheel scrolling info can be retrieved via JavaScript. 8 9 http://bugs.webkit.org/show_bug.cgi?id=17179 10 11 * platform/ScrollView.h: 12 * platform/wx/MouseWheelEventWx.cpp: 13 (WebCore::PlatformWheelEvent::PlatformWheelEvent): 14 * platform/wx/ScrollViewWx.cpp: 15 (WebCore::ScrollView::ScrollViewPrivate::bindEvents): 16 (WebCore::ScrollView::wheelEvent): 17 (WebCore::ScrollView::maximumScroll): 18 1 19 2008-02-06 Mark Rowe <mrowe@apple.com> 2 20 -
trunk/WebCore/platform/ScrollView.h
r29950 r30060 231 231 private: 232 232 void adjustScrollbars(int x = -1, int y = -1, bool refresh = true); 233 IntSize maximumScroll() const; 233 234 234 235 class ScrollViewPrivate; -
trunk/WebCore/platform/wx/MouseWheelEventWx.cpp
r29663 r30060 40 40 , m_metaKey(event.MetaDown()) // FIXME: We'll have to test other browsers 41 41 , m_deltaX(0) // wx doesn't support horizontal mouse wheel scrolling 42 , m_deltaY(event.GetWheelRotation() )42 , m_deltaY(event.GetWheelRotation() / event.GetWheelDelta()) 43 43 { 44 44 -
trunk/WebCore/platform/wx/ScrollViewWx.cpp
r29949 r30060 30 30 #include "IntRect.h" 31 31 #include "NotImplemented.h" 32 #include "PlatformWheelEvent.h" 32 33 #include "ScrollBar.h" 33 34 … … 69 70 win->Connect(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); 70 71 win->Connect(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); 71 win->Connect(wxEVT_MOUSEWHEEL, wxMouseEventHandler(ScrollViewPrivate::OnMouseWheelEvents), NULL, this);72 72 } 73 73 74 void OnMouseWheelEvents(wxMouseEvent& event)75 {76 // TODO: Get wx to report X and Y rotation so we can support mighty mouse, etc.77 m_scrollView->scrollBy(0, -event.GetWheelRotation() * LINE_STEP);78 }79 80 74 void OnScrollWinEvents(wxScrollWinEvent& e) 81 75 { … … 112 106 ScrollView* m_scrollView; 113 107 114 IntSize scrollOffset;115 IntSize contentsSize;116 108 HashSet<Widget*> m_children; 117 109 bool hasStaticBackground; … … 165 157 win->GetClientSize(&width, NULL); 166 158 159 ASSERT(width >= 0); 167 160 return width; 168 161 } … … 175 168 win->GetClientSize(NULL, &height); 176 169 170 ASSERT(height >= 0); 177 171 return height; 178 172 } … … 240 234 int ScrollView::contentsX() const 241 235 { 236 ASSERT(m_data->viewStart.x >= 0); 242 237 return m_data->viewStart.x; 243 238 } … … 245 240 int ScrollView::contentsY() const 246 241 { 242 ASSERT(m_data->viewStart.y >= 0); 247 243 return m_data->viewStart.y; 248 244 } … … 254 250 if (win) 255 251 win->GetVirtualSize(&width, NULL); 252 ASSERT(width >= 0); 256 253 return width; 257 254 } … … 263 260 if (win) 264 261 win->GetVirtualSize(NULL, &height); 262 ASSERT(height >= 0); 265 263 return height; 266 264 } … … 405 403 } 406 404 407 void ScrollView::wheelEvent(PlatformWheelEvent&) 408 { 409 // do nothing, 410 // FIXME: not sure if any ports need to handle this, actually... 405 void ScrollView::wheelEvent(PlatformWheelEvent& e) 406 { 407 // Determine how much we want to scroll. If we can move at all, we will accept the event. 408 IntSize maxScrollDelta = maximumScroll(); 409 if ((e.deltaX() < 0 && maxScrollDelta.width() > 0) || 410 (e.deltaX() > 0 && scrollOffset().width() > 0) || 411 (e.deltaY() < 0 && maxScrollDelta.height() > 0) || 412 (e.deltaY() > 0 && scrollOffset().height() > 0)) { 413 e.accept(); 414 scrollBy(-e.deltaX() * LINE_STEP, -e.deltaY() * LINE_STEP); 415 } 411 416 } 412 417 … … 445 450 } 446 451 447 448 452 PlatformScrollbar* ScrollView::scrollbarUnderMouse(const PlatformMouseEvent& mouseEvent) 449 453 { … … 453 457 } 454 458 455 456 } 459 IntSize ScrollView::maximumScroll() const 460 { 461 IntSize delta = (IntSize(contentsWidth(), contentsHeight()) - IntSize(visibleWidth(), visibleHeight())) - scrollOffset(); 462 delta.clampNegativeToZero(); 463 return delta; 464 } 465 466 }
Note: See TracChangeset
for help on using the changeset viewer.