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 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 // Left button is 0. Rejects mouse events not from left button. | |
| 533 if (event->isMouseEvent() && toMouseEvent(event)->button()) | |
|
acolwell GONE FROM CHROMIUM
2014/03/04 23:49:28
nit: Can we add == LeftButton so the comment isn't
philipj_slow
2014/03/05 13:12:08
Done.
| |
| 534 return; | |
| 535 | |
| 536 if (!inDocument() || !document().isActive()) | |
| 537 return; | |
| 538 | |
| 539 MediaControlInputElement::defaultEventHandler(event); | |
| 540 | |
| 541 if (event->type() == EventTypeNames::mouseover || event->type() == EventType Names::mouseout || event->type() == EventTypeNames::mousemove) | |
| 542 return; | |
| 543 | |
| 544 double volume = value().toDouble(); | |
| 545 mediaController()->setVolume(volume, ASSERT_NO_EXCEPTION); | |
| 546 mediaController()->setMuted(false); | |
| 547 } | |
| 548 | |
| 549 bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents() | |
| 550 { | |
| 551 if (!inDocument() || !document().isActive()) | |
| 552 return false; | |
| 553 | |
| 554 return MediaControlInputElement::willRespondToMouseMoveEvents(); | |
| 555 } | |
| 556 | |
| 557 bool MediaControlVolumeSliderElement::willRespondToMouseClickEvents() | |
| 558 { | |
| 559 if (!inDocument() || !document().isActive()) | |
| 560 return false; | |
| 561 | |
| 562 return MediaControlInputElement::willRespondToMouseClickEvents(); | |
| 563 } | |
| 564 | |
| 565 void MediaControlVolumeSliderElement::setVolume(double volume) | |
| 566 { | |
| 567 if (value().toDouble() != volume) | |
| 568 setValue(String::number(volume)); | |
| 569 } | |
| 570 | |
| 571 const AtomicString& MediaControlVolumeSliderElement::shadowPseudoId() const | |
| 518 { | 572 { |
| 519 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider ", AtomicString::ConstructFromLiteral)); | 573 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider ", AtomicString::ConstructFromLiteral)); |
| 520 return id; | 574 return id; |
| 521 } | 575 } |
| 522 | 576 |
| 523 // ---------------------------- | 577 // ---------------------------- |
| 524 | 578 |
| 525 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Documen t& document) | 579 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Documen t& document) |
| 526 : MediaControlInputElement(document, MediaEnterFullscreenButton) | 580 : MediaControlInputElement(document, MediaEnterFullscreenButton) |
| 527 { | 581 { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 737 float fontSize = smallestDimension * 0.05f; | 791 float fontSize = smallestDimension * 0.05f; |
| 738 if (fontSize != m_fontSize) { | 792 if (fontSize != m_fontSize) { |
| 739 m_fontSize = fontSize; | 793 m_fontSize = fontSize; |
| 740 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); | 794 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); |
| 741 } | 795 } |
| 742 } | 796 } |
| 743 | 797 |
| 744 // ---------------------------- | 798 // ---------------------------- |
| 745 | 799 |
| 746 } // namespace WebCore | 800 } // namespace WebCore |
| OLD | NEW |