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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 277 } |
278 | 278 |
279 const AtomicString& MediaControlOverlayEnclosureElement::shadowPseudoId() const | 279 const AtomicString& MediaControlOverlayEnclosureElement::shadowPseudoId() const |
280 { | 280 { |
281 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-enclo
sure", AtomicString::ConstructFromLiteral)); | 281 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-enclo
sure", AtomicString::ConstructFromLiteral)); |
282 return id; | 282 return id; |
283 } | 283 } |
284 | 284 |
285 // ---------------------------- | 285 // ---------------------------- |
286 | 286 |
287 MediaControlPanelMuteButtonElement::MediaControlPanelMuteButtonElement(Document&
document, MediaControls* controls) | 287 MediaControlMuteButtonElement::MediaControlMuteButtonElement(Document& document) |
288 : MediaControlMuteButtonElement(document, MediaMuteButton) | 288 : MediaControlInputElement(document, MediaMuteButton) |
289 { | 289 { |
290 } | 290 } |
291 | 291 |
292 PassRefPtr<MediaControlPanelMuteButtonElement> MediaControlPanelMuteButtonElemen
t::create(Document& document, MediaControls* controls) | 292 PassRefPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElement::create(
Document& document) |
293 { | 293 { |
294 ASSERT(controls); | 294 RefPtr<MediaControlMuteButtonElement> button = adoptRef(new MediaControlMute
ButtonElement(document)); |
295 | |
296 RefPtr<MediaControlPanelMuteButtonElement> button = adoptRef(new MediaContro
lPanelMuteButtonElement(document, controls)); | |
297 button->ensureUserAgentShadowRoot(); | 295 button->ensureUserAgentShadowRoot(); |
298 button->setType("button"); | 296 button->setType("button"); |
299 return button.release(); | 297 return button.release(); |
300 } | 298 } |
301 | 299 |
302 const AtomicString& MediaControlPanelMuteButtonElement::shadowPseudoId() const | 300 void MediaControlMuteButtonElement::defaultEventHandler(Event* event) |
| 301 { |
| 302 if (event->type() == EventTypeNames::click) { |
| 303 mediaController()->setMuted(!mediaController()->muted()); |
| 304 event->setDefaultHandled(); |
| 305 } |
| 306 |
| 307 HTMLInputElement::defaultEventHandler(event); |
| 308 } |
| 309 |
| 310 void MediaControlMuteButtonElement::updateDisplayType() |
| 311 { |
| 312 setDisplayType(mediaController()->muted() ? MediaUnMuteButton : MediaMuteBut
ton); |
| 313 } |
| 314 |
| 315 const AtomicString& MediaControlMuteButtonElement::shadowPseudoId() const |
303 { | 316 { |
304 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-mute-button",
AtomicString::ConstructFromLiteral)); | 317 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-mute-button",
AtomicString::ConstructFromLiteral)); |
305 return id; | 318 return id; |
306 } | 319 } |
307 | 320 |
308 // ---------------------------- | 321 // ---------------------------- |
309 | 322 |
310 MediaControlPlayButtonElement::MediaControlPlayButtonElement(Document& document) | 323 MediaControlPlayButtonElement::MediaControlPlayButtonElement(Document& document) |
311 : MediaControlInputElement(document, MediaPlayButton) | 324 : MediaControlInputElement(document, MediaPlayButton) |
312 { | 325 { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 | 505 |
493 | 506 |
494 const AtomicString& MediaControlTimelineElement::shadowPseudoId() const | 507 const AtomicString& MediaControlTimelineElement::shadowPseudoId() const |
495 { | 508 { |
496 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline", At
omicString::ConstructFromLiteral)); | 509 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline", At
omicString::ConstructFromLiteral)); |
497 return id; | 510 return id; |
498 } | 511 } |
499 | 512 |
500 // ---------------------------- | 513 // ---------------------------- |
501 | 514 |
502 MediaControlPanelVolumeSliderElement::MediaControlPanelVolumeSliderElement(Docum
ent& document) | 515 MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(Document& docum
ent) |
503 : MediaControlVolumeSliderElement(document) | 516 : MediaControlInputElement(document, MediaVolumeSlider) |
504 { | 517 { |
505 } | 518 } |
506 | 519 |
507 PassRefPtr<MediaControlPanelVolumeSliderElement> MediaControlPanelVolumeSliderEl
ement::create(Document& document) | 520 PassRefPtr<MediaControlVolumeSliderElement> MediaControlVolumeSliderElement::cre
ate(Document& document) |
508 { | 521 { |
509 RefPtr<MediaControlPanelVolumeSliderElement> slider = adoptRef(new MediaCont
rolPanelVolumeSliderElement(document)); | 522 RefPtr<MediaControlVolumeSliderElement> slider = adoptRef(new MediaControlVo
lumeSliderElement(document)); |
510 slider->ensureUserAgentShadowRoot(); | 523 slider->ensureUserAgentShadowRoot(); |
511 slider->setType("range"); | 524 slider->setType("range"); |
512 slider->setAttribute(stepAttr, "any"); | 525 slider->setAttribute(stepAttr, "any"); |
513 slider->setAttribute(maxAttr, "1"); | 526 slider->setAttribute(maxAttr, "1"); |
514 return slider.release(); | 527 return slider.release(); |
515 } | 528 } |
516 | 529 |
517 const AtomicString& MediaControlPanelVolumeSliderElement::shadowPseudoId() const | 530 void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) |
| 531 { |
| 532 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) |
| 533 return; |
| 534 |
| 535 if (!inDocument() || !document().isActive()) |
| 536 return; |
| 537 |
| 538 MediaControlInputElement::defaultEventHandler(event); |
| 539 |
| 540 if (event->type() == EventTypeNames::mouseover || event->type() == EventType
Names::mouseout || event->type() == EventTypeNames::mousemove) |
| 541 return; |
| 542 |
| 543 double volume = value().toDouble(); |
| 544 mediaController()->setVolume(volume, ASSERT_NO_EXCEPTION); |
| 545 mediaController()->setMuted(false); |
| 546 } |
| 547 |
| 548 bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents() |
| 549 { |
| 550 if (!inDocument() || !document().isActive()) |
| 551 return false; |
| 552 |
| 553 return MediaControlInputElement::willRespondToMouseMoveEvents(); |
| 554 } |
| 555 |
| 556 bool MediaControlVolumeSliderElement::willRespondToMouseClickEvents() |
| 557 { |
| 558 if (!inDocument() || !document().isActive()) |
| 559 return false; |
| 560 |
| 561 return MediaControlInputElement::willRespondToMouseClickEvents(); |
| 562 } |
| 563 |
| 564 void MediaControlVolumeSliderElement::setVolume(double volume) |
| 565 { |
| 566 if (value().toDouble() != volume) |
| 567 setValue(String::number(volume)); |
| 568 } |
| 569 |
| 570 const AtomicString& MediaControlVolumeSliderElement::shadowPseudoId() const |
518 { | 571 { |
519 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider
", AtomicString::ConstructFromLiteral)); | 572 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider
", AtomicString::ConstructFromLiteral)); |
520 return id; | 573 return id; |
521 } | 574 } |
522 | 575 |
523 // ---------------------------- | 576 // ---------------------------- |
524 | 577 |
525 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Documen
t& document) | 578 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Documen
t& document) |
526 : MediaControlInputElement(document, MediaEnterFullscreenButton) | 579 : MediaControlInputElement(document, MediaEnterFullscreenButton) |
527 { | 580 { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 float fontSize = smallestDimension * 0.05f; | 790 float fontSize = smallestDimension * 0.05f; |
738 if (fontSize != m_fontSize) { | 791 if (fontSize != m_fontSize) { |
739 m_fontSize = fontSize; | 792 m_fontSize = fontSize; |
740 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); | 793 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); |
741 } | 794 } |
742 } | 795 } |
743 | 796 |
744 // ---------------------------- | 797 // ---------------------------- |
745 | 798 |
746 } // namespace WebCore | 799 } // namespace WebCore |
OLD | NEW |