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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 { | 409 { |
410 RefPtr<MediaControlToggleClosedCaptionsButtonElement> button = adoptRef(new
MediaControlToggleClosedCaptionsButtonElement(mediaControls)); | 410 RefPtr<MediaControlToggleClosedCaptionsButtonElement> button = adoptRef(new
MediaControlToggleClosedCaptionsButtonElement(mediaControls)); |
411 button->ensureUserAgentShadowRoot(); | 411 button->ensureUserAgentShadowRoot(); |
412 button->setType("button"); | 412 button->setType("button"); |
413 button->hide(); | 413 button->hide(); |
414 return button.release(); | 414 return button.release(); |
415 } | 415 } |
416 | 416 |
417 void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType() | 417 void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType() |
418 { | 418 { |
419 bool captionsVisible = mediaControllerInterface().closedCaptionsVisible(); | 419 bool captionsVisible = mediaElement().closedCaptionsVisible(); |
420 setDisplayType(captionsVisible ? MediaHideClosedCaptionsButton : MediaShowCl
osedCaptionsButton); | 420 setDisplayType(captionsVisible ? MediaHideClosedCaptionsButton : MediaShowCl
osedCaptionsButton); |
421 setChecked(captionsVisible); | 421 setChecked(captionsVisible); |
422 } | 422 } |
423 | 423 |
424 void MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler(Event* e
vent) | 424 void MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler(Event* e
vent) |
425 { | 425 { |
426 if (event->type() == EventTypeNames::click) { | 426 if (event->type() == EventTypeNames::click) { |
427 mediaControllerInterface().setClosedCaptionsVisible(!mediaControllerInte
rface().closedCaptionsVisible()); | 427 mediaElement().setClosedCaptionsVisible(!mediaElement().closedCaptionsVi
sible()); |
428 setChecked(mediaControllerInterface().closedCaptionsVisible()); | 428 setChecked(mediaElement().closedCaptionsVisible()); |
429 updateDisplayType(); | 429 updateDisplayType(); |
430 event->setDefaultHandled(); | 430 event->setDefaultHandled(); |
431 } | 431 } |
432 | 432 |
433 HTMLInputElement::defaultEventHandler(event); | 433 HTMLInputElement::defaultEventHandler(event); |
434 } | 434 } |
435 | 435 |
436 const AtomicString& MediaControlToggleClosedCaptionsButtonElement::shadowPseudoI
d() const | 436 const AtomicString& MediaControlToggleClosedCaptionsButtonElement::shadowPseudoI
d() const |
437 { | 437 { |
438 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-toggle-closed
-captions-button", AtomicString::ConstructFromLiteral)); | 438 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-toggle-closed
-captions-button", AtomicString::ConstructFromLiteral)); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 return id; | 689 return id; |
690 } | 690 } |
691 | 691 |
692 const AtomicString& MediaControlTextTrackContainerElement::shadowPseudoId() cons
t | 692 const AtomicString& MediaControlTextTrackContainerElement::shadowPseudoId() cons
t |
693 { | 693 { |
694 return textTrackContainerElementShadowPseudoId(); | 694 return textTrackContainerElementShadowPseudoId(); |
695 } | 695 } |
696 | 696 |
697 void MediaControlTextTrackContainerElement::updateDisplay() | 697 void MediaControlTextTrackContainerElement::updateDisplay() |
698 { | 698 { |
699 if (!mediaControllerInterface().closedCaptionsVisible()) { | 699 if (!mediaElement().closedCaptionsVisible()) { |
700 removeChildren(); | 700 removeChildren(); |
701 return; | 701 return; |
702 } | 702 } |
703 | 703 |
704 // 1. If the media element is an audio element, or is another playback | 704 // 1. If the media element is an audio element, or is another playback |
705 // mechanism with no rendering area, abort these steps. There is nothing to | 705 // mechanism with no rendering area, abort these steps. There is nothing to |
706 // render. | 706 // render. |
707 if (!mediaElement().isVideo()) | 707 if (!mediaElement().isVideo()) |
708 return; | 708 return; |
709 | 709 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 float fontSize = smallestDimension * 0.05f; | 782 float fontSize = smallestDimension * 0.05f; |
783 if (fontSize != m_fontSize) { | 783 if (fontSize != m_fontSize) { |
784 m_fontSize = fontSize; | 784 m_fontSize = fontSize; |
785 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); | 785 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); |
786 } | 786 } |
787 } | 787 } |
788 | 788 |
789 // ---------------------------- | 789 // ---------------------------- |
790 | 790 |
791 } // namespace WebCore | 791 } // namespace WebCore |
OLD | NEW |