Chromium Code Reviews| 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_isShown(true) | |
| 75 , m_isWanted(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::hide() |
| 83 { | 85 { |
| 84 m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); | 86 m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| 87 m_isShown = false; | |
| 85 } | 88 } |
| 86 | 89 |
| 87 void MediaControlElement::show() | 90 void MediaControlElement::show() |
| 88 { | 91 { |
| 89 m_element->removeInlineStyleProperty(CSSPropertyDisplay); | 92 m_element->removeInlineStyleProperty(CSSPropertyDisplay); |
| 93 m_isShown = true; | |
| 94 } | |
| 95 | |
| 96 bool MediaControlElement::isShown() | |
| 97 { | |
| 98 return m_isShown; | |
| 99 } | |
| 100 | |
| 101 void MediaControlElement::want() | |
| 102 { | |
| 103 m_isWanted = true; | |
| 104 show(); | |
| 105 } | |
| 106 | |
| 107 void MediaControlElement::dontWant() | |
| 108 { | |
| 109 m_isWanted = false; | |
| 110 hide(); | |
| 111 } | |
| 112 | |
| 113 bool MediaControlElement::isWanted() | |
| 114 { | |
| 115 return m_isWanted; | |
| 116 } | |
| 117 | |
| 118 int MediaControlElement::minimumWidth() | |
| 119 { | |
| 120 int minWidthInPixels = 48; | |
|
philipj_slow
2015/07/08 15:06:38
Not sure the local variable explains much in such
liberato (no reviews please)
2015/07/09 12:10:56
Done.
| |
| 121 | |
| 122 // We could check the computed style here, but that depends on whether | |
| 123 // we've been shown. Instead, we just memorize 48 except for the | |
|
philipj_slow
2015/07/08 15:06:38
Not sure what "memorize" means here, maybe "assume
liberato (no reviews please)
2015/07/09 12:10:56
Done.
| |
| 124 // timeline bar. | |
| 125 if (m_displayType == MediaSlider) | |
| 126 minWidthInPixels = 55; | |
| 127 | |
| 128 return minWidthInPixels; | |
| 90 } | 129 } |
| 91 | 130 |
| 92 void MediaControlElement::setDisplayType(MediaControlElementType displayType) | 131 void MediaControlElement::setDisplayType(MediaControlElementType displayType) |
| 93 { | 132 { |
| 94 if (displayType == m_displayType) | 133 if (displayType == m_displayType) |
| 95 return; | 134 return; |
| 96 | 135 |
| 97 m_displayType = displayType; | 136 m_displayType = displayType; |
| 98 if (LayoutObject* object = m_element->layoutObject()) | 137 if (LayoutObject* object = m_element->layoutObject()) |
| 99 object->setShouldDoFullPaintInvalidation(); | 138 object->setShouldDoFullPaintInvalidation(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 , m_currentValue(0) | 183 , m_currentValue(0) |
| 145 { | 184 { |
| 146 } | 185 } |
| 147 | 186 |
| 148 void MediaControlTimeDisplayElement::setCurrentValue(double time) | 187 void MediaControlTimeDisplayElement::setCurrentValue(double time) |
| 149 { | 188 { |
| 150 m_currentValue = time; | 189 m_currentValue = time; |
| 151 } | 190 } |
| 152 | 191 |
| 153 } // namespace blink | 192 } // namespace blink |
| OLD | NEW |