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

Side by Side Diff: Source/core/rendering/RenderMediaControls.cpp

Issue 556453007: Make slider thumb painting bail out when the node is null. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/media/controls-slider-appearance-crash-expected.txt ('k') | 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) 2009 Apple Inc. 2 * Copyright (C) 2009 Apple Inc.
3 * Copyright (C) 2009 Google Inc. 3 * Copyright (C) 2009 Google Inc.
4 * All rights reserved. 4 * All rights reserved.
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 paintSliderRangeHighlight(rect, style, context, currentPosition, end Position, startColor, endColor); 239 paintSliderRangeHighlight(rect, style, context, currentPosition, end Position, startColor, endColor);
240 240
241 return true; 241 return true;
242 } 242 }
243 243
244 return true; 244 return true;
245 } 245 }
246 246
247 static bool paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintIn fo, const IntRect& rect) 247 static bool paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintIn fo, const IntRect& rect)
248 { 248 {
249 ASSERT(object->node()); 249 if (!object->node())
250 return false;
251
250 HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadow Host()); 252 HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadow Host());
251 if (!mediaElement) 253 if (!mediaElement)
252 return false; 254 return false;
253 255
254 if (!hasSource(mediaElement)) 256 if (!hasSource(mediaElement))
255 return true; 257 return true;
256 258
257 Image* mediaSliderThumb = getMediaSliderThumb(); 259 Image* mediaSliderThumb = getMediaSliderThumb();
258 return paintMediaButton(paintInfo.context, rect, mediaSliderThumb); 260 return paintMediaButton(paintInfo.context, rect, mediaSliderThumb);
259 } 261 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 Color startColor = Color(195, 195, 195); 294 Color startColor = Color(195, 195, 195);
293 Color endColor = Color(217, 217, 217); 295 Color endColor = Color(217, 217, 217);
294 296
295 paintSliderRangeHighlight(rect, style, context, 0.0, fillWidth, startColor, endColor); 297 paintSliderRangeHighlight(rect, style, context, 0.0, fillWidth, startColor, endColor);
296 298
297 return true; 299 return true;
298 } 300 }
299 301
300 static bool paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& p aintInfo, const IntRect& rect) 302 static bool paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& p aintInfo, const IntRect& rect)
301 { 303 {
302 ASSERT(object->node()); 304 if (!object->node())
305 return false;
306
303 HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadow Host()); 307 HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadow Host());
304 if (!mediaElement) 308 if (!mediaElement)
305 return false; 309 return false;
306 310
307 if (!hasSource(mediaElement) || !mediaElement->hasAudio()) 311 if (!hasSource(mediaElement) || !mediaElement->hasAudio())
308 return true; 312 return true;
309 313
310 static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSl iderThumb"); 314 static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSl iderThumb");
311 return paintMediaButton(paintInfo.context, rect, mediaVolumeSliderThumb); 315 return paintMediaButton(paintInfo.context, rect, mediaVolumeSliderThumb);
312 } 316 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 { 438 {
435 return formatChromiumMediaControlsTime(time, time); 439 return formatChromiumMediaControlsTime(time, time);
436 } 440 }
437 441
438 String RenderMediaControls::formatMediaControlsCurrentTime(float currentTime, fl oat duration) 442 String RenderMediaControls::formatMediaControlsCurrentTime(float currentTime, fl oat duration)
439 { 443 {
440 return formatChromiumMediaControlsTime(currentTime, duration); 444 return formatChromiumMediaControlsTime(currentTime, duration);
441 } 445 }
442 446
443 } // namespace blink 447 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/media/controls-slider-appearance-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698