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

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

Issue 195473002: Let MediaControls use the parent HTMLMediaElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Give MediaControls to MediaControlElements Created 6 years, 9 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 18 matching lines...) Expand all
29 29
30 #include "config.h" 30 #include "config.h"
31 31
32 #include "core/html/shadow/MediaControlElementTypes.h" 32 #include "core/html/shadow/MediaControlElementTypes.h"
33 33
34 #include "CSSValueKeywords.h" 34 #include "CSSValueKeywords.h"
35 #include "HTMLNames.h" 35 #include "HTMLNames.h"
36 #include "bindings/v8/ExceptionStatePlaceholder.h" 36 #include "bindings/v8/ExceptionStatePlaceholder.h"
37 #include "core/css/StylePropertySet.h" 37 #include "core/css/StylePropertySet.h"
38 #include "core/events/MouseEvent.h" 38 #include "core/events/MouseEvent.h"
39 #include "core/html/HTMLMediaElement.h"
40 #include "core/html/shadow/MediaControls.h"
39 41
40 namespace WebCore { 42 namespace WebCore {
41 43
42 using namespace HTMLNames; 44 using namespace HTMLNames;
43 45
44 class Event; 46 class Event;
45 47
46 HTMLMediaElement* toParentMediaElement(Node* node) 48 HTMLMediaElement* toParentMediaElement(Node* node)
47 { 49 {
48 if (!node) 50 if (!node)
49 return 0; 51 return 0;
50 Node* mediaNode = node->shadowHost(); 52 Node* mediaNode = node->shadowHost();
51 if (!mediaNode) 53 if (!mediaNode)
52 mediaNode = node; 54 mediaNode = node;
53 if (!mediaNode || !mediaNode->isElementNode() || !toElement(mediaNode)->isMe diaElement()) 55 if (!mediaNode || !mediaNode->isElementNode() || !toElement(mediaNode)->isMe diaElement())
54 return 0; 56 return 0;
55 57
56 return toHTMLMediaElement(mediaNode); 58 return toHTMLMediaElement(mediaNode);
57 } 59 }
58 60
59 MediaControlElementType mediaControlElementType(Node* node) 61 MediaControlElementType mediaControlElementType(Node* node)
60 { 62 {
61 ASSERT_WITH_SECURITY_IMPLICATION(node->isMediaControlElement()); 63 ASSERT_WITH_SECURITY_IMPLICATION(node->isMediaControlElement());
62 HTMLElement* element = toHTMLElement(node); 64 HTMLElement* element = toHTMLElement(node);
63 if (element->hasTagName(inputTag)) 65 if (element->hasTagName(inputTag))
64 return static_cast<MediaControlInputElement*>(element)->displayType(); 66 return static_cast<MediaControlInputElement*>(element)->displayType();
65 return static_cast<MediaControlDivElement*>(element)->displayType(); 67 return static_cast<MediaControlDivElement*>(element)->displayType();
66 } 68 }
67 69
68 MediaControlElement::MediaControlElement(MediaControlElementType displayType, HT MLElement* element) 70 MediaControlElement::MediaControlElement(MediaControls& mediaControls, MediaCont rolElementType displayType, HTMLElement* element)
69 : m_mediaController(0) 71 : m_mediaControls(mediaControls)
70 , m_displayType(displayType) 72 , m_displayType(displayType)
71 , m_element(element) 73 , m_element(element)
72 { 74 {
73 } 75 }
74 76
77 HTMLMediaElement& MediaControlElement::mediaElement() const
78 {
79 return mediaControls().mediaElement();
80 }
81
82 MediaControllerInterface& MediaControlElement::mediaControllerInterface() const
83 {
84 return mediaControls().mediaControllerInterface();
85 }
86
75 void MediaControlElement::hide() 87 void MediaControlElement::hide()
76 { 88 {
77 m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); 89 m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
78 } 90 }
79 91
80 void MediaControlElement::show() 92 void MediaControlElement::show()
81 { 93 {
82 m_element->removeInlineStyleProperty(CSSPropertyDisplay); 94 m_element->removeInlineStyleProperty(CSSPropertyDisplay);
83 } 95 }
84 96
85 void MediaControlElement::setDisplayType(MediaControlElementType displayType) 97 void MediaControlElement::setDisplayType(MediaControlElementType displayType)
86 { 98 {
87 if (displayType == m_displayType) 99 if (displayType == m_displayType)
88 return; 100 return;
89 101
90 m_displayType = displayType; 102 m_displayType = displayType;
91 if (RenderObject* object = m_element->renderer()) 103 if (RenderObject* object = m_element->renderer())
92 object->repaint(); 104 object->repaint();
93 } 105 }
94 106
95 // ---------------------------- 107 // ----------------------------
96 108
97 MediaControlDivElement::MediaControlDivElement(Document& document, MediaControlE lementType displayType) 109 MediaControlDivElement::MediaControlDivElement(MediaControls& mediaControls, Med iaControlElementType displayType)
98 : HTMLDivElement(document) 110 : HTMLDivElement(mediaControls.document())
99 , MediaControlElement(displayType, this) 111 , MediaControlElement(mediaControls, displayType, this)
100 { 112 {
101 } 113 }
102 114
103 // ---------------------------- 115 // ----------------------------
104 116
105 MediaControlInputElement::MediaControlInputElement(Document& document, MediaCont rolElementType displayType) 117 MediaControlInputElement::MediaControlInputElement(MediaControls& mediaControls, MediaControlElementType displayType)
106 : HTMLInputElement(document, 0, false) 118 : HTMLInputElement(mediaControls.document(), 0, false)
107 , MediaControlElement(displayType, this) 119 , MediaControlElement(mediaControls, displayType, this)
108 { 120 {
109 } 121 }
110 122
111 bool MediaControlInputElement::isMouseFocusable() const 123 bool MediaControlInputElement::isMouseFocusable() const
112 { 124 {
113 return false; 125 return false;
114 } 126 }
115 127
116 // ---------------------------- 128 // ----------------------------
117 129
118 MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(Document& documen t, MediaControlElementType displayType) 130 MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(MediaControls& me diaControls, MediaControlElementType displayType)
119 : MediaControlDivElement(document, displayType) 131 : MediaControlDivElement(mediaControls, displayType)
120 , m_currentValue(0) 132 , m_currentValue(0)
121 { 133 {
122 } 134 }
123 135
124 void MediaControlTimeDisplayElement::setCurrentValue(double time) 136 void MediaControlTimeDisplayElement::setCurrentValue(double time)
125 { 137 {
126 m_currentValue = time; 138 m_currentValue = time;
127 } 139 }
128 140
129 } // namespace WebCore 141 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/shadow/MediaControlElementTypes.h ('k') | Source/core/html/shadow/MediaControlElements.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698