Chromium Code Reviews| 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 { | 403 { |
| 404 return true; | 404 return true; |
| 405 } | 405 } |
| 406 | 406 |
| 407 bool HTMLMediaElement::supportsFocus() const | 407 bool HTMLMediaElement::supportsFocus() const |
| 408 { | 408 { |
| 409 if (ownerDocument()->isMediaDocument()) | 409 if (ownerDocument()->isMediaDocument()) |
| 410 return false; | 410 return false; |
| 411 | 411 |
| 412 // If no controls specified, we should still be able to focus the element if it has tabIndex. | 412 // If no controls specified, we should still be able to focus the element if it has tabIndex. |
| 413 return controls() || HTMLElement::supportsFocus(); | 413 return shouldDisplayControls() || HTMLElement::supportsFocus(); |
| 414 } | 414 } |
| 415 | 415 |
| 416 bool HTMLMediaElement::isMouseFocusable() const | 416 bool HTMLMediaElement::isMouseFocusable() const |
| 417 { | 417 { |
| 418 return false; | 418 return false; |
| 419 } | 419 } |
| 420 | 420 |
| 421 void HTMLMediaElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value) | 421 void HTMLMediaElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value) |
| 422 { | 422 { |
| 423 if (name == srcAttr) { | 423 if (name == srcAttr) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 for (Element* child = ElementTraversal::firstWithin(*this); child; child = E lementTraversal::nextSibling(*child)) { | 461 for (Element* child = ElementTraversal::firstWithin(*this); child; child = E lementTraversal::nextSibling(*child)) { |
| 462 if (child->hasTagName(trackTag)) { | 462 if (child->hasTagName(trackTag)) { |
| 463 scheduleDelayedAction(LoadTextTrackResource); | 463 scheduleDelayedAction(LoadTextTrackResource); |
| 464 break; | 464 break; |
| 465 } | 465 } |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 | 468 |
| 469 bool HTMLMediaElement::rendererIsNeeded(const RenderStyle& style) | 469 bool HTMLMediaElement::rendererIsNeeded(const RenderStyle& style) |
| 470 { | 470 { |
| 471 return controls() ? HTMLElement::rendererIsNeeded(style) : false; | 471 return shouldDisplayControls() ? HTMLElement::rendererIsNeeded(style) : fals e; |
| 472 } | 472 } |
| 473 | 473 |
| 474 RenderObject* HTMLMediaElement::createRenderer(RenderStyle*) | 474 RenderObject* HTMLMediaElement::createRenderer(RenderStyle*) |
| 475 { | 475 { |
| 476 return new RenderMedia(this); | 476 return new RenderMedia(this); |
| 477 } | 477 } |
| 478 | 478 |
| 479 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint) | 479 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint) |
| 480 { | 480 { |
| 481 WTF_LOG(Media, "HTMLMediaElement::insertedInto"); | 481 WTF_LOG(Media, "HTMLMediaElement::insertedInto"); |
| (...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2290 } | 2290 } |
| 2291 | 2291 |
| 2292 void HTMLMediaElement::setLoop(bool b) | 2292 void HTMLMediaElement::setLoop(bool b) |
| 2293 { | 2293 { |
| 2294 WTF_LOG(Media, "HTMLMediaElement::setLoop(%s)", boolString(b)); | 2294 WTF_LOG(Media, "HTMLMediaElement::setLoop(%s)", boolString(b)); |
| 2295 setBooleanAttribute(loopAttr, b); | 2295 setBooleanAttribute(loopAttr, b); |
| 2296 } | 2296 } |
| 2297 | 2297 |
| 2298 bool HTMLMediaElement::controls() const | 2298 bool HTMLMediaElement::controls() const |
| 2299 { | 2299 { |
| 2300 return fastHasAttribute(controlsAttr); | |
| 2301 } | |
| 2302 | |
| 2303 bool HTMLMediaElement::shouldDisplayControls() const | |
| 2304 { | |
| 2300 LocalFrame* frame = document().frame(); | 2305 LocalFrame* frame = document().frame(); |
| 2301 | 2306 |
| 2302 // always show controls when scripting is disabled | 2307 // always show controls when scripting is disabled |
| 2303 if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript)) | 2308 if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript)) |
| 2304 return true; | 2309 return true; |
| 2305 | 2310 |
| 2306 // Always show controls when in full screen mode. | 2311 // Show controls when in full screen mode unless there is an overlay player. |
| 2307 if (isFullscreen()) | 2312 if (isFullscreen() && !RuntimeEnabledFeatures::overlayFullscreenVideoEnabled ()) |
|
qinmin
2014/02/28 17:12:45
overlayFullscreenVideoEnabled is enabled by defaul
| |
| 2308 return true; | 2313 return true; |
| 2309 | 2314 |
| 2310 return fastHasAttribute(controlsAttr); | 2315 return controls(); |
| 2311 } | 2316 } |
| 2312 | 2317 |
| 2313 void HTMLMediaElement::setControls(bool b) | 2318 void HTMLMediaElement::setControls(bool b) |
| 2314 { | 2319 { |
| 2315 WTF_LOG(Media, "HTMLMediaElement::setControls(%s)", boolString(b)); | 2320 WTF_LOG(Media, "HTMLMediaElement::setControls(%s)", boolString(b)); |
| 2316 setBooleanAttribute(controlsAttr, b); | 2321 setBooleanAttribute(controlsAttr, b); |
| 2317 } | 2322 } |
| 2318 | 2323 |
| 2319 double HTMLMediaElement::volume() const | 2324 double HTMLMediaElement::volume() const |
| 2320 { | 2325 { |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3579 if (!mediaControls) | 3584 if (!mediaControls) |
| 3580 return false; | 3585 return false; |
| 3581 | 3586 |
| 3582 mediaControls->setMediaController(m_mediaController ? m_mediaController.get( ) : static_cast<MediaControllerInterface*>(this)); | 3587 mediaControls->setMediaController(m_mediaController ? m_mediaController.get( ) : static_cast<MediaControllerInterface*>(this)); |
| 3583 mediaControls->reset(); | 3588 mediaControls->reset(); |
| 3584 if (isFullscreen()) | 3589 if (isFullscreen()) |
| 3585 mediaControls->enteredFullscreen(); | 3590 mediaControls->enteredFullscreen(); |
| 3586 | 3591 |
| 3587 ensureUserAgentShadowRoot().appendChild(mediaControls); | 3592 ensureUserAgentShadowRoot().appendChild(mediaControls); |
| 3588 | 3593 |
| 3589 if (!controls() || !inDocument()) | 3594 if (!shouldDisplayControls() || !inDocument()) |
| 3590 mediaControls->hide(); | 3595 mediaControls->hide(); |
| 3591 | 3596 |
| 3592 return true; | 3597 return true; |
| 3593 } | 3598 } |
| 3594 | 3599 |
| 3595 void HTMLMediaElement::configureMediaControls() | 3600 void HTMLMediaElement::configureMediaControls() |
| 3596 { | 3601 { |
| 3597 if (!controls() || !inDocument()) { | 3602 if (!shouldDisplayControls() || !inDocument()) { |
| 3598 if (hasMediaControls()) | 3603 if (hasMediaControls()) { |
| 3599 mediaControls()->hide(); | 3604 if (!shouldDisplayControls()) |
| 3605 userAgentShadowRoot()->removeChild(mediaControls()); | |
| 3606 else | |
| 3607 mediaControls()->hide(); | |
| 3608 } | |
| 3600 return; | 3609 return; |
| 3601 } | 3610 } |
| 3602 | 3611 |
| 3603 if (!hasMediaControls() && !createMediaControls()) | 3612 if (!hasMediaControls() && !createMediaControls()) |
| 3604 return; | 3613 return; |
| 3605 | 3614 |
| 3606 mediaControls()->show(); | 3615 mediaControls()->show(); |
| 3607 } | 3616 } |
| 3608 | 3617 |
| 3609 void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assu mption) | 3618 void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assu mption) |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3898 { | 3907 { |
| 3899 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); | 3908 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); |
| 3900 } | 3909 } |
| 3901 | 3910 |
| 3902 bool HTMLMediaElement::isInteractiveContent() const | 3911 bool HTMLMediaElement::isInteractiveContent() const |
| 3903 { | 3912 { |
| 3904 return fastHasAttribute(controlsAttr); | 3913 return fastHasAttribute(controlsAttr); |
| 3905 } | 3914 } |
| 3906 | 3915 |
| 3907 } | 3916 } |
| OLD | NEW |