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

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

Issue 2316113003: Check frame for nullptr in AutoscrollController::animate (Closed)
Patch Set: Complete the solution Created 4 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 | « no previous file | no next file » | 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 // FIXME: This would get get better animation fidelity if it used the monotonicF rameBeginTime instead 235 // FIXME: This would get get better animation fidelity if it used the monotonicF rameBeginTime instead
236 // of WTF::currentTime(). 236 // of WTF::currentTime().
237 void AutoscrollController::animate(double) 237 void AutoscrollController::animate(double)
238 { 238 {
239 if (!m_autoscrollLayoutObject) { 239 if (!m_autoscrollLayoutObject) {
240 stopAutoscroll(); 240 stopAutoscroll();
241 return; 241 return;
242 } 242 }
243 243
244 EventHandler& eventHandler = m_autoscrollLayoutObject->frame()->eventHandler ();
dtapuska 2016/09/08 14:13:20 I was kind of anticipating a change like LocalFra
245 switch (m_autoscrollType) { 244 switch (m_autoscrollType) {
246 case AutoscrollForDragAndDrop: 245 case AutoscrollForDragAndDrop:
247 if (WTF::currentTime() - m_dragAndDropAutoscrollStartTime > autoscrollDe lay) 246 if (WTF::currentTime() - m_dragAndDropAutoscrollStartTime > autoscrollDe lay)
248 m_autoscrollLayoutObject->autoscroll(m_dragAndDropAutoscrollReferenc ePosition); 247 m_autoscrollLayoutObject->autoscroll(m_dragAndDropAutoscrollReferenc ePosition);
249 break; 248 break;
250 case AutoscrollForSelection: 249 case AutoscrollForSelection:
251 if (!eventHandler.mousePressed()) { 250 if (LocalFrame* frame = m_autoscrollLayoutObject->frame()) {
252 stopAutoscroll(); 251 EventHandler& eventHandler = frame->eventHandler();
253 return; 252 if (!eventHandler.mousePressed()) {
253 stopAutoscroll();
254 return;
255 }
256 eventHandler.updateSelectionForMouseDrag();
257 m_autoscrollLayoutObject->autoscroll(eventHandler.lastKnownMousePosi tion());
254 } 258 }
255 eventHandler.updateSelectionForMouseDrag();
256 m_autoscrollLayoutObject->autoscroll(eventHandler.lastKnownMousePosition ());
257 break; 259 break;
258 case NoAutoscroll: 260 case NoAutoscroll:
259 break; 261 break;
260 #if OS(WIN) 262 #if OS(WIN)
261 case AutoscrollForPanCanStop: 263 case AutoscrollForPanCanStop:
262 case AutoscrollForPan: 264 case AutoscrollForPan:
263 if (!panScrollInProgress()) { 265 if (!panScrollInProgress()) {
264 stopAutoscroll(); 266 stopAutoscroll();
265 return; 267 return;
266 } 268 }
267 if (FrameView* view = m_autoscrollLayoutObject->frame()->view()) 269 if (LocalFrame* frame = m_autoscrollLayoutObject->frame()) {
268 updatePanScrollState(view, eventHandler.lastKnownMousePosition()); 270 if (FrameView* view = frame->view()) {
271 EventHandler& eventHandler = frame->eventHandler();
272 updatePanScrollState(view, eventHandler.lastKnownMousePosition() );
273 }
274 }
269 m_autoscrollLayoutObject->panScroll(m_panScrollStartPos); 275 m_autoscrollLayoutObject->panScroll(m_panScrollStartPos);
270 break; 276 break;
271 #endif 277 #endif
272 } 278 }
273 if (m_autoscrollType != NoAutoscroll && m_autoscrollLayoutObject) 279 if (m_autoscrollType != NoAutoscroll && m_autoscrollLayoutObject)
274 m_page->chromeClient().scheduleAnimation(m_autoscrollLayoutObject->frame ()->view()); 280 m_page->chromeClient().scheduleAnimation(m_autoscrollLayoutObject->frame ()->view());
275 } 281 }
276 282
277 void AutoscrollController::startAutoscroll() 283 void AutoscrollController::startAutoscroll()
278 { 284 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 view->setCursor(eastPanningCursor()); 316 view->setCursor(eastPanningCursor());
311 } else if (west) { 317 } else if (west) {
312 view->setCursor(westPanningCursor()); 318 view->setCursor(westPanningCursor());
313 } else { 319 } else {
314 view->setCursor(middlePanningCursor()); 320 view->setCursor(middlePanningCursor());
315 } 321 }
316 } 322 }
317 #endif 323 #endif
318 324
319 } // namespace blink 325 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698