Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: Source/core/page/AutoscrollController.cpp

Issue 23672027: Rename OS(WINDOWS) to OS(WIN) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/page/AutoscrollController.h ('k') | Source/core/page/DragController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void AutoscrollController::stopAutoscrollTimer() 83 void AutoscrollController::stopAutoscrollTimer()
84 { 84 {
85 RenderBox* scrollable = m_autoscrollRenderer; 85 RenderBox* scrollable = m_autoscrollRenderer;
86 m_autoscrollTimer.stop(); 86 m_autoscrollTimer.stop();
87 m_autoscrollRenderer = 0; 87 m_autoscrollRenderer = 0;
88 88
89 if (!scrollable) 89 if (!scrollable)
90 return; 90 return;
91 91
92 scrollable->stopAutoscroll(); 92 scrollable->stopAutoscroll();
93 #if OS(WINDOWS) 93 #if OS(WIN)
94 if (panScrollInProgress()) { 94 if (panScrollInProgress()) {
95 if (FrameView* view = scrollable->frame()->view()) { 95 if (FrameView* view = scrollable->frame()->view()) {
96 view->removePanScrollIcon(); 96 view->removePanScrollIcon();
97 view->setCursor(pointerCursor()); 97 view->setCursor(pointerCursor());
98 } 98 }
99 } 99 }
100 #endif 100 #endif
101 101
102 m_autoscrollType = NoAutoscroll; 102 m_autoscrollType = NoAutoscroll;
103 } 103 }
104 104
105 void AutoscrollController::stopAutoscrollIfNeeded(RenderObject* renderer) 105 void AutoscrollController::stopAutoscrollIfNeeded(RenderObject* renderer)
106 { 106 {
107 if (m_autoscrollRenderer != renderer) 107 if (m_autoscrollRenderer != renderer)
108 return; 108 return;
109 m_autoscrollRenderer = 0; 109 m_autoscrollRenderer = 0;
110 m_autoscrollType = NoAutoscroll; 110 m_autoscrollType = NoAutoscroll;
111 m_autoscrollTimer.stop(); 111 m_autoscrollTimer.stop();
112 } 112 }
113 113
114 void AutoscrollController::updateAutoscrollRenderer() 114 void AutoscrollController::updateAutoscrollRenderer()
115 { 115 {
116 if (!m_autoscrollRenderer) 116 if (!m_autoscrollRenderer)
117 return; 117 return;
118 118
119 RenderObject* renderer = m_autoscrollRenderer; 119 RenderObject* renderer = m_autoscrollRenderer;
120 120
121 #if OS(WINDOWS) 121 #if OS(WIN)
122 HitTestResult hitTest = renderer->frame()->eventHandler()->hitTestResultAtPo int(m_panScrollStartPos, HitTestRequest::ReadOnly | HitTestRequest::Active | Hit TestRequest::DisallowShadowContent); 122 HitTestResult hitTest = renderer->frame()->eventHandler()->hitTestResultAtPo int(m_panScrollStartPos, HitTestRequest::ReadOnly | HitTestRequest::Active | Hit TestRequest::DisallowShadowContent);
123 123
124 if (Node* nodeAtPoint = hitTest.innerNode()) 124 if (Node* nodeAtPoint = hitTest.innerNode())
125 renderer = nodeAtPoint->renderer(); 125 renderer = nodeAtPoint->renderer();
126 #endif 126 #endif
127 127
128 while (renderer && !(renderer->isBox() && toRenderBox(renderer)->canAutoscro ll())) 128 while (renderer && !(renderer->isBox() && toRenderBox(renderer)->canAutoscro ll()))
129 renderer = renderer->parent(); 129 renderer = renderer->parent();
130 m_autoscrollRenderer = renderer && renderer->isBox() ? toRenderBox(renderer) : 0; 130 m_autoscrollRenderer = renderer && renderer->isBox() ? toRenderBox(renderer) : 0;
131 } 131 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 m_autoscrollType = AutoscrollForDragAndDrop; 164 m_autoscrollType = AutoscrollForDragAndDrop;
165 m_autoscrollRenderer = scrollable; 165 m_autoscrollRenderer = scrollable;
166 m_dragAndDropAutoscrollStartTime = eventTime; 166 m_dragAndDropAutoscrollStartTime = eventTime;
167 startAutoscrollTimer(); 167 startAutoscrollTimer();
168 } else if (m_autoscrollRenderer != scrollable) { 168 } else if (m_autoscrollRenderer != scrollable) {
169 m_dragAndDropAutoscrollStartTime = eventTime; 169 m_dragAndDropAutoscrollStartTime = eventTime;
170 m_autoscrollRenderer = scrollable; 170 m_autoscrollRenderer = scrollable;
171 } 171 }
172 } 172 }
173 173
174 #if OS(WINDOWS) 174 #if OS(WIN)
175 void AutoscrollController::handleMouseReleaseForPanScrolling(Frame* frame, const PlatformMouseEvent& mouseEvent) 175 void AutoscrollController::handleMouseReleaseForPanScrolling(Frame* frame, const PlatformMouseEvent& mouseEvent)
176 { 176 {
177 Page* page = frame->page(); 177 Page* page = frame->page();
178 if (!page || page->mainFrame() != frame) 178 if (!page || page->mainFrame() != frame)
179 return; 179 return;
180 switch (m_autoscrollType) { 180 switch (m_autoscrollType) {
181 case AutoscrollForPan: 181 case AutoscrollForPan:
182 if (mouseEvent.button() == MiddleButton) 182 if (mouseEvent.button() == MiddleButton)
183 m_autoscrollType = AutoscrollForPanCanStop; 183 m_autoscrollType = AutoscrollForPanCanStop;
184 break; 184 break;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 case AutoscrollForSelection: 230 case AutoscrollForSelection:
231 if (!eventHandler->mousePressed()) { 231 if (!eventHandler->mousePressed()) {
232 stopAutoscrollTimer(); 232 stopAutoscrollTimer();
233 return; 233 return;
234 } 234 }
235 eventHandler->updateSelectionForMouseDrag(); 235 eventHandler->updateSelectionForMouseDrag();
236 m_autoscrollRenderer->autoscroll(eventHandler->lastKnownMousePosition()) ; 236 m_autoscrollRenderer->autoscroll(eventHandler->lastKnownMousePosition()) ;
237 break; 237 break;
238 case NoAutoscroll: 238 case NoAutoscroll:
239 break; 239 break;
240 #if OS(WINDOWS) 240 #if OS(WIN)
241 case AutoscrollForPanCanStop: 241 case AutoscrollForPanCanStop:
242 case AutoscrollForPan: 242 case AutoscrollForPan:
243 if (!panScrollInProgress()) { 243 if (!panScrollInProgress()) {
244 stopAutoscrollTimer(); 244 stopAutoscrollTimer();
245 return; 245 return;
246 } 246 }
247 if (FrameView* view = m_autoscrollRenderer->frame()->view()) 247 if (FrameView* view = m_autoscrollRenderer->frame()->view())
248 updatePanScrollState(view, eventHandler->lastKnownMousePosition()); 248 updatePanScrollState(view, eventHandler->lastKnownMousePosition());
249 m_autoscrollRenderer->panScroll(m_panScrollStartPos); 249 m_autoscrollRenderer->panScroll(m_panScrollStartPos);
250 break; 250 break;
251 #endif 251 #endif
252 } 252 }
253 } 253 }
254 254
255 void AutoscrollController::startAutoscrollTimer() 255 void AutoscrollController::startAutoscrollTimer()
256 { 256 {
257 m_autoscrollTimer.startRepeating(autoscrollInterval); 257 m_autoscrollTimer.startRepeating(autoscrollInterval);
258 } 258 }
259 259
260 #if OS(WINDOWS) 260 #if OS(WIN)
261 void AutoscrollController::updatePanScrollState(FrameView* view, const IntPoint& lastKnownMousePosition) 261 void AutoscrollController::updatePanScrollState(FrameView* view, const IntPoint& lastKnownMousePosition)
262 { 262 {
263 // At the original click location we draw a 4 arrowed icon. Over this icon t here won't be any scroll 263 // At the original click location we draw a 4 arrowed icon. Over this icon t here won't be any scroll
264 // So we don't want to change the cursor over this area 264 // So we don't want to change the cursor over this area
265 bool east = m_panScrollStartPos.x() < (lastKnownMousePosition.x() - ScrollVi ew::noPanScrollRadius); 265 bool east = m_panScrollStartPos.x() < (lastKnownMousePosition.x() - ScrollVi ew::noPanScrollRadius);
266 bool west = m_panScrollStartPos.x() > (lastKnownMousePosition.x() + ScrollVi ew::noPanScrollRadius); 266 bool west = m_panScrollStartPos.x() > (lastKnownMousePosition.x() + ScrollVi ew::noPanScrollRadius);
267 bool north = m_panScrollStartPos.y() > (lastKnownMousePosition.y() + ScrollV iew::noPanScrollRadius); 267 bool north = m_panScrollStartPos.y() > (lastKnownMousePosition.y() + ScrollV iew::noPanScrollRadius);
268 bool south = m_panScrollStartPos.y() < (lastKnownMousePosition.y() - ScrollV iew::noPanScrollRadius); 268 bool south = m_panScrollStartPos.y() < (lastKnownMousePosition.y() - ScrollV iew::noPanScrollRadius);
269 269
270 if (m_autoscrollType == AutoscrollForPan && (east || west || north || south) ) 270 if (m_autoscrollType == AutoscrollForPan && (east || west || north || south) )
(...skipping 16 matching lines...) Expand all
287 } else if (east) 287 } else if (east)
288 view->setCursor(eastPanningCursor()); 288 view->setCursor(eastPanningCursor());
289 else if (west) 289 else if (west)
290 view->setCursor(westPanningCursor()); 290 view->setCursor(westPanningCursor());
291 else 291 else
292 view->setCursor(middlePanningCursor()); 292 view->setCursor(middlePanningCursor());
293 } 293 }
294 #endif 294 #endif
295 295
296 } // namespace WebCore 296 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/AutoscrollController.h ('k') | Source/core/page/DragController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698