Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: Source/core/html/shadow/MediaControlElements.cpp

Issue 716873002: Use InputTypeNames more in MediaControlElements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/html/shadow/MediaControlElements.h" 31 #include "core/html/shadow/MediaControlElements.h"
32 32
33 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 33 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
34 #include "core/InputTypeNames.h"
34 #include "core/dom/DOMTokenList.h" 35 #include "core/dom/DOMTokenList.h"
35 #include "core/dom/shadow/ShadowRoot.h" 36 #include "core/dom/shadow/ShadowRoot.h"
36 #include "core/events/MouseEvent.h" 37 #include "core/events/MouseEvent.h"
37 #include "core/frame/LocalFrame.h" 38 #include "core/frame/LocalFrame.h"
38 #include "core/html/HTMLVideoElement.h" 39 #include "core/html/HTMLVideoElement.h"
39 #include "core/html/MediaController.h" 40 #include "core/html/MediaController.h"
40 #include "core/html/TimeRanges.h" 41 #include "core/html/TimeRanges.h"
41 #include "core/html/shadow/MediaControls.h" 42 #include "core/html/shadow/MediaControls.h"
42 #include "core/html/track/TextTrack.h" 43 #include "core/html/track/TextTrack.h"
43 #include "core/html/track/vtt/VTTRegionList.h" 44 #include "core/html/track/vtt/VTTRegionList.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 228
228 MediaControlMuteButtonElement::MediaControlMuteButtonElement(MediaControls& medi aControls) 229 MediaControlMuteButtonElement::MediaControlMuteButtonElement(MediaControls& medi aControls)
229 : MediaControlInputElement(mediaControls, MediaMuteButton) 230 : MediaControlInputElement(mediaControls, MediaMuteButton)
230 { 231 {
231 } 232 }
232 233
233 PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElem ent::create(MediaControls& mediaControls) 234 PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElem ent::create(MediaControls& mediaControls)
234 { 235 {
235 RefPtrWillBeRawPtr<MediaControlMuteButtonElement> button = adoptRefWillBeNoo p(new MediaControlMuteButtonElement(mediaControls)); 236 RefPtrWillBeRawPtr<MediaControlMuteButtonElement> button = adoptRefWillBeNoo p(new MediaControlMuteButtonElement(mediaControls));
236 button->ensureUserAgentShadowRoot(); 237 button->ensureUserAgentShadowRoot();
237 button->setType("button"); 238 button->setType(InputTypeNames::button);
238 return button.release(); 239 return button.release();
239 } 240 }
240 241
241 void MediaControlMuteButtonElement::defaultEventHandler(Event* event) 242 void MediaControlMuteButtonElement::defaultEventHandler(Event* event)
242 { 243 {
243 if (event->type() == EventTypeNames::click) { 244 if (event->type() == EventTypeNames::click) {
244 mediaElement().setMuted(!mediaElement().muted()); 245 mediaElement().setMuted(!mediaElement().muted());
245 event->setDefaultHandled(); 246 event->setDefaultHandled();
246 } 247 }
247 248
(...skipping 15 matching lines...) Expand all
263 264
264 MediaControlPlayButtonElement::MediaControlPlayButtonElement(MediaControls& medi aControls) 265 MediaControlPlayButtonElement::MediaControlPlayButtonElement(MediaControls& medi aControls)
265 : MediaControlInputElement(mediaControls, MediaPlayButton) 266 : MediaControlInputElement(mediaControls, MediaPlayButton)
266 { 267 {
267 } 268 }
268 269
269 PassRefPtrWillBeRawPtr<MediaControlPlayButtonElement> MediaControlPlayButtonElem ent::create(MediaControls& mediaControls) 270 PassRefPtrWillBeRawPtr<MediaControlPlayButtonElement> MediaControlPlayButtonElem ent::create(MediaControls& mediaControls)
270 { 271 {
271 RefPtrWillBeRawPtr<MediaControlPlayButtonElement> button = adoptRefWillBeNoo p(new MediaControlPlayButtonElement(mediaControls)); 272 RefPtrWillBeRawPtr<MediaControlPlayButtonElement> button = adoptRefWillBeNoo p(new MediaControlPlayButtonElement(mediaControls));
272 button->ensureUserAgentShadowRoot(); 273 button->ensureUserAgentShadowRoot();
273 button->setType("button"); 274 button->setType(InputTypeNames::button);
274 return button.release(); 275 return button.release();
275 } 276 }
276 277
277 void MediaControlPlayButtonElement::defaultEventHandler(Event* event) 278 void MediaControlPlayButtonElement::defaultEventHandler(Event* event)
278 { 279 {
279 if (event->type() == EventTypeNames::click) { 280 if (event->type() == EventTypeNames::click) {
280 mediaElement().togglePlayState(); 281 mediaElement().togglePlayState();
281 updateDisplayType(); 282 updateDisplayType();
282 event->setDefaultHandled(); 283 event->setDefaultHandled();
283 } 284 }
(...skipping 15 matching lines...) Expand all
299 300
300 MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement(Media Controls& mediaControls) 301 MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement(Media Controls& mediaControls)
301 : MediaControlInputElement(mediaControls, MediaOverlayPlayButton) 302 : MediaControlInputElement(mediaControls, MediaOverlayPlayButton)
302 { 303 {
303 } 304 }
304 305
305 PassRefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> MediaControlOverlay PlayButtonElement::create(MediaControls& mediaControls) 306 PassRefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> MediaControlOverlay PlayButtonElement::create(MediaControls& mediaControls)
306 { 307 {
307 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> button = adoptRefWi llBeNoop(new MediaControlOverlayPlayButtonElement(mediaControls)); 308 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> button = adoptRefWi llBeNoop(new MediaControlOverlayPlayButtonElement(mediaControls));
308 button->ensureUserAgentShadowRoot(); 309 button->ensureUserAgentShadowRoot();
309 button->setType("button"); 310 button->setType(InputTypeNames::button);
310 return button.release(); 311 return button.release();
311 } 312 }
312 313
313 void MediaControlOverlayPlayButtonElement::defaultEventHandler(Event* event) 314 void MediaControlOverlayPlayButtonElement::defaultEventHandler(Event* event)
314 { 315 {
315 if (event->type() == EventTypeNames::click && mediaElement().togglePlayState WillPlay()) { 316 if (event->type() == EventTypeNames::click && mediaElement().togglePlayState WillPlay()) {
316 mediaElement().togglePlayState(); 317 mediaElement().togglePlayState();
317 updateDisplayType(); 318 updateDisplayType();
318 event->setDefaultHandled(); 319 event->setDefaultHandled();
319 } 320 }
(...skipping 23 matching lines...) Expand all
343 344
344 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB uttonElement(MediaControls& mediaControls) 345 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB uttonElement(MediaControls& mediaControls)
345 : MediaControlInputElement(mediaControls, MediaShowClosedCaptionsButton) 346 : MediaControlInputElement(mediaControls, MediaShowClosedCaptionsButton)
346 { 347 {
347 } 348 }
348 349
349 PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr olToggleClosedCaptionsButtonElement::create(MediaControls& mediaControls) 350 PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr olToggleClosedCaptionsButtonElement::create(MediaControls& mediaControls)
350 { 351 {
351 RefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> button = a doptRefWillBeNoop(new MediaControlToggleClosedCaptionsButtonElement(mediaControl s)); 352 RefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> button = a doptRefWillBeNoop(new MediaControlToggleClosedCaptionsButtonElement(mediaControl s));
352 button->ensureUserAgentShadowRoot(); 353 button->ensureUserAgentShadowRoot();
353 button->setType("button"); 354 button->setType(InputTypeNames::button);
354 button->hide(); 355 button->hide();
355 return button.release(); 356 return button.release();
356 } 357 }
357 358
358 void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType() 359 void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType()
359 { 360 {
360 bool captionsVisible = mediaElement().closedCaptionsVisible(); 361 bool captionsVisible = mediaElement().closedCaptionsVisible();
361 setDisplayType(captionsVisible ? MediaHideClosedCaptionsButton : MediaShowCl osedCaptionsButton); 362 setDisplayType(captionsVisible ? MediaHideClosedCaptionsButton : MediaShowCl osedCaptionsButton);
362 setChecked(captionsVisible); 363 setChecked(captionsVisible);
363 } 364 }
(...skipping 20 matching lines...) Expand all
384 385
385 MediaControlTimelineElement::MediaControlTimelineElement(MediaControls& mediaCon trols) 386 MediaControlTimelineElement::MediaControlTimelineElement(MediaControls& mediaCon trols)
386 : MediaControlInputElement(mediaControls, MediaSlider) 387 : MediaControlInputElement(mediaControls, MediaSlider)
387 { 388 {
388 } 389 }
389 390
390 PassRefPtrWillBeRawPtr<MediaControlTimelineElement> MediaControlTimelineElement: :create(MediaControls& mediaControls) 391 PassRefPtrWillBeRawPtr<MediaControlTimelineElement> MediaControlTimelineElement: :create(MediaControls& mediaControls)
391 { 392 {
392 RefPtrWillBeRawPtr<MediaControlTimelineElement> timeline = adoptRefWillBeNoo p(new MediaControlTimelineElement(mediaControls)); 393 RefPtrWillBeRawPtr<MediaControlTimelineElement> timeline = adoptRefWillBeNoo p(new MediaControlTimelineElement(mediaControls));
393 timeline->ensureUserAgentShadowRoot(); 394 timeline->ensureUserAgentShadowRoot();
394 timeline->setType("range"); 395 timeline->setType(InputTypeNames::range);
395 timeline->setAttribute(stepAttr, "any"); 396 timeline->setAttribute(stepAttr, "any");
396 return timeline.release(); 397 return timeline.release();
397 } 398 }
398 399
399 void MediaControlTimelineElement::defaultEventHandler(Event* event) 400 void MediaControlTimelineElement::defaultEventHandler(Event* event)
400 { 401 {
401 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) 402 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton)
402 return; 403 return;
403 404
404 if (!inDocument() || !document().isActive()) 405 if (!inDocument() || !document().isActive())
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 463
463 MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(MediaControls& mediaControls) 464 MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(MediaControls& mediaControls)
464 : MediaControlInputElement(mediaControls, MediaVolumeSlider) 465 : MediaControlInputElement(mediaControls, MediaVolumeSlider)
465 { 466 {
466 } 467 }
467 468
468 PassRefPtrWillBeRawPtr<MediaControlVolumeSliderElement> MediaControlVolumeSlider Element::create(MediaControls& mediaControls) 469 PassRefPtrWillBeRawPtr<MediaControlVolumeSliderElement> MediaControlVolumeSlider Element::create(MediaControls& mediaControls)
469 { 470 {
470 RefPtrWillBeRawPtr<MediaControlVolumeSliderElement> slider = adoptRefWillBeN oop(new MediaControlVolumeSliderElement(mediaControls)); 471 RefPtrWillBeRawPtr<MediaControlVolumeSliderElement> slider = adoptRefWillBeN oop(new MediaControlVolumeSliderElement(mediaControls));
471 slider->ensureUserAgentShadowRoot(); 472 slider->ensureUserAgentShadowRoot();
472 slider->setType("range"); 473 slider->setType(InputTypeNames::range);
473 slider->setAttribute(stepAttr, "any"); 474 slider->setAttribute(stepAttr, "any");
474 slider->setAttribute(maxAttr, "1"); 475 slider->setAttribute(maxAttr, "1");
475 return slider.release(); 476 return slider.release();
476 } 477 }
477 478
478 void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) 479 void MediaControlVolumeSliderElement::defaultEventHandler(Event* event)
479 { 480 {
480 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton) 481 if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton)
481 return; 482 return;
482 483
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 531
531 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(MediaCo ntrols& mediaControls) 532 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(MediaCo ntrols& mediaControls)
532 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton) 533 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton)
533 { 534 {
534 } 535 }
535 536
536 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre enButtonElement::create(MediaControls& mediaControls) 537 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre enButtonElement::create(MediaControls& mediaControls)
537 { 538 {
538 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil lBeNoop(new MediaControlFullscreenButtonElement(mediaControls)); 539 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil lBeNoop(new MediaControlFullscreenButtonElement(mediaControls));
539 button->ensureUserAgentShadowRoot(); 540 button->ensureUserAgentShadowRoot();
540 button->setType("button"); 541 button->setType(InputTypeNames::button);
541 button->hide(); 542 button->hide();
542 return button.release(); 543 return button.release();
543 } 544 }
544 545
545 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) 546 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
546 { 547 {
547 if (event->type() == EventTypeNames::click) { 548 if (event->type() == EventTypeNames::click) {
548 if (mediaElement().isFullscreen()) 549 if (mediaElement().isFullscreen())
549 mediaElement().exitFullscreen(); 550 mediaElement().exitFullscreen();
550 else 551 else
(...skipping 18 matching lines...) Expand all
569 570
570 MediaControlCastButtonElement::MediaControlCastButtonElement(MediaControls& medi aControls, bool isOverlayButton) 571 MediaControlCastButtonElement::MediaControlCastButtonElement(MediaControls& medi aControls, bool isOverlayButton)
571 : MediaControlInputElement(mediaControls, MediaCastOnButton), m_isOverlayBut ton(isOverlayButton) 572 : MediaControlInputElement(mediaControls, MediaCastOnButton), m_isOverlayBut ton(isOverlayButton)
572 { 573 {
573 } 574 }
574 575
575 PassRefPtrWillBeRawPtr<MediaControlCastButtonElement> MediaControlCastButtonElem ent::create(MediaControls& mediaControls, bool isOverlayButton) 576 PassRefPtrWillBeRawPtr<MediaControlCastButtonElement> MediaControlCastButtonElem ent::create(MediaControls& mediaControls, bool isOverlayButton)
576 { 577 {
577 RefPtrWillBeRawPtr<MediaControlCastButtonElement> button = adoptRefWillBeNoo p(new MediaControlCastButtonElement(mediaControls, isOverlayButton)); 578 RefPtrWillBeRawPtr<MediaControlCastButtonElement> button = adoptRefWillBeNoo p(new MediaControlCastButtonElement(mediaControls, isOverlayButton));
578 button->ensureUserAgentShadowRoot(); 579 button->ensureUserAgentShadowRoot();
579 button->setType("button"); 580 button->setType(InputTypeNames::button);
580 return button.release(); 581 return button.release();
581 } 582 }
582 583
583 void MediaControlCastButtonElement::defaultEventHandler(Event* event) 584 void MediaControlCastButtonElement::defaultEventHandler(Event* event)
584 { 585 {
585 if (event->type() == EventTypeNames::click) { 586 if (event->type() == EventTypeNames::click) {
586 if (mediaElement().isPlayingRemotely()) { 587 if (mediaElement().isPlayingRemotely()) {
587 mediaElement().requestRemotePlaybackControl(); 588 mediaElement().requestRemotePlaybackControl();
588 } else { 589 } else {
589 mediaElement().requestRemotePlayback(); 590 mediaElement().requestRemotePlayback();
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 float fontSize = smallestDimension * 0.05f; 774 float fontSize = smallestDimension * 0.05f;
774 if (fontSize != m_fontSize) { 775 if (fontSize != m_fontSize) {
775 m_fontSize = fontSize; 776 m_fontSize = fontSize;
776 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); 777 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX);
777 } 778 }
778 } 779 }
779 780
780 // ---------------------------- 781 // ----------------------------
781 782
782 } // namespace blink 783 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698