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

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

Issue 662243003: Use ::-internal-media-controls* instead of ::-webkit-media-controls* (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: introduce PseudoInternalCustomElement Created 6 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/html/shadow/MediaControls.cpp » ('j') | 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 { 93 {
94 } 94 }
95 95
96 PassRefPtrWillBeRawPtr<MediaControlPanelElement> MediaControlPanelElement::creat e(MediaControls& mediaControls) 96 PassRefPtrWillBeRawPtr<MediaControlPanelElement> MediaControlPanelElement::creat e(MediaControls& mediaControls)
97 { 97 {
98 return adoptRefWillBeNoop(new MediaControlPanelElement(mediaControls)); 98 return adoptRefWillBeNoop(new MediaControlPanelElement(mediaControls));
99 } 99 }
100 100
101 const AtomicString& MediaControlPanelElement::shadowPseudoId() const 101 const AtomicString& MediaControlPanelElement::shadowPseudoId() const
102 { 102 {
103 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-panel", Atomi cString::ConstructFromLiteral)); 103 DEFINE_STATIC_LOCAL(AtomicString, id, ("-internal-media-controls-panel", Ato micString::ConstructFromLiteral));
104 return id; 104 return id;
105 } 105 }
106 106
107 void MediaControlPanelElement::defaultEventHandler(Event* event) 107 void MediaControlPanelElement::defaultEventHandler(Event* event)
108 { 108 {
109 // Suppress the media element activation behavior (toggle play/pause) when 109 // Suppress the media element activation behavior (toggle play/pause) when
110 // any part of the control panel is clicked. 110 // any part of the control panel is clicked.
111 if (event->type() == EventTypeNames::click) { 111 if (event->type() == EventTypeNames::click) {
112 event->setDefaultHandled(); 112 event->setDefaultHandled();
113 return; 113 return;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 { 181 {
182 } 182 }
183 183
184 PassRefPtrWillBeRawPtr<MediaControlPanelEnclosureElement> MediaControlPanelEnclo sureElement::create(MediaControls& mediaControls) 184 PassRefPtrWillBeRawPtr<MediaControlPanelEnclosureElement> MediaControlPanelEnclo sureElement::create(MediaControls& mediaControls)
185 { 185 {
186 return adoptRefWillBeNoop(new MediaControlPanelEnclosureElement(mediaControl s)); 186 return adoptRefWillBeNoop(new MediaControlPanelEnclosureElement(mediaControl s));
187 } 187 }
188 188
189 const AtomicString& MediaControlPanelEnclosureElement::shadowPseudoId() const 189 const AtomicString& MediaControlPanelEnclosureElement::shadowPseudoId() const
190 { 190 {
191 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-enclosure", A tomicString::ConstructFromLiteral)); 191 DEFINE_STATIC_LOCAL(AtomicString, id, ("-internal-media-controls-enclosure", AtomicString::ConstructFromLiteral));
192 return id; 192 return id;
193 } 193 }
194 194
195 // ---------------------------- 195 // ----------------------------
196 196
197 MediaControlOverlayEnclosureElement::MediaControlOverlayEnclosureElement(MediaCo ntrols& mediaControls) 197 MediaControlOverlayEnclosureElement::MediaControlOverlayEnclosureElement(MediaCo ntrols& mediaControls)
198 // Mapping onto same MediaControlElementType as panel element, since it has similar properties. 198 // Mapping onto same MediaControlElementType as panel element, since it has similar properties.
199 : MediaControlDivElement(mediaControls, MediaControlsPanel) 199 : MediaControlDivElement(mediaControls, MediaControlsPanel)
200 { 200 {
201 } 201 }
202 202
203 PassRefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> MediaControlOverlayE nclosureElement::create(MediaControls& mediaControls) 203 PassRefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> MediaControlOverlayE nclosureElement::create(MediaControls& mediaControls)
204 { 204 {
205 return adoptRefWillBeNoop(new MediaControlOverlayEnclosureElement(mediaContr ols)); 205 return adoptRefWillBeNoop(new MediaControlOverlayEnclosureElement(mediaContr ols));
206 } 206 }
207 207
208 const AtomicString& MediaControlOverlayEnclosureElement::shadowPseudoId() const 208 const AtomicString& MediaControlOverlayEnclosureElement::shadowPseudoId() const
209 { 209 {
210 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-enclo sure", AtomicString::ConstructFromLiteral)); 210 DEFINE_STATIC_LOCAL(AtomicString, id, ("-internal-media-controls-overlay-enc losure", AtomicString::ConstructFromLiteral));
211 return id; 211 return id;
212 } 212 }
213 213
214 void* MediaControlOverlayEnclosureElement::preDispatchEventHandler(Event* event) 214 void* MediaControlOverlayEnclosureElement::preDispatchEventHandler(Event* event)
215 { 215 {
216 // When the media element is clicked or touched we want to make the overlay cast button visible 216 // When the media element is clicked or touched we want to make the overlay cast button visible
217 // (if the other requirements are right) even if JavaScript is doing its own handling of the event. 217 // (if the other requirements are right) even if JavaScript is doing its own handling of the event.
218 // Doing it in preDispatchEventHandler prevents any interference from JavaSc ript. 218 // Doing it in preDispatchEventHandler prevents any interference from JavaSc ript.
219 // Note that we can't simply test for click, since JS handling of touch even ts can prevent their translation to click events. 219 // Note that we can't simply test for click, since JS handling of touch even ts can prevent their translation to click events.
220 if (event && (event->type() == EventTypeNames::click || event->type() == Eve ntTypeNames::touchstart) && mediaElement().hasRemoteRoutes() && !mediaElement(). shouldShowControls()) 220 if (event && (event->type() == EventTypeNames::click || event->type() == Eve ntTypeNames::touchstart) && mediaElement().hasRemoteRoutes() && !mediaElement(). shouldShowControls())
(...skipping 27 matching lines...) Expand all
248 HTMLInputElement::defaultEventHandler(event); 248 HTMLInputElement::defaultEventHandler(event);
249 } 249 }
250 250
251 void MediaControlMuteButtonElement::updateDisplayType() 251 void MediaControlMuteButtonElement::updateDisplayType()
252 { 252 {
253 setDisplayType(mediaElement().muted() ? MediaUnMuteButton : MediaMuteButton) ; 253 setDisplayType(mediaElement().muted() ? MediaUnMuteButton : MediaMuteButton) ;
254 } 254 }
255 255
256 const AtomicString& MediaControlMuteButtonElement::shadowPseudoId() const 256 const AtomicString& MediaControlMuteButtonElement::shadowPseudoId() const
257 { 257 {
258 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-mute-button", AtomicString::ConstructFromLiteral)); 258 DEFINE_STATIC_LOCAL(AtomicString, id, ("-internal-media-controls-mute-button ", AtomicString::ConstructFromLiteral));
259 return id; 259 return id;
260 } 260 }
261 261
262 // ---------------------------- 262 // ----------------------------
263 263
264 MediaControlPlayButtonElement::MediaControlPlayButtonElement(MediaControls& medi aControls) 264 MediaControlPlayButtonElement::MediaControlPlayButtonElement(MediaControls& medi aControls)
265 : MediaControlInputElement(mediaControls, MediaPlayButton) 265 : MediaControlInputElement(mediaControls, MediaPlayButton)
266 { 266 {
267 } 267 }
268 268
(...skipping 15 matching lines...) Expand all
284 HTMLInputElement::defaultEventHandler(event); 284 HTMLInputElement::defaultEventHandler(event);
285 } 285 }
286 286
287 void MediaControlPlayButtonElement::updateDisplayType() 287 void MediaControlPlayButtonElement::updateDisplayType()
288 { 288 {
289 setDisplayType(mediaElement().togglePlayStateWillPlay() ? MediaPlayButton : MediaPauseButton); 289 setDisplayType(mediaElement().togglePlayStateWillPlay() ? MediaPlayButton : MediaPauseButton);
290 } 290 }
291 291
292 const AtomicString& MediaControlPlayButtonElement::shadowPseudoId() const 292 const AtomicString& MediaControlPlayButtonElement::shadowPseudoId() const
293 { 293 {
294 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-play-button", AtomicString::ConstructFromLiteral)); 294 DEFINE_STATIC_LOCAL(AtomicString, id, ("-internal-media-controls-play-button ", AtomicString::ConstructFromLiteral));
295 return id; 295 return id;
296 } 296 }
297 297
298 // ---------------------------- 298 // ----------------------------
299 299
300 MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement(Media Controls& mediaControls) 300 MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement(Media Controls& mediaControls)
301 : MediaControlInputElement(mediaControls, MediaOverlayPlayButton) 301 : MediaControlInputElement(mediaControls, MediaOverlayPlayButton)
302 { 302 {
303 } 303 }
304 304
(...skipping 17 matching lines...) Expand all
322 void MediaControlOverlayPlayButtonElement::updateDisplayType() 322 void MediaControlOverlayPlayButtonElement::updateDisplayType()
323 { 323 {
324 if (mediaElement().shouldShowControls() && mediaElement().togglePlayStateWil lPlay()) 324 if (mediaElement().shouldShowControls() && mediaElement().togglePlayStateWil lPlay())
325 show(); 325 show();
326 else 326 else
327 hide(); 327 hide();
328 } 328 }
329 329
330 const AtomicString& MediaControlOverlayPlayButtonElement::shadowPseudoId() const 330 const AtomicString& MediaControlOverlayPlayButtonElement::shadowPseudoId() const
331 { 331 {
332 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-play- button", AtomicString::ConstructFromLiteral)); 332 DEFINE_STATIC_LOCAL(AtomicString, id, ("-internal-media-controls-overlay-pla y-button", AtomicString::ConstructFromLiteral));
333 return id; 333 return id;
334 } 334 }
335 335
336 bool MediaControlOverlayPlayButtonElement::keepEventInNode(Event* event) 336 bool MediaControlOverlayPlayButtonElement::keepEventInNode(Event* event)
337 { 337 {
338 return isUserInteractionEvent(event); 338 return isUserInteractionEvent(event);
339 } 339 }
340 340
341 341
342 // ---------------------------- 342 // ----------------------------
(...skipping 26 matching lines...) Expand all
369 setChecked(mediaElement().closedCaptionsVisible()); 369 setChecked(mediaElement().closedCaptionsVisible());
370 updateDisplayType(); 370 updateDisplayType();
371 event->setDefaultHandled(); 371 event->setDefaultHandled();
372 } 372 }
373 373
374 HTMLInputElement::defaultEventHandler(event); 374 HTMLInputElement::defaultEventHandler(event);
375 } 375 }
376 376
377 const AtomicString& MediaControlToggleClosedCaptionsButtonElement::shadowPseudoI d() const 377 const AtomicString& MediaControlToggleClosedCaptionsButtonElement::shadowPseudoI d() const
378 { 378 {
379 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-toggle-closed -captions-button", AtomicString::ConstructFromLiteral)); 379 DEFINE_STATIC_LOCAL(AtomicString, id, ("-internal-media-controls-toggle-clos ed-captions-button", AtomicString::ConstructFromLiteral));
380 return id; 380 return id;
381 } 381 }
382 382
383 // ---------------------------- 383 // ----------------------------
384 384
385 MediaControlTimelineElement::MediaControlTimelineElement(MediaControls& mediaCon trols) 385 MediaControlTimelineElement::MediaControlTimelineElement(MediaControls& mediaCon trols)
386 : MediaControlInputElement(mediaControls, MediaSlider) 386 : MediaControlInputElement(mediaControls, MediaSlider)
387 { 387 {
388 } 388 }
389 389
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 setValue(String::number(currentTime)); 442 setValue(String::number(currentTime));
443 } 443 }
444 444
445 void MediaControlTimelineElement::setDuration(double duration) 445 void MediaControlTimelineElement::setDuration(double duration)
446 { 446 {
447 setFloatingPointAttribute(maxAttr, std::isfinite(duration) ? duration : 0); 447 setFloatingPointAttribute(maxAttr, std::isfinite(duration) ? duration : 0);
448 } 448 }
449 449
450 const AtomicString& MediaControlTimelineElement::shadowPseudoId() const 450 const AtomicString& MediaControlTimelineElement::shadowPseudoId() const
451 { 451 {
452 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline", At omicString::ConstructFromLiteral)); 452 DEFINE_STATIC_LOCAL(AtomicString, id, ("-internal-media-controls-timeline", AtomicString::ConstructFromLiteral));
453 return id; 453 return id;
454 } 454 }
455 455
456 bool MediaControlTimelineElement::keepEventInNode(Event* event) 456 bool MediaControlTimelineElement::keepEventInNode(Event* event)
457 { 457 {
458 return isUserInteractionEventForSlider(event); 458 return isUserInteractionEventForSlider(event);
459 } 459 }
460 460
461 // ---------------------------- 461 // ----------------------------
462 462
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 510 }
511 511
512 void MediaControlVolumeSliderElement::setVolume(double volume) 512 void MediaControlVolumeSliderElement::setVolume(double volume)
513 { 513 {
514 if (value().toDouble() != volume) 514 if (value().toDouble() != volume)
515 setValue(String::number(volume)); 515 setValue(String::number(volume));
516 } 516 }
517 517
518 const AtomicString& MediaControlVolumeSliderElement::shadowPseudoId() const 518 const AtomicString& MediaControlVolumeSliderElement::shadowPseudoId() const
519 { 519 {
520 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider ", AtomicString::ConstructFromLiteral)); 520 DEFINE_STATIC_LOCAL(AtomicString, id, ("-internal-media-controls-volume-slid er", AtomicString::ConstructFromLiteral));
521 return id; 521 return id;
522 } 522 }
523 523
524 bool MediaControlVolumeSliderElement::keepEventInNode(Event* event) 524 bool MediaControlVolumeSliderElement::keepEventInNode(Event* event)
525 { 525 {
526 return isUserInteractionEventForSlider(event); 526 return isUserInteractionEventForSlider(event);
527 } 527 }
528 528
529 // ---------------------------- 529 // ----------------------------
530 530
(...skipping 18 matching lines...) Expand all
549 mediaElement().exitFullscreen(); 549 mediaElement().exitFullscreen();
550 else 550 else
551 mediaElement().enterFullscreen(); 551 mediaElement().enterFullscreen();
552 event->setDefaultHandled(); 552 event->setDefaultHandled();
553 } 553 }
554 HTMLInputElement::defaultEventHandler(event); 554 HTMLInputElement::defaultEventHandler(event);
555 } 555 }
556 556
557 const AtomicString& MediaControlFullscreenButtonElement::shadowPseudoId() const 557 const AtomicString& MediaControlFullscreenButtonElement::shadowPseudoId() const
558 { 558 {
559 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-fullscreen-bu tton", AtomicString::ConstructFromLiteral)); 559 DEFINE_STATIC_LOCAL(AtomicString, id, ("-internal-media-controls-fullscreen- button", AtomicString::ConstructFromLiteral));
560 return id; 560 return id;
561 } 561 }
562 562
563 void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen) 563 void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen)
564 { 564 {
565 setDisplayType(isFullscreen ? MediaExitFullscreenButton : MediaEnterFullscre enButton); 565 setDisplayType(isFullscreen ? MediaExitFullscreenButton : MediaEnterFullscre enButton);
566 } 566 }
567 567
568 // ---------------------------- 568 // ----------------------------
569 569
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 { 616 {
617 } 617 }
618 618
619 PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> MediaControlTime RemainingDisplayElement::create(MediaControls& mediaControls) 619 PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> MediaControlTime RemainingDisplayElement::create(MediaControls& mediaControls)
620 { 620 {
621 return adoptRefWillBeNoop(new MediaControlTimeRemainingDisplayElement(mediaC ontrols)); 621 return adoptRefWillBeNoop(new MediaControlTimeRemainingDisplayElement(mediaC ontrols));
622 } 622 }
623 623
624 static const AtomicString& getMediaControlTimeRemainingDisplayElementShadowPseud oId() 624 static const AtomicString& getMediaControlTimeRemainingDisplayElementShadowPseud oId()
625 { 625 {
626 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-time-remainin g-display", AtomicString::ConstructFromLiteral)); 626 DEFINE_STATIC_LOCAL(AtomicString, id, ("-internal-media-controls-time-remain ing-display", AtomicString::ConstructFromLiteral));
627 return id; 627 return id;
628 } 628 }
629 629
630 const AtomicString& MediaControlTimeRemainingDisplayElement::shadowPseudoId() co nst 630 const AtomicString& MediaControlTimeRemainingDisplayElement::shadowPseudoId() co nst
631 { 631 {
632 return getMediaControlTimeRemainingDisplayElementShadowPseudoId(); 632 return getMediaControlTimeRemainingDisplayElementShadowPseudoId();
633 } 633 }
634 634
635 // ---------------------------- 635 // ----------------------------
636 636
637 MediaControlCurrentTimeDisplayElement::MediaControlCurrentTimeDisplayElement(Med iaControls& mediaControls) 637 MediaControlCurrentTimeDisplayElement::MediaControlCurrentTimeDisplayElement(Med iaControls& mediaControls)
638 : MediaControlTimeDisplayElement(mediaControls, MediaCurrentTimeDisplay) 638 : MediaControlTimeDisplayElement(mediaControls, MediaCurrentTimeDisplay)
639 { 639 {
640 } 640 }
641 641
642 PassRefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurren tTimeDisplayElement::create(MediaControls& mediaControls) 642 PassRefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurren tTimeDisplayElement::create(MediaControls& mediaControls)
643 { 643 {
644 return adoptRefWillBeNoop(new MediaControlCurrentTimeDisplayElement(mediaCon trols)); 644 return adoptRefWillBeNoop(new MediaControlCurrentTimeDisplayElement(mediaCon trols));
645 } 645 }
646 646
647 static const AtomicString& getMediaControlCurrentTimeDisplayElementShadowPseudoI d() 647 static const AtomicString& getMediaControlCurrentTimeDisplayElementShadowPseudoI d()
648 { 648 {
649 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-current-time- display", AtomicString::ConstructFromLiteral)); 649 DEFINE_STATIC_LOCAL(AtomicString, id, ("-internal-media-controls-current-tim e-display", AtomicString::ConstructFromLiteral));
650 return id; 650 return id;
651 } 651 }
652 652
653 const AtomicString& MediaControlCurrentTimeDisplayElement::shadowPseudoId() cons t 653 const AtomicString& MediaControlCurrentTimeDisplayElement::shadowPseudoId() cons t
654 { 654 {
655 return getMediaControlCurrentTimeDisplayElementShadowPseudoId(); 655 return getMediaControlCurrentTimeDisplayElementShadowPseudoId();
656 } 656 }
657 657
658 // ---------------------------- 658 // ----------------------------
659 659
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 float fontSize = smallestDimension * 0.05f; 773 float fontSize = smallestDimension * 0.05f;
774 if (fontSize != m_fontSize) { 774 if (fontSize != m_fontSize) {
775 m_fontSize = fontSize; 775 m_fontSize = fontSize;
776 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); 776 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX);
777 } 777 }
778 } 778 }
779 779
780 // ---------------------------- 780 // ----------------------------
781 781
782 } // namespace blink 782 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/html/shadow/MediaControls.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698