| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 minutes = seconds / 60; |
| 239 int minutes = (seconds / 60) % 60; | 239 |
| 240 seconds %= 60; | 240 seconds %= 60; |
| 241 | 241 |
| 242 // duration defines the format of how the time is rendered | 242 // duration defines the format of how the time is rendered |
| 243 int durationSecs = static_cast<int>(fabsf(duration)); | 243 int durationSecs = static_cast<int>(fabsf(duration)); |
| 244 int durationHours = durationSecs / (60 * 60); | 244 int durationMins = durationSecs / 60; |
| 245 int durationMins = (durationSecs / 60) % 60; | |
| 246 | 245 |
| 247 if (durationHours || hours) | 246 if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) { |
| 248 return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours,
minutes, seconds); | 247 int hours = seconds / (60 * 60); |
| 249 if (durationMins > 9) | 248 int durationHours = durationSecs / (60 * 60); |
| 250 return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, sec
onds); | 249 durationMins %= 60; |
| 250 minutes %= 60; |
| 251 if (durationHours || hours) |
| 252 return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hou
rs, minutes, seconds); |
| 253 if (durationMins > 9) |
| 254 return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes,
seconds); |
| 251 | 255 |
| 252 return String::format("%s%01d:%02d", (time < 0 ? "-" : ""), minutes, seconds
); | 256 return String::format("%s%01d:%02d", (time < 0 ? "-" : ""), minutes, sec
onds); |
| 257 } |
| 258 |
| 259 // New UI includes a leading "/ " before duration. |
| 260 const char* separator = includeSeparator ? "/ " : ""; |
| 261 |
| 262 // 0-9 minutes duration is 0:00 |
| 263 // 10-60 minutes duration is 00:00 |
| 264 // >60 minutes duration is 000:00 |
| 265 if (durationMins > 60 || minutes > 60) |
| 266 return String::format("%s%s%03d:%02d", separator, (time < 0 ? "-" : ""),
minutes, seconds); |
| 267 if (durationMins > 10) |
| 268 return String::format("%s%s%02d:%02d", separator, (time < 0 ? "-" : ""),
minutes, seconds); |
| 269 |
| 270 return String::format("%s%s%01d:%02d", separator, (time < 0 ? "-" : ""), min
utes, seconds); |
| 253 } | 271 } |
| 254 | 272 |
| 255 String LayoutTheme::formatMediaControlsTime(float time) const | 273 String LayoutTheme::formatMediaControlsTime(float time) const |
| 256 { | 274 { |
| 257 return formatChromiumMediaControlsTime(time, time); | 275 return formatChromiumMediaControlsTime(time, time, true); |
| 258 } | 276 } |
| 259 | 277 |
| 260 String LayoutTheme::formatMediaControlsCurrentTime(float currentTime, float dura
tion) const | 278 String LayoutTheme::formatMediaControlsCurrentTime(float currentTime, float dura
tion) const |
| 261 { | 279 { |
| 262 return formatChromiumMediaControlsTime(currentTime, duration); | 280 return formatChromiumMediaControlsTime(currentTime, duration, false); |
| 263 } | 281 } |
| 264 | 282 |
| 265 Color LayoutTheme::activeSelectionBackgroundColor() const | 283 Color LayoutTheme::activeSelectionBackgroundColor() const |
| 266 { | 284 { |
| 267 return platformActiveSelectionBackgroundColor().blendWithWhite(); | 285 return platformActiveSelectionBackgroundColor().blendWithWhite(); |
| 268 } | 286 } |
| 269 | 287 |
| 270 Color LayoutTheme::inactiveSelectionBackgroundColor() const | 288 Color LayoutTheme::inactiveSelectionBackgroundColor() const |
| 271 { | 289 { |
| 272 return platformInactiveSelectionBackgroundColor().blendWithWhite(); | 290 return platformInactiveSelectionBackgroundColor().blendWithWhite(); |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 | 946 |
| 929 // padding - not honored by WinIE, needs to be removed. | 947 // padding - not honored by WinIE, needs to be removed. |
| 930 style.resetPadding(); | 948 style.resetPadding(); |
| 931 | 949 |
| 932 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 950 // 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. | 951 // for now, we will not honor it. |
| 934 style.resetBorder(); | 952 style.resetBorder(); |
| 935 } | 953 } |
| 936 | 954 |
| 937 } // namespace blink | 955 } // namespace blink |
| OLD | NEW |