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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // ---------------------------- | 214 // ---------------------------- |
215 | 215 |
216 MediaControlMuteButtonElement::MediaControlMuteButtonElement(MediaControls& medi
aControls) | 216 MediaControlMuteButtonElement::MediaControlMuteButtonElement(MediaControls& medi
aControls) |
217 : MediaControlInputElement(mediaControls, MediaMuteButton) | 217 : MediaControlInputElement(mediaControls, MediaMuteButton) |
218 { | 218 { |
219 } | 219 } |
220 | 220 |
221 PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElem
ent::create(MediaControls& mediaControls) | 221 PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElem
ent::create(MediaControls& mediaControls) |
222 { | 222 { |
223 RefPtrWillBeRawPtr<MediaControlMuteButtonElement> button = adoptRefWillBeNoo
p(new MediaControlMuteButtonElement(mediaControls)); | 223 RefPtrWillBeRawPtr<MediaControlMuteButtonElement> button = adoptRefWillBeNoo
p(new MediaControlMuteButtonElement(mediaControls)); |
224 button->ensureUserAgentShadowRoot(); | 224 button->ensureClosedShadowRoot(); |
225 button->setType(InputTypeNames::button); | 225 button->setType(InputTypeNames::button); |
226 button->setShadowPseudoId(AtomicString("-webkit-media-controls-mute-button",
AtomicString::ConstructFromLiteral)); | 226 button->setShadowPseudoId(AtomicString("-webkit-media-controls-mute-button",
AtomicString::ConstructFromLiteral)); |
227 return button.release(); | 227 return button.release(); |
228 } | 228 } |
229 | 229 |
230 void MediaControlMuteButtonElement::defaultEventHandler(Event* event) | 230 void MediaControlMuteButtonElement::defaultEventHandler(Event* event) |
231 { | 231 { |
232 if (event->type() == EventTypeNames::click) { | 232 if (event->type() == EventTypeNames::click) { |
233 mediaElement().setMuted(!mediaElement().muted()); | 233 mediaElement().setMuted(!mediaElement().muted()); |
234 event->setDefaultHandled(); | 234 event->setDefaultHandled(); |
(...skipping 10 matching lines...) Expand all Loading... |
245 // ---------------------------- | 245 // ---------------------------- |
246 | 246 |
247 MediaControlPlayButtonElement::MediaControlPlayButtonElement(MediaControls& medi
aControls) | 247 MediaControlPlayButtonElement::MediaControlPlayButtonElement(MediaControls& medi
aControls) |
248 : MediaControlInputElement(mediaControls, MediaPlayButton) | 248 : MediaControlInputElement(mediaControls, MediaPlayButton) |
249 { | 249 { |
250 } | 250 } |
251 | 251 |
252 PassRefPtrWillBeRawPtr<MediaControlPlayButtonElement> MediaControlPlayButtonElem
ent::create(MediaControls& mediaControls) | 252 PassRefPtrWillBeRawPtr<MediaControlPlayButtonElement> MediaControlPlayButtonElem
ent::create(MediaControls& mediaControls) |
253 { | 253 { |
254 RefPtrWillBeRawPtr<MediaControlPlayButtonElement> button = adoptRefWillBeNoo
p(new MediaControlPlayButtonElement(mediaControls)); | 254 RefPtrWillBeRawPtr<MediaControlPlayButtonElement> button = adoptRefWillBeNoo
p(new MediaControlPlayButtonElement(mediaControls)); |
255 button->ensureUserAgentShadowRoot(); | 255 button->ensureClosedShadowRoot(); |
256 button->setType(InputTypeNames::button); | 256 button->setType(InputTypeNames::button); |
257 button->setShadowPseudoId(AtomicString("-webkit-media-controls-play-button",
AtomicString::ConstructFromLiteral)); | 257 button->setShadowPseudoId(AtomicString("-webkit-media-controls-play-button",
AtomicString::ConstructFromLiteral)); |
258 return button.release(); | 258 return button.release(); |
259 } | 259 } |
260 | 260 |
261 void MediaControlPlayButtonElement::defaultEventHandler(Event* event) | 261 void MediaControlPlayButtonElement::defaultEventHandler(Event* event) |
262 { | 262 { |
263 if (event->type() == EventTypeNames::click) { | 263 if (event->type() == EventTypeNames::click) { |
264 mediaElement().togglePlayState(); | 264 mediaElement().togglePlayState(); |
265 updateDisplayType(); | 265 updateDisplayType(); |
(...skipping 10 matching lines...) Expand all Loading... |
276 // ---------------------------- | 276 // ---------------------------- |
277 | 277 |
278 MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement(Media
Controls& mediaControls) | 278 MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement(Media
Controls& mediaControls) |
279 : MediaControlInputElement(mediaControls, MediaOverlayPlayButton) | 279 : MediaControlInputElement(mediaControls, MediaOverlayPlayButton) |
280 { | 280 { |
281 } | 281 } |
282 | 282 |
283 PassRefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> MediaControlOverlay
PlayButtonElement::create(MediaControls& mediaControls) | 283 PassRefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> MediaControlOverlay
PlayButtonElement::create(MediaControls& mediaControls) |
284 { | 284 { |
285 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> button = adoptRefWi
llBeNoop(new MediaControlOverlayPlayButtonElement(mediaControls)); | 285 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> button = adoptRefWi
llBeNoop(new MediaControlOverlayPlayButtonElement(mediaControls)); |
286 button->ensureUserAgentShadowRoot(); | 286 button->ensureClosedShadowRoot(); |
287 button->setType(InputTypeNames::button); | 287 button->setType(InputTypeNames::button); |
288 button->setShadowPseudoId(AtomicString("-webkit-media-controls-overlay-play-
button", AtomicString::ConstructFromLiteral)); | 288 button->setShadowPseudoId(AtomicString("-webkit-media-controls-overlay-play-
button", AtomicString::ConstructFromLiteral)); |
289 return button.release(); | 289 return button.release(); |
290 } | 290 } |
291 | 291 |
292 void MediaControlOverlayPlayButtonElement::defaultEventHandler(Event* event) | 292 void MediaControlOverlayPlayButtonElement::defaultEventHandler(Event* event) |
293 { | 293 { |
294 if (event->type() == EventTypeNames::click && mediaElement().togglePlayState
WillPlay()) { | 294 if (event->type() == EventTypeNames::click && mediaElement().togglePlayState
WillPlay()) { |
295 mediaElement().togglePlayState(); | 295 mediaElement().togglePlayState(); |
296 updateDisplayType(); | 296 updateDisplayType(); |
(...skipping 18 matching lines...) Expand all Loading... |
315 // ---------------------------- | 315 // ---------------------------- |
316 | 316 |
317 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB
uttonElement(MediaControls& mediaControls) | 317 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB
uttonElement(MediaControls& mediaControls) |
318 : MediaControlInputElement(mediaControls, MediaShowClosedCaptionsButton) | 318 : MediaControlInputElement(mediaControls, MediaShowClosedCaptionsButton) |
319 { | 319 { |
320 } | 320 } |
321 | 321 |
322 PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr
olToggleClosedCaptionsButtonElement::create(MediaControls& mediaControls) | 322 PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr
olToggleClosedCaptionsButtonElement::create(MediaControls& mediaControls) |
323 { | 323 { |
324 RefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> button = a
doptRefWillBeNoop(new MediaControlToggleClosedCaptionsButtonElement(mediaControl
s)); | 324 RefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> button = a
doptRefWillBeNoop(new MediaControlToggleClosedCaptionsButtonElement(mediaControl
s)); |
325 button->ensureUserAgentShadowRoot(); | 325 button->ensureClosedShadowRoot(); |
326 button->setType(InputTypeNames::button); | 326 button->setType(InputTypeNames::button); |
327 button->setShadowPseudoId(AtomicString("-webkit-media-controls-toggle-closed
-captions-button", AtomicString::ConstructFromLiteral)); | 327 button->setShadowPseudoId(AtomicString("-webkit-media-controls-toggle-closed
-captions-button", AtomicString::ConstructFromLiteral)); |
328 button->hide(); | 328 button->hide(); |
329 return button.release(); | 329 return button.release(); |
330 } | 330 } |
331 | 331 |
332 void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType() | 332 void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType() |
333 { | 333 { |
334 bool captionsVisible = mediaElement().closedCaptionsVisible(); | 334 bool captionsVisible = mediaElement().closedCaptionsVisible(); |
335 setDisplayType(captionsVisible ? MediaHideClosedCaptionsButton : MediaShowCl
osedCaptionsButton); | 335 setDisplayType(captionsVisible ? MediaHideClosedCaptionsButton : MediaShowCl
osedCaptionsButton); |
(...skipping 15 matching lines...) Expand all Loading... |
351 // ---------------------------- | 351 // ---------------------------- |
352 | 352 |
353 MediaControlTimelineElement::MediaControlTimelineElement(MediaControls& mediaCon
trols) | 353 MediaControlTimelineElement::MediaControlTimelineElement(MediaControls& mediaCon
trols) |
354 : MediaControlInputElement(mediaControls, MediaSlider) | 354 : MediaControlInputElement(mediaControls, MediaSlider) |
355 { | 355 { |
356 } | 356 } |
357 | 357 |
358 PassRefPtrWillBeRawPtr<MediaControlTimelineElement> MediaControlTimelineElement:
:create(MediaControls& mediaControls) | 358 PassRefPtrWillBeRawPtr<MediaControlTimelineElement> MediaControlTimelineElement:
:create(MediaControls& mediaControls) |
359 { | 359 { |
360 RefPtrWillBeRawPtr<MediaControlTimelineElement> timeline = adoptRefWillBeNoo
p(new MediaControlTimelineElement(mediaControls)); | 360 RefPtrWillBeRawPtr<MediaControlTimelineElement> timeline = adoptRefWillBeNoo
p(new MediaControlTimelineElement(mediaControls)); |
361 timeline->ensureUserAgentShadowRoot(); | 361 timeline->ensureClosedShadowRoot(); |
362 timeline->setType(InputTypeNames::range); | 362 timeline->setType(InputTypeNames::range); |
363 timeline->setAttribute(stepAttr, "any"); | 363 timeline->setAttribute(stepAttr, "any"); |
364 timeline->setShadowPseudoId(AtomicString("-webkit-media-controls-timeline",
AtomicString::ConstructFromLiteral)); | 364 timeline->setShadowPseudoId(AtomicString("-webkit-media-controls-timeline",
AtomicString::ConstructFromLiteral)); |
365 return timeline.release(); | 365 return timeline.release(); |
366 } | 366 } |
367 | 367 |
368 void MediaControlTimelineElement::defaultEventHandler(Event* event) | 368 void MediaControlTimelineElement::defaultEventHandler(Event* event) |
369 { | 369 { |
370 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) | 370 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) |
371 return; | 371 return; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // ---------------------------- | 424 // ---------------------------- |
425 | 425 |
426 MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(MediaControls&
mediaControls) | 426 MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(MediaControls&
mediaControls) |
427 : MediaControlInputElement(mediaControls, MediaVolumeSlider) | 427 : MediaControlInputElement(mediaControls, MediaVolumeSlider) |
428 { | 428 { |
429 } | 429 } |
430 | 430 |
431 PassRefPtrWillBeRawPtr<MediaControlVolumeSliderElement> MediaControlVolumeSlider
Element::create(MediaControls& mediaControls) | 431 PassRefPtrWillBeRawPtr<MediaControlVolumeSliderElement> MediaControlVolumeSlider
Element::create(MediaControls& mediaControls) |
432 { | 432 { |
433 RefPtrWillBeRawPtr<MediaControlVolumeSliderElement> slider = adoptRefWillBeN
oop(new MediaControlVolumeSliderElement(mediaControls)); | 433 RefPtrWillBeRawPtr<MediaControlVolumeSliderElement> slider = adoptRefWillBeN
oop(new MediaControlVolumeSliderElement(mediaControls)); |
434 slider->ensureUserAgentShadowRoot(); | 434 slider->ensureClosedShadowRoot(); |
435 slider->setType(InputTypeNames::range); | 435 slider->setType(InputTypeNames::range); |
436 slider->setAttribute(stepAttr, "any"); | 436 slider->setAttribute(stepAttr, "any"); |
437 slider->setAttribute(maxAttr, "1"); | 437 slider->setAttribute(maxAttr, "1"); |
438 slider->setShadowPseudoId(AtomicString("-webkit-media-controls-volume-slider
", AtomicString::ConstructFromLiteral)); | 438 slider->setShadowPseudoId(AtomicString("-webkit-media-controls-volume-slider
", AtomicString::ConstructFromLiteral)); |
439 return slider.release(); | 439 return slider.release(); |
440 } | 440 } |
441 | 441 |
442 void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) | 442 void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) |
443 { | 443 { |
444 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) | 444 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 // ---------------------------- | 487 // ---------------------------- |
488 | 488 |
489 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(MediaCo
ntrols& mediaControls) | 489 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(MediaCo
ntrols& mediaControls) |
490 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton) | 490 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton) |
491 { | 491 { |
492 } | 492 } |
493 | 493 |
494 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre
enButtonElement::create(MediaControls& mediaControls) | 494 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre
enButtonElement::create(MediaControls& mediaControls) |
495 { | 495 { |
496 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil
lBeNoop(new MediaControlFullscreenButtonElement(mediaControls)); | 496 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil
lBeNoop(new MediaControlFullscreenButtonElement(mediaControls)); |
497 button->ensureUserAgentShadowRoot(); | 497 button->ensureClosedShadowRoot(); |
498 button->setType(InputTypeNames::button); | 498 button->setType(InputTypeNames::button); |
499 button->setShadowPseudoId(AtomicString("-webkit-media-controls-fullscreen-bu
tton", AtomicString::ConstructFromLiteral)); | 499 button->setShadowPseudoId(AtomicString("-webkit-media-controls-fullscreen-bu
tton", AtomicString::ConstructFromLiteral)); |
500 button->hide(); | 500 button->hide(); |
501 return button.release(); | 501 return button.release(); |
502 } | 502 } |
503 | 503 |
504 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) | 504 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) |
505 { | 505 { |
506 if (event->type() == EventTypeNames::click) { | 506 if (event->type() == EventTypeNames::click) { |
507 if (mediaElement().isFullscreen()) | 507 if (mediaElement().isFullscreen()) |
(...skipping 14 matching lines...) Expand all Loading... |
522 | 522 |
523 MediaControlCastButtonElement::MediaControlCastButtonElement(MediaControls& medi
aControls, bool isOverlayButton) | 523 MediaControlCastButtonElement::MediaControlCastButtonElement(MediaControls& medi
aControls, bool isOverlayButton) |
524 : MediaControlInputElement(mediaControls, MediaCastOnButton), m_isOverlayBut
ton(isOverlayButton) | 524 : MediaControlInputElement(mediaControls, MediaCastOnButton), m_isOverlayBut
ton(isOverlayButton) |
525 { | 525 { |
526 setIsPlayingRemotely(false); | 526 setIsPlayingRemotely(false); |
527 } | 527 } |
528 | 528 |
529 PassRefPtrWillBeRawPtr<MediaControlCastButtonElement> MediaControlCastButtonElem
ent::create(MediaControls& mediaControls, bool isOverlayButton) | 529 PassRefPtrWillBeRawPtr<MediaControlCastButtonElement> MediaControlCastButtonElem
ent::create(MediaControls& mediaControls, bool isOverlayButton) |
530 { | 530 { |
531 RefPtrWillBeRawPtr<MediaControlCastButtonElement> button = adoptRefWillBeNoo
p(new MediaControlCastButtonElement(mediaControls, isOverlayButton)); | 531 RefPtrWillBeRawPtr<MediaControlCastButtonElement> button = adoptRefWillBeNoo
p(new MediaControlCastButtonElement(mediaControls, isOverlayButton)); |
532 button->ensureUserAgentShadowRoot(); | 532 button->ensureClosedShadowRoot(); |
533 button->setType(InputTypeNames::button); | 533 button->setType(InputTypeNames::button); |
534 return button.release(); | 534 return button.release(); |
535 } | 535 } |
536 | 536 |
537 void MediaControlCastButtonElement::defaultEventHandler(Event* event) | 537 void MediaControlCastButtonElement::defaultEventHandler(Event* event) |
538 { | 538 { |
539 if (event->type() == EventTypeNames::click) { | 539 if (event->type() == EventTypeNames::click) { |
540 if (mediaElement().isPlayingRemotely()) { | 540 if (mediaElement().isPlayingRemotely()) { |
541 mediaElement().requestRemotePlaybackControl(); | 541 mediaElement().requestRemotePlaybackControl(); |
542 } else { | 542 } else { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 float fontSize = smallestDimension * 0.05f; | 711 float fontSize = smallestDimension * 0.05f; |
712 if (fontSize != m_fontSize) { | 712 if (fontSize != m_fontSize) { |
713 m_fontSize = fontSize; | 713 m_fontSize = fontSize; |
714 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); | 714 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); |
715 } | 715 } |
716 } | 716 } |
717 | 717 |
718 // ---------------------------- | 718 // ---------------------------- |
719 | 719 |
720 } // namespace blink | 720 } // namespace blink |
OLD | NEW |