| OLD | NEW |
| 1 /** | 1 /** |
| 2 * This file is part of the theme implementation for form controls in WebCore. | 2 * This file is part of the theme implementation for form controls in WebCore. |
| 3 * | 3 * |
| 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. | 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 static String formatChromiumMediaControlsTime(float time, | 262 static String formatChromiumMediaControlsTime(float time, |
| 263 float duration, | 263 float duration, |
| 264 bool includeSeparator) { | 264 bool includeSeparator) { |
| 265 if (!std::isfinite(time)) | 265 if (!std::isfinite(time)) |
| 266 time = 0; | 266 time = 0; |
| 267 if (!std::isfinite(duration)) | 267 if (!std::isfinite(duration)) |
| 268 duration = 0; | 268 duration = 0; |
| 269 int seconds = static_cast<int>(fabsf(time)); | 269 int seconds = static_cast<int>(fabsf(time)); |
| 270 int minutes = seconds / 60; | 270 int minutes = seconds / 60; |
| 271 int hours = seconds / (60 * 60); | |
| 272 | 271 |
| 273 seconds %= 60; | 272 seconds %= 60; |
| 274 | 273 |
| 275 // duration defines the format of how the time is rendered | 274 // duration defines the format of how the time is rendered |
| 276 int durationSecs = static_cast<int>(fabsf(duration)); | 275 int durationSecs = static_cast<int>(fabsf(duration)); |
| 277 int durationMins = durationSecs / 60; | 276 int durationMins = durationSecs / 60; |
| 278 | 277 |
| 279 if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) { | |
| 280 int durationHours = durationSecs / (60 * 60); | |
| 281 durationMins %= 60; | |
| 282 minutes %= 60; | |
| 283 if (durationHours || hours) | |
| 284 return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, | |
| 285 minutes, seconds); | |
| 286 if (durationMins > 9) | |
| 287 return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, | |
| 288 seconds); | |
| 289 | |
| 290 return String::format("%s%01d:%02d", (time < 0 ? "-" : ""), minutes, | |
| 291 seconds); | |
| 292 } | |
| 293 | |
| 294 // New UI includes a leading "/ " before duration. | 278 // New UI includes a leading "/ " before duration. |
| 295 const char* separator = includeSeparator ? "/ " : ""; | 279 const char* separator = includeSeparator ? "/ " : ""; |
| 296 | 280 |
| 297 // 0-9 minutes duration is 0:00 | 281 // 0-9 minutes duration is 0:00 |
| 298 // 10-99 minutes duration is 00:00 | 282 // 10-99 minutes duration is 00:00 |
| 299 // >99 minutes duration is 000:00 | 283 // >99 minutes duration is 000:00 |
| 300 if (durationMins > 99 || minutes > 99) | 284 if (durationMins > 99 || minutes > 99) |
| 301 return String::format("%s%s%03d:%02d", separator, (time < 0 ? "-" : ""), | 285 return String::format("%s%s%03d:%02d", separator, (time < 0 ? "-" : ""), |
| 302 minutes, seconds); | 286 minutes, seconds); |
| 303 if (durationMins > 10) | 287 if (durationMins > 10) |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 // padding - not honored by WinIE, needs to be removed. | 909 // padding - not honored by WinIE, needs to be removed. |
| 926 style.resetPadding(); | 910 style.resetPadding(); |
| 927 | 911 |
| 928 // border - honored by WinIE, but looks terrible (just paints in the control | 912 // border - honored by WinIE, but looks terrible (just paints in the control |
| 929 // box and turns off the Windows XP theme) | 913 // box and turns off the Windows XP theme) |
| 930 // for now, we will not honor it. | 914 // for now, we will not honor it. |
| 931 style.resetBorder(); | 915 style.resetBorder(); |
| 932 } | 916 } |
| 933 | 917 |
| 934 } // namespace blink | 918 } // namespace blink |
| OLD | NEW |