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

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

Issue 1156993013: New media playback UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: manual rebaseline. Created 5 years, 5 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
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 222
223 String LayoutTheme::extraDefaultStyleSheet() 223 String LayoutTheme::extraDefaultStyleSheet()
224 { 224 {
225 StringBuilder runtimeCSS; 225 StringBuilder runtimeCSS;
226 if (RuntimeEnabledFeatures::contextMenuEnabled()) 226 if (RuntimeEnabledFeatures::contextMenuEnabled())
227 runtimeCSS.appendLiteral("menu[type=\"popup\" i] { display: none; }"); 227 runtimeCSS.appendLiteral("menu[type=\"popup\" i] { display: none; }");
228 return runtimeCSS.toString(); 228 return runtimeCSS.toString();
229 } 229 }
230 230
231 static String formatChromiumMediaControlsTime(float time, float duration) 231 static String formatChromiumMediaControlsTime(float time, float duration, bool i ncludeSeparator)
232 { 232 {
233 if (!std::isfinite(time)) 233 if (!std::isfinite(time))
234 time = 0; 234 time = 0;
235 if (!std::isfinite(duration)) 235 if (!std::isfinite(duration))
236 duration = 0; 236 duration = 0;
237 int seconds = static_cast<int>(fabsf(time)); 237 int seconds = static_cast<int>(fabsf(time));
238 int hours = seconds / (60 * 60); 238 int hours = seconds / (60 * 60);
239 int minutes = (seconds / 60) % 60; 239 int minutes = (seconds / 60);
240 if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled())
241 minutes %= 60;
242
240 seconds %= 60; 243 seconds %= 60;
241 244
242 // duration defines the format of how the time is rendered 245 // duration defines the format of how the time is rendered
243 int durationSecs = static_cast<int>(fabsf(duration)); 246 int durationSecs = static_cast<int>(fabsf(duration));
244 int durationHours = durationSecs / (60 * 60); 247 int durationMins = (durationSecs / 60);
245 int durationMins = (durationSecs / 60) % 60;
246 248
247 if (durationHours || hours) 249 if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) {
248 return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); 250 int durationHours = durationSecs / (60 * 60);
249 if (durationMins > 9) 251 durationMins %= 60;
250 return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, sec onds); 252 if (durationHours || hours)
253 return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hou rs, minutes, seconds);
254 if (durationMins > 9)
255 return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds);
251 256
252 return String::format("%s%01d:%02d", (time < 0 ? "-" : ""), minutes, seconds ); 257 return String::format("%s%01d:%02d", (time < 0 ? "-" : ""), minutes, sec onds);
258 }
259
260 // New UI includes a leading "/ " before duration.
261 const char* separator = (includeSeparator ? "/ " : "");
262
263 // 0-9 minutes duration is 0:00
264 // 10-60 minutes duration is 00:00
265 // >60 minutes duration is 000:00
266 if (durationMins > 60 || minutes > 60)
267 return String::format("%s%s%03d:%02d", separator, (time < 0 ? "-" : ""), minutes, seconds);
268 if (durationMins > 10)
269 return String::format("%s%s%02d:%02d", separator, (time < 0 ? "-" : ""), minutes, seconds);
270
271 return String::format("%s%s%01d:%02d", separator, (time < 0 ? "-" : ""), min utes, seconds);
253 } 272 }
254 273
255 String LayoutTheme::formatMediaControlsTime(float time) const 274 String LayoutTheme::formatMediaControlsTime(float time) const
256 { 275 {
257 return formatChromiumMediaControlsTime(time, time); 276 return formatChromiumMediaControlsTime(time, time, true);
258 } 277 }
259 278
260 String LayoutTheme::formatMediaControlsCurrentTime(float currentTime, float dura tion) const 279 String LayoutTheme::formatMediaControlsCurrentTime(float currentTime, float dura tion) const
261 { 280 {
262 return formatChromiumMediaControlsTime(currentTime, duration); 281 return formatChromiumMediaControlsTime(currentTime, duration, false);
263 } 282 }
264 283
265 Color LayoutTheme::activeSelectionBackgroundColor() const 284 Color LayoutTheme::activeSelectionBackgroundColor() const
266 { 285 {
267 return platformActiveSelectionBackgroundColor().blendWithWhite(); 286 return platformActiveSelectionBackgroundColor().blendWithWhite();
268 } 287 }
269 288
270 Color LayoutTheme::inactiveSelectionBackgroundColor() const 289 Color LayoutTheme::inactiveSelectionBackgroundColor() const
271 { 290 {
272 return platformInactiveSelectionBackgroundColor().blendWithWhite(); 291 return platformInactiveSelectionBackgroundColor().blendWithWhite();
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 947
929 // padding - not honored by WinIE, needs to be removed. 948 // padding - not honored by WinIE, needs to be removed.
930 style.resetPadding(); 949 style.resetPadding();
931 950
932 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme) 951 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme)
933 // for now, we will not honor it. 952 // for now, we will not honor it.
934 style.resetBorder(); 953 style.resetBorder();
935 } 954 }
936 955
937 } // namespace blink 956 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698