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

Side by Side Diff: Source/core/layout/LayoutMediaControls.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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 | « Source/core/layout/LayoutMediaControls.h ('k') | Source/core/layout/LayoutMenuList.h » ('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) 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay"); 123 static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay");
124 return paintMediaButton(paintInfo.context, rect, mediaOverlayPlay); 124 return paintMediaButton(paintInfo.context, rect, mediaOverlayPlay);
125 } 125 }
126 126
127 static Image* getMediaSliderThumb() 127 static Image* getMediaSliderThumb()
128 { 128 {
129 static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb"); 129 static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb");
130 return mediaSliderThumb; 130 return mediaSliderThumb;
131 } 131 }
132 132
133 static void paintRoundedSliderBackground(const IntRect& rect, const LayoutStyle& , GraphicsContext* context) 133 static void paintRoundedSliderBackground(const IntRect& rect, const ComputedStyl e&, GraphicsContext* context)
134 { 134 {
135 int borderRadius = rect.height() / 2; 135 int borderRadius = rect.height() / 2;
136 IntSize radii(borderRadius, borderRadius); 136 IntSize radii(borderRadius, borderRadius);
137 Color sliderBackgroundColor = Color(11, 11, 11); 137 Color sliderBackgroundColor = Color(11, 11, 11);
138 context->fillRoundedRect(rect, radii, radii, radii, radii, sliderBackgroundC olor); 138 context->fillRoundedRect(rect, radii, radii, radii, radii, sliderBackgroundC olor);
139 } 139 }
140 140
141 static void paintSliderRangeHighlight(const IntRect& rect, const LayoutStyle& st yle, GraphicsContext* context, int startPosition, int endPosition, Color startCo lor, Color endColor) 141 static void paintSliderRangeHighlight(const IntRect& rect, const ComputedStyle& style, GraphicsContext* context, int startPosition, int endPosition, Color start Color, Color endColor)
142 { 142 {
143 // Calculate border radius; need to avoid being smaller than half the slider height 143 // Calculate border radius; need to avoid being smaller than half the slider height
144 // because of https://bugs.webkit.org/show_bug.cgi?id=30143. 144 // because of https://bugs.webkit.org/show_bug.cgi?id=30143.
145 int borderRadius = rect.height() / 2; 145 int borderRadius = rect.height() / 2;
146 IntSize radii(borderRadius, borderRadius); 146 IntSize radii(borderRadius, borderRadius);
147 147
148 // Calculate highlight rectangle and edge dimensions. 148 // Calculate highlight rectangle and edge dimensions.
149 int startOffset = startPosition; 149 int startOffset = startPosition;
150 int endOffset = rect.width() - endPosition; 150 int endOffset = rect.width() - endPosition;
151 int rangeWidth = endPosition - startPosition; 151 int rangeWidth = endPosition - startPosition;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 193 }
194 194
195 const int mediaSliderThumbWidth = 32; 195 const int mediaSliderThumbWidth = 32;
196 196
197 static bool paintMediaSlider(LayoutObject* object, const PaintInfo& paintInfo, c onst IntRect& rect) 197 static bool paintMediaSlider(LayoutObject* object, const PaintInfo& paintInfo, c onst IntRect& rect)
198 { 198 {
199 HTMLMediaElement* mediaElement = toParentMediaElement(object); 199 HTMLMediaElement* mediaElement = toParentMediaElement(object);
200 if (!mediaElement) 200 if (!mediaElement)
201 return false; 201 return false;
202 202
203 const LayoutStyle& style = object->styleRef(); 203 const ComputedStyle& style = object->styleRef();
204 GraphicsContext* context = paintInfo.context; 204 GraphicsContext* context = paintInfo.context;
205 205
206 paintRoundedSliderBackground(rect, style, context); 206 paintRoundedSliderBackground(rect, style, context);
207 207
208 // Draw the buffered range. Since the element may have multiple buffered ran ges and it'd be 208 // Draw the buffered range. Since the element may have multiple buffered ran ges and it'd be
209 // distracting/'busy' to show all of them, show only the buffered range cont aining the current play head. 209 // distracting/'busy' to show all of them, show only the buffered range cont aining the current play head.
210 RefPtrWillBeRawPtr<TimeRanges> bufferedTimeRanges = mediaElement->buffered() ; 210 RefPtrWillBeRawPtr<TimeRanges> bufferedTimeRanges = mediaElement->buffered() ;
211 float duration = mediaElement->duration(); 211 float duration = mediaElement->duration();
212 float currentTime = mediaElement->currentTime(); 212 float currentTime = mediaElement->currentTime();
213 if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan( currentTime)) 213 if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan( currentTime))
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 272
273 const int mediaVolumeSliderThumbWidth = 24; 273 const int mediaVolumeSliderThumbWidth = 24;
274 274
275 static bool paintMediaVolumeSlider(LayoutObject* object, const PaintInfo& paintI nfo, const IntRect& rect) 275 static bool paintMediaVolumeSlider(LayoutObject* object, const PaintInfo& paintI nfo, const IntRect& rect)
276 { 276 {
277 HTMLMediaElement* mediaElement = toParentMediaElement(object); 277 HTMLMediaElement* mediaElement = toParentMediaElement(object);
278 if (!mediaElement) 278 if (!mediaElement)
279 return false; 279 return false;
280 280
281 GraphicsContext* context = paintInfo.context; 281 GraphicsContext* context = paintInfo.context;
282 const LayoutStyle& style = object->styleRef(); 282 const ComputedStyle& style = object->styleRef();
283 283
284 paintRoundedSliderBackground(rect, style, context); 284 paintRoundedSliderBackground(rect, style, context);
285 285
286 // Calculate volume position for white background rectangle. 286 // Calculate volume position for white background rectangle.
287 float volume = mediaElement->volume(); 287 float volume = mediaElement->volume();
288 if (std::isnan(volume) || volume < 0) 288 if (std::isnan(volume) || volume < 0)
289 return true; 289 return true;
290 if (volume > 1) 290 if (volume > 1)
291 volume = 1; 291 volume = 1;
292 if (!hasSource(mediaElement) || !mediaElement->hasAudio() || mediaElement->m uted()) 292 if (!hasSource(mediaElement) || !mediaElement->hasAudio() || mediaElement->m uted())
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 case MediaFullScreenVolumeSliderThumb: 414 case MediaFullScreenVolumeSliderThumb:
415 ASSERT_NOT_REACHED(); 415 ASSERT_NOT_REACHED();
416 break; 416 break;
417 } 417 }
418 return false; 418 return false;
419 } 419 }
420 420
421 const int mediaSliderThumbHeight = 24; 421 const int mediaSliderThumbHeight = 24;
422 const int mediaVolumeSliderThumbHeight = 24; 422 const int mediaVolumeSliderThumbHeight = 24;
423 423
424 void LayoutMediaControls::adjustMediaSliderThumbSize(LayoutStyle& style) 424 void LayoutMediaControls::adjustMediaSliderThumbSize(ComputedStyle& style)
425 { 425 {
426 static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb"); 426 static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb");
427 static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSl iderThumb"); 427 static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSl iderThumb");
428 int width = 0; 428 int width = 0;
429 int height = 0; 429 int height = 0;
430 430
431 Image* thumbImage = 0; 431 Image* thumbImage = 0;
432 if (style.appearance() == MediaSliderThumbPart) { 432 if (style.appearance() == MediaSliderThumbPart) {
433 thumbImage = mediaSliderThumb; 433 thumbImage = mediaSliderThumb;
434 width = mediaSliderThumbWidth; 434 width = mediaSliderThumbWidth;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 { 474 {
475 return formatChromiumMediaControlsTime(time, time); 475 return formatChromiumMediaControlsTime(time, time);
476 } 476 }
477 477
478 String LayoutMediaControls::formatMediaControlsCurrentTime(float currentTime, fl oat duration) 478 String LayoutMediaControls::formatMediaControlsCurrentTime(float currentTime, fl oat duration)
479 { 479 {
480 return formatChromiumMediaControlsTime(currentTime, duration); 480 return formatChromiumMediaControlsTime(currentTime, duration);
481 } 481 }
482 482
483 } // namespace blink 483 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutMediaControls.h ('k') | Source/core/layout/LayoutMenuList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698