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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 const AtomicString& MediaControlPlayButtonElement::shadowPseudoId() const | 350 const AtomicString& MediaControlPlayButtonElement::shadowPseudoId() const |
351 { | 351 { |
352 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-play-button",
AtomicString::ConstructFromLiteral)); | 352 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-play-button",
AtomicString::ConstructFromLiteral)); |
353 return id; | 353 return id; |
354 } | 354 } |
355 | 355 |
356 // ---------------------------- | 356 // ---------------------------- |
357 | 357 |
358 MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement(Docum
ent& document) | 358 MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement(Docum
ent& document) |
359 : MediaControlInputElement(document, MediaOverlayPlayButton) | 359 : MediaControlInputElement(document, MediaOverlayPlayButton) |
| 360 , m_visible(false) |
360 { | 361 { |
361 } | 362 } |
362 | 363 |
363 PassRefPtr<MediaControlOverlayPlayButtonElement> MediaControlOverlayPlayButtonEl
ement::create(Document& document) | 364 PassRefPtr<MediaControlOverlayPlayButtonElement> MediaControlOverlayPlayButtonEl
ement::create(Document& document) |
364 { | 365 { |
365 RefPtr<MediaControlOverlayPlayButtonElement> button = adoptRef(new MediaCont
rolOverlayPlayButtonElement(document)); | 366 RefPtr<MediaControlOverlayPlayButtonElement> button = adoptRef(new MediaCont
rolOverlayPlayButtonElement(document)); |
366 button->ensureUserAgentShadowRoot(); | 367 button->ensureUserAgentShadowRoot(); |
367 button->setType("button"); | 368 button->setType("button"); |
368 return button.release(); | 369 return button.release(); |
369 } | 370 } |
370 | 371 |
371 void MediaControlOverlayPlayButtonElement::defaultEventHandler(Event* event) | 372 void MediaControlOverlayPlayButtonElement::defaultEventHandler(Event* event) |
372 { | 373 { |
373 if (event->type() == EventTypeNames::click && mediaController()->canPlay())
{ | 374 if (event->type() == EventTypeNames::click && mediaController()->canPlay())
{ |
374 mediaController()->play(); | 375 mediaController()->play(); |
375 updateDisplayType(); | 376 updateDisplayType(); |
376 event->setDefaultHandled(); | 377 event->setDefaultHandled(); |
377 } | 378 } |
378 HTMLInputElement::defaultEventHandler(event); | 379 HTMLInputElement::defaultEventHandler(event); |
379 } | 380 } |
380 | 381 |
381 void MediaControlOverlayPlayButtonElement::updateDisplayType() | 382 void MediaControlOverlayPlayButtonElement::updateDisplayType() |
382 { | 383 { |
383 if (mediaController()->canPlay()) { | 384 if (m_visible && mediaController()->canPlay()) { |
384 show(); | 385 show(); |
385 } else | 386 } else |
386 hide(); | 387 hide(); |
387 } | 388 } |
388 | 389 |
| 390 void MediaControlOverlayPlayButtonElement::setVisible(bool visible) |
| 391 { |
| 392 m_visible = visible; |
| 393 } |
| 394 |
389 const AtomicString& MediaControlOverlayPlayButtonElement::shadowPseudoId() const | 395 const AtomicString& MediaControlOverlayPlayButtonElement::shadowPseudoId() const |
390 { | 396 { |
391 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-play-
button", AtomicString::ConstructFromLiteral)); | 397 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-play-
button", AtomicString::ConstructFromLiteral)); |
392 return id; | 398 return id; |
393 } | 399 } |
394 | 400 |
395 | 401 |
396 // ---------------------------- | 402 // ---------------------------- |
397 | 403 |
398 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB
uttonElement(Document& document, MediaControls*) | 404 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB
uttonElement(Document& document, MediaControls*) |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 float fontSize = smallestDimension * 0.05f; | 752 float fontSize = smallestDimension * 0.05f; |
747 if (fontSize != m_fontSize) { | 753 if (fontSize != m_fontSize) { |
748 m_fontSize = fontSize; | 754 m_fontSize = fontSize; |
749 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); | 755 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); |
750 } | 756 } |
751 } | 757 } |
752 | 758 |
753 // ---------------------------- | 759 // ---------------------------- |
754 | 760 |
755 } // namespace WebCore | 761 } // namespace WebCore |
OLD | NEW |