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

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

Issue 339903005: Use HTMLMediaElement's helpers for the video fullscreen button (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 14 matching lines...) Expand all
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/html/shadow/MediaControlElements.h" 31 #include "core/html/shadow/MediaControlElements.h"
32 32
33 #include "bindings/v8/ExceptionStatePlaceholder.h" 33 #include "bindings/v8/ExceptionStatePlaceholder.h"
34 #include "core/dom/DOMTokenList.h" 34 #include "core/dom/DOMTokenList.h"
35 #include "core/dom/FullscreenElementStack.h"
36 #include "core/dom/shadow/ShadowRoot.h" 35 #include "core/dom/shadow/ShadowRoot.h"
37 #include "core/events/MouseEvent.h" 36 #include "core/events/MouseEvent.h"
38 #include "core/frame/LocalFrame.h" 37 #include "core/frame/LocalFrame.h"
39 #include "core/html/HTMLVideoElement.h" 38 #include "core/html/HTMLVideoElement.h"
40 #include "core/html/MediaController.h" 39 #include "core/html/MediaController.h"
41 #include "core/html/shadow/MediaControls.h" 40 #include "core/html/shadow/MediaControls.h"
42 #include "core/html/track/TextTrack.h" 41 #include "core/html/track/TextTrack.h"
43 #include "core/html/track/vtt/VTTRegionList.h" 42 #include "core/html/track/vtt/VTTRegionList.h"
44 #include "core/page/EventHandler.h" 43 #include "core/page/EventHandler.h"
45 #include "core/rendering/RenderMediaControlElements.h" 44 #include "core/rendering/RenderMediaControlElements.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil lBeNoop(new MediaControlFullscreenButtonElement(mediaControls)); 484 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil lBeNoop(new MediaControlFullscreenButtonElement(mediaControls));
486 button->ensureUserAgentShadowRoot(); 485 button->ensureUserAgentShadowRoot();
487 button->setType("button"); 486 button->setType("button");
488 button->hide(); 487 button->hide();
489 return button.release(); 488 return button.release();
490 } 489 }
491 490
492 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) 491 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
493 { 492 {
494 if (event->type() == EventTypeNames::click) { 493 if (event->type() == EventTypeNames::click) {
495 if (FullscreenElementStack::isActiveFullScreenElement(mediaElement())) 494 if (mediaElement().isFullscreen())
496 FullscreenElementStack::from(document()).webkitCancelFullScreen(); 495 mediaElement().exitFullscreen();
497 else 496 else
498 FullscreenElementStack::from(document()).requestFullScreenForElement (mediaElement(), 0, FullscreenElementStack::ExemptIFrameAllowFullScreenRequireme nt); 497 mediaElement().enterFullscreen();
499 event->setDefaultHandled(); 498 event->setDefaultHandled();
500 } 499 }
501 HTMLInputElement::defaultEventHandler(event); 500 HTMLInputElement::defaultEventHandler(event);
502 } 501 }
503 502
504 const AtomicString& MediaControlFullscreenButtonElement::shadowPseudoId() const 503 const AtomicString& MediaControlFullscreenButtonElement::shadowPseudoId() const
505 { 504 {
506 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-fullscreen-bu tton", AtomicString::ConstructFromLiteral)); 505 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-fullscreen-bu tton", AtomicString::ConstructFromLiteral));
507 return id; 506 return id;
508 } 507 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 float fontSize = smallestDimension * 0.05f; 675 float fontSize = smallestDimension * 0.05f;
677 if (fontSize != m_fontSize) { 676 if (fontSize != m_fontSize) {
678 m_fontSize = fontSize; 677 m_fontSize = fontSize;
679 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); 678 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX);
680 } 679 }
681 } 680 }
682 681
683 // ---------------------------- 682 // ----------------------------
684 683
685 } // namespace WebCore 684 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698