| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
| 3 * reserved. | 3 * 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 21 matching lines...) Expand all Loading... |
| 32 #include "bindings/core/v8/ScriptController.h" | 32 #include "bindings/core/v8/ScriptController.h" |
| 33 #include "bindings/core/v8/ScriptEventListener.h" | 33 #include "bindings/core/v8/ScriptEventListener.h" |
| 34 #include "bindings/core/v8/ScriptPromiseResolver.h" | 34 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 35 #include "core/HTMLNames.h" | 35 #include "core/HTMLNames.h" |
| 36 #include "core/css/MediaList.h" | 36 #include "core/css/MediaList.h" |
| 37 #include "core/dom/Attribute.h" | 37 #include "core/dom/Attribute.h" |
| 38 #include "core/dom/DOMException.h" | 38 #include "core/dom/DOMException.h" |
| 39 #include "core/dom/ElementTraversal.h" | 39 #include "core/dom/ElementTraversal.h" |
| 40 #include "core/dom/ElementVisibilityObserver.h" | 40 #include "core/dom/ElementVisibilityObserver.h" |
| 41 #include "core/dom/Fullscreen.h" | 41 #include "core/dom/Fullscreen.h" |
| 42 #include "core/dom/IntersectionGeometry.h" |
| 42 #include "core/dom/TaskRunnerHelper.h" | 43 #include "core/dom/TaskRunnerHelper.h" |
| 43 #include "core/dom/shadow/ShadowRoot.h" | 44 #include "core/dom/shadow/ShadowRoot.h" |
| 44 #include "core/events/Event.h" | 45 #include "core/events/Event.h" |
| 45 #include "core/frame/FrameView.h" | 46 #include "core/frame/FrameView.h" |
| 46 #include "core/frame/LocalFrame.h" | 47 #include "core/frame/LocalFrame.h" |
| 47 #include "core/frame/Settings.h" | 48 #include "core/frame/Settings.h" |
| 48 #include "core/frame/UseCounter.h" | 49 #include "core/frame/UseCounter.h" |
| 49 #include "core/frame/csp/ContentSecurityPolicy.h" | 50 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 50 #include "core/html/AutoplayUmaHelper.h" | 51 #include "core/html/AutoplayUmaHelper.h" |
| 51 #include "core/html/HTMLMediaSource.h" | 52 #include "core/html/HTMLMediaSource.h" |
| (...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2497 void HTMLMediaElement::startPlaybackProgressTimer() { | 2498 void HTMLMediaElement::startPlaybackProgressTimer() { |
| 2498 if (m_playbackProgressTimer.isActive()) | 2499 if (m_playbackProgressTimer.isActive()) |
| 2499 return; | 2500 return; |
| 2500 | 2501 |
| 2501 m_previousProgressTime = WTF::currentTime(); | 2502 m_previousProgressTime = WTF::currentTime(); |
| 2502 m_playbackProgressTimer.startRepeating(maxTimeupdateEventFrequency, | 2503 m_playbackProgressTimer.startRepeating(maxTimeupdateEventFrequency, |
| 2503 BLINK_FROM_HERE); | 2504 BLINK_FROM_HERE); |
| 2504 } | 2505 } |
| 2505 | 2506 |
| 2506 void HTMLMediaElement::playbackProgressTimerFired(TimerBase*) { | 2507 void HTMLMediaElement::playbackProgressTimerFired(TimerBase*) { |
| 2508 if (m_webMediaPlayer) { |
| 2509 // Check whether the intersection with viewport has changed. |
| 2510 ExecutionContext* context = getExecutionContext(); |
| 2511 DCHECK(context->isDocument()); |
| 2512 Document& document = toDocument(*context); |
| 2513 IntersectionGeometry geometry(&document, this, Vector<Length>(), true); |
| 2514 geometry.computeGeometry(); |
| 2515 WebRect intersectRect = geometry.intersectionIntRect(); |
| 2516 if (m_currentViewportIntersection.intersectRect != intersectRect) { |
| 2517 m_currentViewportIntersection.intersectRect = intersectRect; |
| 2518 m_currentViewportIntersection.rootRect = geometry.rootIntRect(); |
| 2519 m_webMediaPlayer->viewportIntersectionChanged( |
| 2520 m_currentViewportIntersection); |
| 2521 } |
| 2522 } |
| 2523 |
| 2507 if (!std::isnan(m_fragmentEndTime) && currentTime() >= m_fragmentEndTime && | 2524 if (!std::isnan(m_fragmentEndTime) && currentTime() >= m_fragmentEndTime && |
| 2508 getDirectionOfPlayback() == Forward) { | 2525 getDirectionOfPlayback() == Forward) { |
| 2509 m_fragmentEndTime = std::numeric_limits<double>::quiet_NaN(); | 2526 m_fragmentEndTime = std::numeric_limits<double>::quiet_NaN(); |
| 2510 if (!m_paused) { | 2527 if (!m_paused) { |
| 2511 UseCounter::count(document(), | 2528 UseCounter::count(document(), |
| 2512 UseCounter::HTMLMediaElementPauseAtFragmentEnd); | 2529 UseCounter::HTMLMediaElementPauseAtFragmentEnd); |
| 2513 // changes paused to true and fires a simple event named pause at the | 2530 // changes paused to true and fires a simple event named pause at the |
| 2514 // media element. | 2531 // media element. |
| 2515 pauseInternal(); | 2532 pauseInternal(); |
| 2516 } | 2533 } |
| (...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4187 | 4204 |
| 4188 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() | 4205 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() |
| 4189 const { | 4206 const { |
| 4190 IntRect result; | 4207 IntRect result; |
| 4191 if (LayoutObject* object = m_element->layoutObject()) | 4208 if (LayoutObject* object = m_element->layoutObject()) |
| 4192 result = object->absoluteBoundingBoxRect(); | 4209 result = object->absoluteBoundingBoxRect(); |
| 4193 return result; | 4210 return result; |
| 4194 } | 4211 } |
| 4195 | 4212 |
| 4196 } // namespace blink | 4213 } // namespace blink |
| OLD | NEW |