| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 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 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 // Check for autoplay, and record metrics about it if needed. | 1627 // Check for autoplay, and record metrics about it if needed. |
| 1628 if (shouldAutoplay(RecordMetricsBehavior::DoRecord)) { | 1628 if (shouldAutoplay(RecordMetricsBehavior::DoRecord)) { |
| 1629 recordAutoplaySourceMetric(AutoplaySourceAttribute); | 1629 recordAutoplaySourceMetric(AutoplaySourceAttribute); |
| 1630 | 1630 |
| 1631 // If the autoplay experiment says that it's okay to play now, | 1631 // If the autoplay experiment says that it's okay to play now, |
| 1632 // then don't require a user gesture. | 1632 // then don't require a user gesture. |
| 1633 m_autoplayHelper->becameReadyToPlay(); | 1633 m_autoplayHelper->becameReadyToPlay(); |
| 1634 | 1634 |
| 1635 if (!isGestureNeededForPlayback()) { | 1635 if (!isGestureNeededForPlayback()) { |
| 1636 if (isHTMLVideoElement() && muted() && RuntimeEnabledFeatures::a
utoplayMutedVideosEnabled()) { | 1636 if (isHTMLVideoElement() && muted() && RuntimeEnabledFeatures::a
utoplayMutedVideosEnabled()) { |
| 1637 m_autoplayVisibilityObserver = new ElementVisibilityObserver
(this, WTF::bind(&HTMLMediaElement::onVisibilityChangedForAutoplay, wrapPersiste
nt(this))); | 1637 // We might end up in a situation where the previous |
| 1638 m_autoplayVisibilityObserver->start(); | 1638 // observer didn't had time to fire yet. We can avoid |
| 1639 // creating a new one in this case. |
| 1640 if (!m_autoplayVisibilityObserver) { |
| 1641 m_autoplayVisibilityObserver = new ElementVisibilityObse
rver(this, WTF::bind(&HTMLMediaElement::onVisibilityChangedForAutoplay, wrapPers
istent(this))); |
| 1642 m_autoplayVisibilityObserver->start(); |
| 1643 } |
| 1639 } else { | 1644 } else { |
| 1640 m_paused = false; | 1645 m_paused = false; |
| 1641 invalidateCachedTime(); | 1646 invalidateCachedTime(); |
| 1642 scheduleEvent(EventTypeNames::play); | 1647 scheduleEvent(EventTypeNames::play); |
| 1643 scheduleNotifyPlaying(); | 1648 scheduleNotifyPlaying(); |
| 1644 m_autoplaying = false; | 1649 m_autoplaying = false; |
| 1645 } | 1650 } |
| 1646 } | 1651 } |
| 1647 } | 1652 } |
| 1648 | 1653 |
| (...skipping 2379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4028 | 4033 |
| 4029 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co
nst | 4034 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co
nst |
| 4030 { | 4035 { |
| 4031 IntRect result; | 4036 IntRect result; |
| 4032 if (LayoutObject* object = m_element->layoutObject()) | 4037 if (LayoutObject* object = m_element->layoutObject()) |
| 4033 result = object->absoluteBoundingBoxRect(); | 4038 result = object->absoluteBoundingBoxRect(); |
| 4034 return result; | 4039 return result; |
| 4035 } | 4040 } |
| 4036 | 4041 |
| 4037 } // namespace blink | 4042 } // namespace blink |
| OLD | NEW |