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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 using namespace HTMLNames; | 52 using namespace HTMLNames; |
53 | 53 |
54 static const AtomicString& getMediaControlCurrentTimeDisplayElementShadowPseudoI
d(); | 54 static const AtomicString& getMediaControlCurrentTimeDisplayElementShadowPseudoI
d(); |
55 static const AtomicString& getMediaControlTimeRemainingDisplayElementShadowPseud
oId(); | 55 static const AtomicString& getMediaControlTimeRemainingDisplayElementShadowPseud
oId(); |
56 | 56 |
57 // If you change any of the following fade durations, then also update the | 57 // If you change any of the following fade durations, then also update the |
58 // corresponding values in LayoutTests/media/media-controls.js. | 58 // corresponding values in LayoutTests/media/media-controls.js. |
59 static const double fadeInDuration = 0.1; | 59 static const double fadeInDuration = 0.1; |
60 static const double fadeOutDuration = 0.3; | 60 static const double fadeOutDuration = 0.3; |
61 | 61 |
| 62 static bool isUserInteractionEvent(Event* event) |
| 63 { |
| 64 const AtomicString& type = event->type(); |
| 65 return type == EventTypeNames::mousedown |
| 66 || type == EventTypeNames::mouseup |
| 67 || type == EventTypeNames::click |
| 68 || type == EventTypeNames::dblclick |
| 69 || event->isKeyboardEvent() |
| 70 || event->isTouchEvent(); |
| 71 } |
| 72 |
| 73 // Sliders (the volume control and timeline) need to capture some additional eve
nts used when dragging the thumb. |
| 74 static bool isUserInteractionEventForSlider(Event* event) |
| 75 { |
| 76 const AtomicString& type = event->type(); |
| 77 return type == EventTypeNames::mousedown |
| 78 || type == EventTypeNames::mouseup |
| 79 || type == EventTypeNames::click |
| 80 || type == EventTypeNames::dblclick |
| 81 || type == EventTypeNames::mouseover |
| 82 || type == EventTypeNames::mouseout |
| 83 || type == EventTypeNames::mousemove |
| 84 || event->isKeyboardEvent() |
| 85 || event->isTouchEvent(); |
| 86 } |
| 87 |
| 88 |
62 MediaControlPanelElement::MediaControlPanelElement(MediaControls& mediaControls) | 89 MediaControlPanelElement::MediaControlPanelElement(MediaControls& mediaControls) |
63 : MediaControlDivElement(mediaControls, MediaControlsPanel) | 90 : MediaControlDivElement(mediaControls, MediaControlsPanel) |
64 , m_isDisplayed(false) | 91 , m_isDisplayed(false) |
65 , m_opaque(true) | 92 , m_opaque(true) |
66 , m_transitionTimer(this, &MediaControlPanelElement::transitionTimerFired) | 93 , m_transitionTimer(this, &MediaControlPanelElement::transitionTimerFired) |
67 { | 94 { |
68 } | 95 } |
69 | 96 |
70 PassRefPtrWillBeRawPtr<MediaControlPanelElement> MediaControlPanelElement::creat
e(MediaControls& mediaControls) | 97 PassRefPtrWillBeRawPtr<MediaControlPanelElement> MediaControlPanelElement::creat
e(MediaControls& mediaControls) |
71 { | 98 { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 167 |
141 m_opaque = false; | 168 m_opaque = false; |
142 startTimer(); | 169 startTimer(); |
143 } | 170 } |
144 | 171 |
145 void MediaControlPanelElement::setIsDisplayed(bool isDisplayed) | 172 void MediaControlPanelElement::setIsDisplayed(bool isDisplayed) |
146 { | 173 { |
147 m_isDisplayed = isDisplayed; | 174 m_isDisplayed = isDisplayed; |
148 } | 175 } |
149 | 176 |
| 177 bool MediaControlPanelElement::keepEventInNode(Event* event) |
| 178 { |
| 179 return isUserInteractionEvent(event); |
| 180 } |
| 181 |
150 // ---------------------------- | 182 // ---------------------------- |
151 | 183 |
152 MediaControlPanelEnclosureElement::MediaControlPanelEnclosureElement(MediaContro
ls& mediaControls) | 184 MediaControlPanelEnclosureElement::MediaControlPanelEnclosureElement(MediaContro
ls& mediaControls) |
153 // Mapping onto same MediaControlElementType as panel element, since it has
similar properties. | 185 // Mapping onto same MediaControlElementType as panel element, since it has
similar properties. |
154 : MediaControlDivElement(mediaControls, MediaControlsPanel) | 186 : MediaControlDivElement(mediaControls, MediaControlsPanel) |
155 { | 187 { |
156 } | 188 } |
157 | 189 |
158 PassRefPtrWillBeRawPtr<MediaControlPanelEnclosureElement> MediaControlPanelEnclo
sureElement::create(MediaControls& mediaControls) | 190 PassRefPtrWillBeRawPtr<MediaControlPanelEnclosureElement> MediaControlPanelEnclo
sureElement::create(MediaControls& mediaControls) |
159 { | 191 { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } else | 320 } else |
289 hide(); | 321 hide(); |
290 } | 322 } |
291 | 323 |
292 const AtomicString& MediaControlOverlayPlayButtonElement::shadowPseudoId() const | 324 const AtomicString& MediaControlOverlayPlayButtonElement::shadowPseudoId() const |
293 { | 325 { |
294 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-play-
button", AtomicString::ConstructFromLiteral)); | 326 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-play-
button", AtomicString::ConstructFromLiteral)); |
295 return id; | 327 return id; |
296 } | 328 } |
297 | 329 |
| 330 bool MediaControlOverlayPlayButtonElement::keepEventInNode(Event* event) |
| 331 { |
| 332 return isUserInteractionEvent(event); |
| 333 } |
| 334 |
298 | 335 |
299 // ---------------------------- | 336 // ---------------------------- |
300 | 337 |
301 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB
uttonElement(MediaControls& mediaControls) | 338 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB
uttonElement(MediaControls& mediaControls) |
302 : MediaControlInputElement(mediaControls, MediaShowClosedCaptionsButton) | 339 : MediaControlInputElement(mediaControls, MediaShowClosedCaptionsButton) |
303 { | 340 { |
304 } | 341 } |
305 | 342 |
306 PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr
olToggleClosedCaptionsButtonElement::create(MediaControls& mediaControls) | 343 PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr
olToggleClosedCaptionsButtonElement::create(MediaControls& mediaControls) |
307 { | 344 { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 { | 438 { |
402 setFloatingPointAttribute(maxAttr, std::isfinite(duration) ? duration : 0); | 439 setFloatingPointAttribute(maxAttr, std::isfinite(duration) ? duration : 0); |
403 } | 440 } |
404 | 441 |
405 const AtomicString& MediaControlTimelineElement::shadowPseudoId() const | 442 const AtomicString& MediaControlTimelineElement::shadowPseudoId() const |
406 { | 443 { |
407 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline", At
omicString::ConstructFromLiteral)); | 444 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline", At
omicString::ConstructFromLiteral)); |
408 return id; | 445 return id; |
409 } | 446 } |
410 | 447 |
| 448 bool MediaControlTimelineElement::keepEventInNode(Event* event) |
| 449 { |
| 450 return isUserInteractionEventForSlider(event); |
| 451 } |
| 452 |
411 // ---------------------------- | 453 // ---------------------------- |
412 | 454 |
413 MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(MediaControls&
mediaControls) | 455 MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(MediaControls&
mediaControls) |
414 : MediaControlInputElement(mediaControls, MediaVolumeSlider) | 456 : MediaControlInputElement(mediaControls, MediaVolumeSlider) |
415 { | 457 { |
416 } | 458 } |
417 | 459 |
418 PassRefPtrWillBeRawPtr<MediaControlVolumeSliderElement> MediaControlVolumeSlider
Element::create(MediaControls& mediaControls) | 460 PassRefPtrWillBeRawPtr<MediaControlVolumeSliderElement> MediaControlVolumeSlider
Element::create(MediaControls& mediaControls) |
419 { | 461 { |
420 RefPtrWillBeRawPtr<MediaControlVolumeSliderElement> slider = adoptRefWillBeN
oop(new MediaControlVolumeSliderElement(mediaControls)); | 462 RefPtrWillBeRawPtr<MediaControlVolumeSliderElement> slider = adoptRefWillBeN
oop(new MediaControlVolumeSliderElement(mediaControls)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 if (value().toDouble() != volume) | 506 if (value().toDouble() != volume) |
465 setValue(String::number(volume)); | 507 setValue(String::number(volume)); |
466 } | 508 } |
467 | 509 |
468 const AtomicString& MediaControlVolumeSliderElement::shadowPseudoId() const | 510 const AtomicString& MediaControlVolumeSliderElement::shadowPseudoId() const |
469 { | 511 { |
470 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider
", AtomicString::ConstructFromLiteral)); | 512 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider
", AtomicString::ConstructFromLiteral)); |
471 return id; | 513 return id; |
472 } | 514 } |
473 | 515 |
| 516 bool MediaControlVolumeSliderElement::keepEventInNode(Event* event) |
| 517 { |
| 518 return isUserInteractionEventForSlider(event); |
| 519 } |
| 520 |
474 // ---------------------------- | 521 // ---------------------------- |
475 | 522 |
476 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(MediaCo
ntrols& mediaControls) | 523 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(MediaCo
ntrols& mediaControls) |
477 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton) | 524 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton) |
478 { | 525 { |
479 } | 526 } |
480 | 527 |
481 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre
enButtonElement::create(MediaControls& mediaControls) | 528 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre
enButtonElement::create(MediaControls& mediaControls) |
482 { | 529 { |
483 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil
lBeNoop(new MediaControlFullscreenButtonElement(mediaControls)); | 530 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil
lBeNoop(new MediaControlFullscreenButtonElement(mediaControls)); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 float fontSize = smallestDimension * 0.05f; | 721 float fontSize = smallestDimension * 0.05f; |
675 if (fontSize != m_fontSize) { | 722 if (fontSize != m_fontSize) { |
676 m_fontSize = fontSize; | 723 m_fontSize = fontSize; |
677 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); | 724 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); |
678 } | 725 } |
679 } | 726 } |
680 | 727 |
681 // ---------------------------- | 728 // ---------------------------- |
682 | 729 |
683 } // namespace blink | 730 } // namespace blink |
OLD | NEW |