| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 void MediaControlMuteButtonElement::updateDisplayType() | 151 void MediaControlMuteButtonElement::updateDisplayType() |
| 152 { | 152 { |
| 153 setDisplayType(mediaController()->muted() ? MediaUnMuteButton : MediaMuteBut
ton); | 153 setDisplayType(mediaController()->muted() ? MediaUnMuteButton : MediaMuteBut
ton); |
| 154 } | 154 } |
| 155 | 155 |
| 156 // ---------------------------- | 156 // ---------------------------- |
| 157 | 157 |
| 158 MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(Document& docum
ent) | 158 MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(Document& docum
ent) |
| 159 : MediaControlInputElement(document, MediaVolumeSlider) | 159 : MediaControlInputElement(document, MediaVolumeSlider) |
| 160 , m_clearMutedOnUserInteraction(false) | |
| 161 { | 160 { |
| 162 } | 161 } |
| 163 | 162 |
| 164 void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) | 163 void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) |
| 165 { | 164 { |
| 166 // Left button is 0. Rejects mouse events not from left button. | 165 // Left button is 0. Rejects mouse events not from left button. |
| 167 if (event->isMouseEvent() && toMouseEvent(event)->button()) | 166 if (event->isMouseEvent() && toMouseEvent(event)->button()) |
| 168 return; | 167 return; |
| 169 | 168 |
| 170 if (!inDocument() || !document().isActive()) | 169 if (!inDocument() || !document().isActive()) |
| 171 return; | 170 return; |
| 172 | 171 |
| 173 MediaControlInputElement::defaultEventHandler(event); | 172 MediaControlInputElement::defaultEventHandler(event); |
| 174 | 173 |
| 175 if (event->type() == EventTypeNames::mouseover || event->type() == EventType
Names::mouseout || event->type() == EventTypeNames::mousemove) | 174 if (event->type() == EventTypeNames::mouseover || event->type() == EventType
Names::mouseout || event->type() == EventTypeNames::mousemove) |
| 176 return; | 175 return; |
| 177 | 176 |
| 178 double volume = value().toDouble(); | 177 double volume = value().toDouble(); |
| 179 if (volume != mediaController()->volume()) | 178 mediaController()->setVolume(volume, ASSERT_NO_EXCEPTION); |
| 180 mediaController()->setVolume(volume, ASSERT_NO_EXCEPTION); | 179 mediaController()->setMuted(false); |
| 181 if (m_clearMutedOnUserInteraction) | |
| 182 mediaController()->setMuted(false); | |
| 183 } | 180 } |
| 184 | 181 |
| 185 bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents() | 182 bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents() |
| 186 { | 183 { |
| 187 if (!inDocument() || !document().isActive()) | 184 if (!inDocument() || !document().isActive()) |
| 188 return false; | 185 return false; |
| 189 | 186 |
| 190 return MediaControlInputElement::willRespondToMouseMoveEvents(); | 187 return MediaControlInputElement::willRespondToMouseMoveEvents(); |
| 191 } | 188 } |
| 192 | 189 |
| 193 bool MediaControlVolumeSliderElement::willRespondToMouseClickEvents() | 190 bool MediaControlVolumeSliderElement::willRespondToMouseClickEvents() |
| 194 { | 191 { |
| 195 if (!inDocument() || !document().isActive()) | 192 if (!inDocument() || !document().isActive()) |
| 196 return false; | 193 return false; |
| 197 | 194 |
| 198 return MediaControlInputElement::willRespondToMouseClickEvents(); | 195 return MediaControlInputElement::willRespondToMouseClickEvents(); |
| 199 } | 196 } |
| 200 | 197 |
| 201 void MediaControlVolumeSliderElement::setVolume(double volume) | 198 void MediaControlVolumeSliderElement::setVolume(double volume) |
| 202 { | 199 { |
| 203 if (value().toDouble() != volume) | 200 if (value().toDouble() != volume) |
| 204 setValue(String::number(volume)); | 201 setValue(String::number(volume)); |
| 205 } | 202 } |
| 206 | 203 |
| 207 void MediaControlVolumeSliderElement::setClearMutedOnUserInteraction(bool clearM
ute) | |
| 208 { | |
| 209 m_clearMutedOnUserInteraction = clearMute; | |
| 210 } | |
| 211 | |
| 212 } // namespace WebCore | 204 } // namespace WebCore |
| OLD | NEW |