| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 HTMLElement* element = toHTMLElement(node); | 64 HTMLElement* element = toHTMLElement(node); |
| 65 if (isHTMLInputElement(*element)) | 65 if (isHTMLInputElement(*element)) |
| 66 return static_cast<MediaControlInputElement*>(element)->displayType(); | 66 return static_cast<MediaControlInputElement*>(element)->displayType(); |
| 67 return static_cast<MediaControlDivElement*>(element)->displayType(); | 67 return static_cast<MediaControlDivElement*>(element)->displayType(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 MediaControlElement::MediaControlElement(MediaControls& mediaControls, MediaCont
rolElementType displayType, HTMLElement* element) | 70 MediaControlElement::MediaControlElement(MediaControls& mediaControls, MediaCont
rolElementType displayType, HTMLElement* element) |
| 71 : m_mediaControls(mediaControls) | 71 : m_mediaControls(mediaControls) |
| 72 , m_displayType(displayType) | 72 , m_displayType(displayType) |
| 73 , m_element(element) | 73 , m_element(element) |
| 74 , m_isWanted(true) |
| 75 , m_doesFit(true) |
| 74 { | 76 { |
| 75 } | 77 } |
| 76 | 78 |
| 77 HTMLMediaElement& MediaControlElement::mediaElement() const | 79 HTMLMediaElement& MediaControlElement::mediaElement() const |
| 78 { | 80 { |
| 79 return mediaControls().mediaElement(); | 81 return mediaControls().mediaElement(); |
| 80 } | 82 } |
| 81 | 83 |
| 82 void MediaControlElement::hide() | 84 void MediaControlElement::updateShownState() |
| 83 { | 85 { |
| 84 m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); | 86 if (m_isWanted && m_doesFit) |
| 87 m_element->removeInlineStyleProperty(CSSPropertyDisplay); |
| 88 else |
| 89 m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| 85 } | 90 } |
| 86 | 91 |
| 87 void MediaControlElement::show() | 92 void MediaControlElement::setDoesFit(bool fits) |
| 88 { | 93 { |
| 89 m_element->removeInlineStyleProperty(CSSPropertyDisplay); | 94 m_doesFit = fits; |
| 95 updateShownState(); |
| 96 } |
| 97 |
| 98 void MediaControlElement::setIsWanted(bool wanted) |
| 99 { |
| 100 m_isWanted = wanted; |
| 101 updateShownState(); |
| 102 } |
| 103 |
| 104 bool MediaControlElement::isWanted() |
| 105 { |
| 106 return m_isWanted; |
| 107 } |
| 108 |
| 109 int MediaControlElement::minimumWidth() |
| 110 { |
| 111 // We could check the computed style here, but that depends on whether |
| 112 // we've been shown. Instead, we just assume 48 except for the |
| 113 // timeline bar. |
| 114 if (m_displayType == MediaSlider) |
| 115 return 55; |
| 116 |
| 117 return 48; |
| 90 } | 118 } |
| 91 | 119 |
| 92 void MediaControlElement::setDisplayType(MediaControlElementType displayType) | 120 void MediaControlElement::setDisplayType(MediaControlElementType displayType) |
| 93 { | 121 { |
| 94 if (displayType == m_displayType) | 122 if (displayType == m_displayType) |
| 95 return; | 123 return; |
| 96 | 124 |
| 97 m_displayType = displayType; | 125 m_displayType = displayType; |
| 98 if (LayoutObject* object = m_element->layoutObject()) | 126 if (LayoutObject* object = m_element->layoutObject()) |
| 99 object->setShouldDoFullPaintInvalidation(); | 127 object->setShouldDoFullPaintInvalidation(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 , m_currentValue(0) | 172 , m_currentValue(0) |
| 145 { | 173 { |
| 146 } | 174 } |
| 147 | 175 |
| 148 void MediaControlTimeDisplayElement::setCurrentValue(double time) | 176 void MediaControlTimeDisplayElement::setCurrentValue(double time) |
| 149 { | 177 { |
| 150 m_currentValue = time; | 178 m_currentValue = time; |
| 151 } | 179 } |
| 152 | 180 |
| 153 } // namespace blink | 181 } // namespace blink |
| OLD | NEW |