Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: Source/core/html/shadow/MediaControlElements.cpp

Issue 456323002: [WIP] Re-implement MediaControls in Blink-in-JS (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 593
594 const AtomicString& MediaControlCurrentTimeDisplayElement::shadowPseudoId() cons t 594 const AtomicString& MediaControlCurrentTimeDisplayElement::shadowPseudoId() cons t
595 { 595 {
596 return getMediaControlCurrentTimeDisplayElementShadowPseudoId(); 596 return getMediaControlCurrentTimeDisplayElementShadowPseudoId();
597 } 597 }
598 598
599 // ---------------------------- 599 // ----------------------------
600 600
601 MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement(Med iaControls& mediaControls) 601 MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement(Med iaControls& mediaControls)
602 : MediaControlDivElement(mediaControls, MediaTextTrackDisplayContainer) 602 : MediaControlDivElement(mediaControls, MediaTextTrackDisplayContainer)
603 , m_fontSize(0) 603 //, m_fontSize(0)
604 { 604 {
605 } 605 }
606 606
607 PassRefPtrWillBeRawPtr<MediaControlTextTrackContainerElement> MediaControlTextTr ackContainerElement::create(MediaControls& mediaControls) 607 PassRefPtrWillBeRawPtr<MediaControlTextTrackContainerElement> MediaControlTextTr ackContainerElement::create(MediaControls& mediaControls)
608 { 608 {
609 RefPtrWillBeRawPtr<MediaControlTextTrackContainerElement> element = adoptRef WillBeNoop(new MediaControlTextTrackContainerElement(mediaControls)); 609 RefPtrWillBeRawPtr<MediaControlTextTrackContainerElement> element = adoptRef WillBeNoop(new MediaControlTextTrackContainerElement(mediaControls));
610 element->hide(); 610 element->hide();
611 return element.release(); 611 return element.release();
612 } 612 }
613 613
614 RenderObject* MediaControlTextTrackContainerElement::createRenderer(RenderStyle* ) 614 RenderObject* MediaControlTextTrackContainerElement::createRenderer(RenderStyle* )
615 { 615 {
616 return new RenderTextTrackContainerElement(this); 616 return new RenderTextTrackContainerElement(this);
617 } 617 }
618 618
619 const AtomicString& MediaControlTextTrackContainerElement::textTrackContainerEle mentShadowPseudoId() 619 const AtomicString& MediaControlTextTrackContainerElement::textTrackContainerEle mentShadowPseudoId()
620 { 620 {
621 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-text-track-container", AtomicString::ConstructFromLiteral)); 621 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-text-track-container", AtomicString::ConstructFromLiteral));
622 return id; 622 return id;
623 } 623 }
624 624
625 const AtomicString& MediaControlTextTrackContainerElement::shadowPseudoId() cons t 625 const AtomicString& MediaControlTextTrackContainerElement::shadowPseudoId() cons t
626 { 626 {
627 return textTrackContainerElementShadowPseudoId(); 627 return textTrackContainerElementShadowPseudoId();
628 } 628 }
629 629
630 void MediaControlTextTrackContainerElement::updateDisplay() 630 void MediaControlTextTrackContainerElement::updateDisplay()
631 { 631 {
632 if (!mediaElement().closedCaptionsVisible()) { 632 /*if (!mediaElement().closedCaptionsVisible()) {
633 removeChildren(); 633 removeChildren();
634 return; 634 return;
635 } 635 }
636 636
637 // 1. If the media element is an audio element, or is another playback 637 // 1. If the media element is an audio element, or is another playback
638 // mechanism with no rendering area, abort these steps. There is nothing to 638 // mechanism with no rendering area, abort these steps. There is nothing to
639 // render. 639 // render.
640 if (isHTMLAudioElement(mediaElement())) 640 if (isHTMLAudioElement(mediaElement()))
641 return; 641 return;
642 642
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 if (!cue->track() || !cue->track()->isRendered() || !cue->isActive()) 684 if (!cue->track() || !cue->track()->isRendered() || !cue->isActive())
685 continue; 685 continue;
686 686
687 cue->updateDisplay(m_videoDisplaySize.size(), *this); 687 cue->updateDisplay(m_videoDisplaySize.size(), *this);
688 } 688 }
689 689
690 // 11. Return output. 690 // 11. Return output.
691 if (hasChildren()) 691 if (hasChildren())
692 show(); 692 show();
693 else 693 else
694 hide(); 694 hide();*/
695 } 695 }
696 696
697 void MediaControlTextTrackContainerElement::updateSizes() 697 void MediaControlTextTrackContainerElement::updateSizes()
698 { 698 {
699 if (!document().isActive()) 699 /*if (!document().isActive())
700 return; 700 return;
701 701
702 IntRect videoBox; 702 IntRect videoBox;
703 703
704 if (!mediaElement().renderer() || !mediaElement().renderer()->isVideo()) 704 if (!mediaElement().renderer() || !mediaElement().renderer()->isVideo())
705 return; 705 return;
706 videoBox = toRenderVideo(mediaElement().renderer())->videoBox(); 706 videoBox = toRenderVideo(mediaElement().renderer())->videoBox();
707 707
708 if (m_videoDisplaySize == videoBox) 708 if (m_videoDisplaySize == videoBox)
709 return; 709 return;
710 m_videoDisplaySize = videoBox; 710 m_videoDisplaySize = videoBox;
711 711
712 float smallestDimension = std::min(m_videoDisplaySize.size().height(), m_vid eoDisplaySize.size().width()); 712 float smallestDimension = std::min(m_videoDisplaySize.size().height(), m_vid eoDisplaySize.size().width());
713 713
714 float fontSize = smallestDimension * 0.05f; 714 float fontSize = smallestDimension * 0.05f;
715 if (fontSize != m_fontSize) { 715 if (fontSize != m_fontSize) {
716 m_fontSize = fontSize; 716 m_fontSize = fontSize;
717 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); 717 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX);
718 } 718 }*/
719 } 719 }
720 720
721 // ---------------------------- 721 // ----------------------------
722 722
723 } // namespace blink 723 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698