Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 makeOpaque(); | 184 makeOpaque(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void MediaControls::show() | 187 void MediaControls::show() |
| 188 { | 188 { |
| 189 makeOpaque(); | 189 makeOpaque(); |
| 190 m_panel->setIsDisplayed(true); | 190 m_panel->setIsDisplayed(true); |
| 191 m_panel->show(); | 191 m_panel->show(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void MediaControls::mediaElementFocused() | |
| 195 { | |
| 196 show(); | |
|
acolwell GONE FROM CHROMIUM
2014/05/22 00:31:17
Should we have a stopHideMediaControlsTimer() call
fs
2014/05/22 15:48:45
Probably makes sense. Added.
| |
| 197 } | |
| 198 | |
| 194 void MediaControls::hide() | 199 void MediaControls::hide() |
| 195 { | 200 { |
| 196 m_panel->setIsDisplayed(false); | 201 m_panel->setIsDisplayed(false); |
| 197 m_panel->hide(); | 202 m_panel->hide(); |
| 198 } | 203 } |
| 199 | 204 |
| 200 void MediaControls::makeOpaque() | 205 void MediaControls::makeOpaque() |
| 201 { | 206 { |
| 202 m_panel->makeOpaque(); | 207 m_panel->makeOpaque(); |
| 203 } | 208 } |
| 204 | 209 |
| 205 void MediaControls::makeTransparent() | 210 void MediaControls::makeTransparent() |
| 206 { | 211 { |
| 207 m_panel->makeTransparent(); | 212 m_panel->makeTransparent(); |
| 208 } | 213 } |
| 209 | 214 |
| 210 bool MediaControls::shouldHideMediaControls() | 215 bool MediaControls::shouldHideMediaControls() |
| 211 { | 216 { |
| 212 return !m_panel->hovered(); | 217 return !m_panel->hovered(); |
| 213 } | 218 } |
| 214 | 219 |
| 220 bool MediaControls::shouldShowMediaControls() const | |
| 221 { | |
| 222 if (m_isMouseOverControls) | |
| 223 return true; | |
| 224 // Check for 'focus' on the HTMLMediaElement and within the controls/shadow | |
| 225 // tree separately (to avoid going through all the potential ancestor hosts | |
| 226 // for the focused element.) | |
| 227 return mediaElement().focused() || contains(document().focusedElement()); | |
| 228 } | |
| 229 | |
| 215 void MediaControls::playbackStarted() | 230 void MediaControls::playbackStarted() |
| 216 { | 231 { |
| 217 m_currentTimeDisplay->show(); | 232 m_currentTimeDisplay->show(); |
| 218 m_durationDisplay->hide(); | 233 m_durationDisplay->hide(); |
| 219 | 234 |
| 220 updatePlayState(); | 235 updatePlayState(); |
| 221 m_timeline->setPosition(mediaElement().currentTime()); | 236 m_timeline->setPosition(mediaElement().currentTime()); |
| 222 updateCurrentTimeDisplay(); | 237 updateCurrentTimeDisplay(); |
| 223 | 238 |
| 224 startHideMediaControlsTimer(); | 239 startHideMediaControlsTimer(); |
| 225 } | 240 } |
| 226 | 241 |
| 227 void MediaControls::playbackProgressed() | 242 void MediaControls::playbackProgressed() |
| 228 { | 243 { |
| 229 m_timeline->setPosition(mediaElement().currentTime()); | 244 m_timeline->setPosition(mediaElement().currentTime()); |
| 230 updateCurrentTimeDisplay(); | 245 updateCurrentTimeDisplay(); |
| 231 | 246 |
| 232 if (!m_isMouseOverControls && mediaElement().hasVideo()) | 247 if (mediaElement().hasVideo() && !shouldShowMediaControls()) |
|
acolwell GONE FROM CHROMIUM
2014/05/22 00:31:17
!shouldShowMediaControls() conceptually seems like
fs
2014/05/22 15:48:45
I integrated should_Show_MediaControls in should_H
| |
| 233 makeTransparent(); | 248 makeTransparent(); |
| 234 } | 249 } |
| 235 | 250 |
| 236 void MediaControls::playbackStopped() | 251 void MediaControls::playbackStopped() |
| 237 { | 252 { |
| 238 updatePlayState(); | 253 updatePlayState(); |
| 239 m_timeline->setPosition(mediaElement().currentTime()); | 254 m_timeline->setPosition(mediaElement().currentTime()); |
| 240 updateCurrentTimeDisplay(); | 255 updateCurrentTimeDisplay(); |
| 241 makeOpaque(); | 256 makeOpaque(); |
| 242 | 257 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 432 | 447 |
| 433 void MediaControls::updateTextTrackDisplay() | 448 void MediaControls::updateTextTrackDisplay() |
| 434 { | 449 { |
| 435 if (!m_textDisplayContainer) | 450 if (!m_textDisplayContainer) |
| 436 createTextTrackDisplay(); | 451 createTextTrackDisplay(); |
| 437 | 452 |
| 438 m_textDisplayContainer->updateDisplay(); | 453 m_textDisplayContainer->updateDisplay(); |
| 439 } | 454 } |
| 440 | 455 |
| 441 } | 456 } |
| OLD | NEW |