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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTheme.cpp

Issue 1369763002: Fix media element time display for times over an hour. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iterators ftw. Created 5 years, 2 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 | third_party/WebKit/Source/core/layout/LayoutThemeTest.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 * 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 227
228 static String formatChromiumMediaControlsTime(float time, float duration, bool i ncludeSeparator) 228 static String formatChromiumMediaControlsTime(float time, float duration, bool i ncludeSeparator)
229 { 229 {
230 if (!std::isfinite(time)) 230 if (!std::isfinite(time))
231 time = 0; 231 time = 0;
232 if (!std::isfinite(duration)) 232 if (!std::isfinite(duration))
233 duration = 0; 233 duration = 0;
234 int seconds = static_cast<int>(fabsf(time)); 234 int seconds = static_cast<int>(fabsf(time));
235 int minutes = seconds / 60; 235 int minutes = seconds / 60;
236 int hours = seconds / (60 * 60);
236 237
237 seconds %= 60; 238 seconds %= 60;
238 239
239 // duration defines the format of how the time is rendered 240 // duration defines the format of how the time is rendered
240 int durationSecs = static_cast<int>(fabsf(duration)); 241 int durationSecs = static_cast<int>(fabsf(duration));
241 int durationMins = durationSecs / 60; 242 int durationMins = durationSecs / 60;
242 243
243 if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) { 244 if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) {
244 int hours = seconds / (60 * 60);
245 int durationHours = durationSecs / (60 * 60); 245 int durationHours = durationSecs / (60 * 60);
246 durationMins %= 60; 246 durationMins %= 60;
247 minutes %= 60; 247 minutes %= 60;
248 if (durationHours || hours) 248 if (durationHours || hours)
249 return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hou rs, minutes, seconds); 249 return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hou rs, minutes, seconds);
250 if (durationMins > 9) 250 if (durationMins > 9)
251 return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds); 251 return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds);
252 252
253 return String::format("%s%01d:%02d", (time < 0 ? "-" : ""), minutes, sec onds); 253 return String::format("%s%01d:%02d", (time < 0 ? "-" : ""), minutes, sec onds);
254 } 254 }
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 937
938 // padding - not honored by WinIE, needs to be removed. 938 // padding - not honored by WinIE, needs to be removed.
939 style.resetPadding(); 939 style.resetPadding();
940 940
941 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme) 941 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme)
942 // for now, we will not honor it. 942 // for now, we will not honor it.
943 style.resetBorder(); 943 style.resetBorder();
944 } 944 }
945 945
946 } // namespace blink 946 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698