Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 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 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "core/html/shadow/MediaControlElements.h" | 30 #include "core/html/shadow/MediaControlElements.h" |
| 31 | 31 |
| 32 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 32 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 33 #include "core/InputTypeNames.h" | 33 #include "core/InputTypeNames.h" |
| 34 #include "core/dom/ClientRect.h" | 34 #include "core/dom/ClientRect.h" |
| 35 #include "core/dom/shadow/ShadowRoot.h" | 35 #include "core/dom/shadow/ShadowRoot.h" |
| 36 #include "core/events/MouseEvent.h" | 36 #include "core/events/MouseEvent.h" |
| 37 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
| 38 #include "core/html/HTMLMediaSource.h" | |
| 38 #include "core/html/HTMLVideoElement.h" | 39 #include "core/html/HTMLVideoElement.h" |
| 39 #include "core/html/TimeRanges.h" | 40 #include "core/html/TimeRanges.h" |
| 40 #include "core/html/shadow/MediaControls.h" | 41 #include "core/html/shadow/MediaControls.h" |
| 41 #include "core/input/EventHandler.h" | 42 #include "core/input/EventHandler.h" |
| 42 #include "core/layout/LayoutTheme.h" | 43 #include "core/layout/LayoutTheme.h" |
| 43 #include "core/layout/LayoutVideo.h" | 44 #include "core/layout/LayoutVideo.h" |
| 44 #include "core/layout/api/LayoutSliderItem.h" | 45 #include "core/layout/api/LayoutSliderItem.h" |
| 45 #include "platform/Histogram.h" | 46 #include "platform/Histogram.h" |
| 46 #include "platform/RuntimeEnabledFeatures.h" | 47 #include "platform/RuntimeEnabledFeatures.h" |
| 47 | 48 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 RefPtrWillBeRawPtr<MediaControlPlayButtonElement> button = adoptRefWillBeNoo p(new MediaControlPlayButtonElement(mediaControls)); | 278 RefPtrWillBeRawPtr<MediaControlPlayButtonElement> button = adoptRefWillBeNoo p(new MediaControlPlayButtonElement(mediaControls)); |
| 278 button->ensureUserAgentShadowRoot(); | 279 button->ensureUserAgentShadowRoot(); |
| 279 button->setType(InputTypeNames::button); | 280 button->setType(InputTypeNames::button); |
| 280 button->setShadowPseudoId(AtomicString("-webkit-media-controls-play-button", AtomicString::ConstructFromLiteral)); | 281 button->setShadowPseudoId(AtomicString("-webkit-media-controls-play-button", AtomicString::ConstructFromLiteral)); |
| 281 return button.release(); | 282 return button.release(); |
| 282 } | 283 } |
| 283 | 284 |
| 284 void MediaControlPlayButtonElement::defaultEventHandler(Event* event) | 285 void MediaControlPlayButtonElement::defaultEventHandler(Event* event) |
| 285 { | 286 { |
| 286 if (event->type() == EventTypeNames::click) { | 287 if (event->type() == EventTypeNames::click) { |
| 288 // Allow play attempts for plain src= media to force a reload in the err or state. This allows potential | |
| 289 // recovery for transient network and decoder resource issues. | |
| 290 const String& url = mediaElement().currentSrc().getString(); | |
| 291 if (mediaElement().error() && !HTMLMediaElement::isMediaStreamURL(url) & & !HTMLMediaSource::lookup(url)) | |
|
wolenetz
2016/03/24 23:05:04
A web app could have explicitly revoked the MediaS
philipj_slow
2016/03/29 13:24:15
Maybe just gate this on KURL::protocolIsInHTTPFami
DaleCurtis
2016/03/29 21:41:14
Depending on the failure type data/blob URLs may h
| |
| 292 mediaElement().load(); | |
| 293 | |
| 287 mediaElement().togglePlayState(); | 294 mediaElement().togglePlayState(); |
| 288 updateDisplayType(); | 295 updateDisplayType(); |
| 289 event->setDefaultHandled(); | 296 event->setDefaultHandled(); |
| 290 } | 297 } |
| 291 HTMLInputElement::defaultEventHandler(event); | 298 HTMLInputElement::defaultEventHandler(event); |
| 292 } | 299 } |
| 293 | 300 |
| 294 void MediaControlPlayButtonElement::updateDisplayType() | 301 void MediaControlPlayButtonElement::updateDisplayType() |
| 295 { | 302 { |
| 296 setDisplayType(mediaElement().paused() ? MediaPlayButton : MediaPauseButton) ; | 303 setDisplayType(mediaElement().paused() ? MediaPlayButton : MediaPauseButton) ; |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 649 } | 656 } |
| 650 | 657 |
| 651 PassRefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurren tTimeDisplayElement::create(MediaControls& mediaControls) | 658 PassRefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurren tTimeDisplayElement::create(MediaControls& mediaControls) |
| 652 { | 659 { |
| 653 RefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> element = adoptRef WillBeNoop(new MediaControlCurrentTimeDisplayElement(mediaControls)); | 660 RefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> element = adoptRef WillBeNoop(new MediaControlCurrentTimeDisplayElement(mediaControls)); |
| 654 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time -display", AtomicString::ConstructFromLiteral)); | 661 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time -display", AtomicString::ConstructFromLiteral)); |
| 655 return element.release(); | 662 return element.release(); |
| 656 } | 663 } |
| 657 | 664 |
| 658 } // namespace blink | 665 } // namespace blink |
| OLD | NEW |