Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 { | 478 { |
| 479 ASSERT(element); | 479 ASSERT(element); |
| 480 ASSERT(m_mediaElements.contains(element)); | 480 ASSERT(m_mediaElements.contains(element)); |
| 481 | 481 |
| 482 // When the user agent is to bring a media element up to speed with its new media controller, | 482 // When the user agent is to bring a media element up to speed with its new media controller, |
| 483 // it must seek that media element to the MediaController's media controller position relative | 483 // it must seek that media element to the MediaController's media controller position relative |
| 484 // to the media element's timeline. | 484 // to the media element's timeline. |
| 485 element->seek(currentTime(), IGNORE_EXCEPTION); | 485 element->seek(currentTime(), IGNORE_EXCEPTION); |
| 486 } | 486 } |
| 487 | 487 |
| 488 bool MediaController::isRestrained() const | |
| 489 { | |
| 490 ASSERT(!m_mediaElements.isEmpty()); | |
| 491 | |
| 492 // A MediaController is a restrained media controller if the MediaController is a playing media | |
| 493 // controller, | |
| 494 if (m_paused) | |
| 495 return false; | |
| 496 | |
| 497 bool allPaused = true; | |
| 498 for (size_t index = 0; index < m_mediaElements.size(); ++index) { | |
| 499 HTMLMediaElement* element = m_mediaElements[index]; | |
| 500 | |
| 501 // and none of its slaved media elements are blocked media elements, | |
| 502 if (element->isBlocked()) | |
| 503 return false; | |
| 504 | |
| 505 // but either at least one of its slaved media elements whose autoplayin g flag is true still | |
| 506 // has its paused attribute set to true, | |
| 507 if (element->isAutoplaying() && element->paused()) | |
| 508 return true; | |
| 509 | |
| 510 if (!element->paused()) | |
| 511 allPaused = false; | |
|
acolwell GONE FROM CHROMIUM
2014/03/21 23:30:12
I think you can just return false here and return
philipj_slow
2014/03/23 03:42:49
I had difficulties parsing the spec definition and
| |
| 512 } | |
| 513 | |
| 514 // or, all of its slaved media elements have their paused attribute set to t rue. | |
| 515 return allPaused; | |
| 516 } | |
| 517 | |
| 488 bool MediaController::isBlocked() const | 518 bool MediaController::isBlocked() const |
| 489 { | 519 { |
| 520 ASSERT(!m_mediaElements.isEmpty()); | |
| 521 | |
| 490 // A MediaController is a blocked media controller if the MediaController is a paused media | 522 // A MediaController is a blocked media controller if the MediaController is a paused media |
| 491 // controller, | 523 // controller, |
| 492 if (m_paused) | 524 if (m_paused) |
| 493 return true; | 525 return true; |
| 494 | 526 |
| 495 if (m_mediaElements.isEmpty()) | |
| 496 return false; | |
| 497 | |
| 498 bool allPaused = true; | 527 bool allPaused = true; |
| 499 for (size_t index = 0; index < m_mediaElements.size(); ++index) { | 528 for (size_t index = 0; index < m_mediaElements.size(); ++index) { |
| 500 HTMLMediaElement* element = m_mediaElements[index]; | 529 HTMLMediaElement* element = m_mediaElements[index]; |
| 501 // or if any of its slaved media elements are blocked media elements, | 530 |
| 531 // or if any of its slaved media elements are blocked media elements, | |
| 502 if (element->isBlocked()) | 532 if (element->isBlocked()) |
| 503 return true; | 533 return true; |
| 504 | 534 |
| 505 // or if any of its slaved media elements whose autoplaying flag is true still have their | 535 // or if any of its slaved media elements whose autoplaying flag is true still have their |
| 506 // paused attribute set to true, | 536 // paused attribute set to true, |
| 507 if (element->isAutoplaying() && element->paused()) | 537 if (element->isAutoplaying() && element->paused()) |
| 508 return true; | 538 return true; |
| 509 | 539 |
| 510 if (!element->paused()) | 540 if (!element->paused()) |
| 511 allPaused = false; | 541 allPaused = false; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 { | 649 { |
| 620 double now = WTF::currentTime(); | 650 double now = WTF::currentTime(); |
| 621 double timedelta = now - m_previousTimeupdateTime; | 651 double timedelta = now - m_previousTimeupdateTime; |
| 622 | 652 |
| 623 if (timedelta < maxTimeupdateEventFrequency) | 653 if (timedelta < maxTimeupdateEventFrequency) |
| 624 return; | 654 return; |
| 625 | 655 |
| 626 scheduleEvent(EventTypeNames::timeupdate); | 656 scheduleEvent(EventTypeNames::timeupdate); |
| 627 m_previousTimeupdateTime = now; | 657 m_previousTimeupdateTime = now; |
| 628 } | 658 } |
| OLD | NEW |