| 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 19 matching lines...) Expand all Loading... |
| 30 #include "core/html/shadow/MediaControlElementTypes.h" | 30 #include "core/html/shadow/MediaControlElementTypes.h" |
| 31 | 31 |
| 32 #include "bindings/core/v8/ExceptionState.h" | 32 #include "bindings/core/v8/ExceptionState.h" |
| 33 #include "core/CSSValueKeywords.h" | 33 #include "core/CSSValueKeywords.h" |
| 34 #include "core/HTMLNames.h" | 34 #include "core/HTMLNames.h" |
| 35 #include "core/css/StylePropertySet.h" | 35 #include "core/css/StylePropertySet.h" |
| 36 #include "core/dom/Text.h" | 36 #include "core/dom/Text.h" |
| 37 #include "core/events/MouseEvent.h" | 37 #include "core/events/MouseEvent.h" |
| 38 #include "core/html/HTMLLabelElement.h" | 38 #include "core/html/HTMLLabelElement.h" |
| 39 #include "core/html/HTMLMediaElement.h" | 39 #include "core/html/HTMLMediaElement.h" |
| 40 #include "core/html/shadow/MediaControls.h" | 40 #include "core/html/media/MediaControls.h" |
| 41 #include "core/layout/LayoutObject.h" | 41 #include "core/layout/LayoutObject.h" |
| 42 #include "platform/text/PlatformLocale.h" | 42 #include "platform/text/PlatformLocale.h" |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 using namespace HTMLNames; | 46 using namespace HTMLNames; |
| 47 | 47 |
| 48 class Event; | 48 class Event; |
| 49 | 49 |
| 50 const HTMLMediaElement* toParentMediaElement(const Node* node) { | 50 const HTMLMediaElement* toParentMediaElement(const Node* node) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 visitor->trace(m_element); | 141 visitor->trace(m_element); |
| 142 visitor->trace(m_overflowMenuElement); | 142 visitor->trace(m_overflowMenuElement); |
| 143 visitor->trace(m_overflowMenuText); | 143 visitor->trace(m_overflowMenuText); |
| 144 } | 144 } |
| 145 | 145 |
| 146 // ---------------------------- | 146 // ---------------------------- |
| 147 | 147 |
| 148 MediaControlDivElement::MediaControlDivElement( | 148 MediaControlDivElement::MediaControlDivElement( |
| 149 MediaControls& mediaControls, | 149 MediaControls& mediaControls, |
| 150 MediaControlElementType displayType) | 150 MediaControlElementType displayType) |
| 151 : HTMLDivElement(mediaControls.document()), | 151 : HTMLDivElement(mediaControls.ownerDocument()), |
| 152 MediaControlElement(mediaControls, displayType, this) {} | 152 MediaControlElement(mediaControls, displayType, this) {} |
| 153 | 153 |
| 154 DEFINE_TRACE(MediaControlDivElement) { | 154 DEFINE_TRACE(MediaControlDivElement) { |
| 155 MediaControlElement::trace(visitor); | 155 MediaControlElement::trace(visitor); |
| 156 HTMLDivElement::trace(visitor); | 156 HTMLDivElement::trace(visitor); |
| 157 } | 157 } |
| 158 | 158 |
| 159 // ---------------------------- | 159 // ---------------------------- |
| 160 | 160 |
| 161 MediaControlInputElement::MediaControlInputElement( | 161 MediaControlInputElement::MediaControlInputElement( |
| 162 MediaControls& mediaControls, | 162 MediaControls& mediaControls, |
| 163 MediaControlElementType displayType) | 163 MediaControlElementType displayType) |
| 164 : HTMLInputElement(mediaControls.document(), false), | 164 : HTMLInputElement(mediaControls.ownerDocument(), false), |
| 165 MediaControlElement(mediaControls, displayType, this) {} | 165 MediaControlElement(mediaControls, displayType, this) {} |
| 166 | 166 |
| 167 bool MediaControlInputElement::isMouseFocusable() const { | 167 bool MediaControlInputElement::isMouseFocusable() const { |
| 168 return false; | 168 return false; |
| 169 } | 169 } |
| 170 | 170 |
| 171 HTMLElement* MediaControlInputElement::createOverflowElement( | 171 HTMLElement* MediaControlInputElement::createOverflowElement( |
| 172 MediaControls& mediaControls, | 172 MediaControls& mediaControls, |
| 173 MediaControlInputElement* button) { | 173 MediaControlInputElement* button) { |
| 174 if (!button) | 174 if (!button) |
| 175 return nullptr; | 175 return nullptr; |
| 176 | 176 |
| 177 // We don't want the button visible within the overflow menu. | 177 // We don't want the button visible within the overflow menu. |
| 178 button->setIsWanted(false); | 178 button->setIsWanted(false); |
| 179 | 179 |
| 180 m_overflowMenuText = | 180 m_overflowMenuText = Text::create(mediaControls.ownerDocument(), |
| 181 Text::create(mediaControls.document(), button->getOverflowMenuString()); | 181 button->getOverflowMenuString()); |
| 182 | 182 |
| 183 HTMLLabelElement* element = | 183 HTMLLabelElement* element = |
| 184 HTMLLabelElement::create(mediaControls.document()); | 184 HTMLLabelElement::create(mediaControls.ownerDocument()); |
| 185 element->setShadowPseudoId( | 185 element->setShadowPseudoId( |
| 186 AtomicString("-internal-media-controls-overflow-menu-list-item")); | 186 AtomicString("-internal-media-controls-overflow-menu-list-item")); |
| 187 // Appending a button to a label element ensures that clicks on the label | 187 // Appending a button to a label element ensures that clicks on the label |
| 188 // are passed down to the button, performing the action we'd expect. | 188 // are passed down to the button, performing the action we'd expect. |
| 189 element->appendChild(button); | 189 element->appendChild(button); |
| 190 element->appendChild(m_overflowMenuText); | 190 element->appendChild(m_overflowMenuText); |
| 191 m_overflowMenuElement = element; | 191 m_overflowMenuElement = element; |
| 192 return element; | 192 return element; |
| 193 } | 193 } |
| 194 | 194 |
| 195 DEFINE_TRACE(MediaControlInputElement) { | 195 DEFINE_TRACE(MediaControlInputElement) { |
| 196 MediaControlElement::trace(visitor); | 196 MediaControlElement::trace(visitor); |
| 197 HTMLInputElement::trace(visitor); | 197 HTMLInputElement::trace(visitor); |
| 198 } | 198 } |
| 199 | 199 |
| 200 // ---------------------------- | 200 // ---------------------------- |
| 201 | 201 |
| 202 MediaControlTimeDisplayElement::MediaControlTimeDisplayElement( | 202 MediaControlTimeDisplayElement::MediaControlTimeDisplayElement( |
| 203 MediaControls& mediaControls, | 203 MediaControls& mediaControls, |
| 204 MediaControlElementType displayType) | 204 MediaControlElementType displayType) |
| 205 : MediaControlDivElement(mediaControls, displayType), m_currentValue(0) {} | 205 : MediaControlDivElement(mediaControls, displayType), m_currentValue(0) {} |
| 206 | 206 |
| 207 void MediaControlTimeDisplayElement::setCurrentValue(double time) { | 207 void MediaControlTimeDisplayElement::setCurrentValue(double time) { |
| 208 m_currentValue = time; | 208 m_currentValue = time; |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace blink | 211 } // namespace blink |
| OLD | NEW |