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

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

Issue 199413008: Simplify MediaControls::show() and hide() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 static const AtomicString& getMediaControlCurrentTimeDisplayElementShadowPseudoI d(); 56 static const AtomicString& getMediaControlCurrentTimeDisplayElementShadowPseudoI d();
57 static const AtomicString& getMediaControlTimeRemainingDisplayElementShadowPseud oId(); 57 static const AtomicString& getMediaControlTimeRemainingDisplayElementShadowPseud oId();
58 58
59 static const double fadeInDuration = 0.1; 59 static const double fadeInDuration = 0.1;
60 static const double fadeOutDuration = 0.3; 60 static const double fadeOutDuration = 0.3;
61 61
62 MediaControlPanelElement::MediaControlPanelElement(MediaControls& mediaControls) 62 MediaControlPanelElement::MediaControlPanelElement(MediaControls& mediaControls)
63 : MediaControlDivElement(mediaControls, MediaControlsPanel) 63 : MediaControlDivElement(mediaControls, MediaControlsPanel)
64 , m_canBeDragged(false) 64 , m_canBeDragged(false)
65 , m_isBeingDragged(false) 65 , m_isBeingDragged(false)
66 , m_isDisplayed(false)
67 , m_opaque(true) 66 , m_opaque(true)
68 , m_transitionTimer(this, &MediaControlPanelElement::transitionTimerFired) 67 , m_transitionTimer(this, &MediaControlPanelElement::transitionTimerFired)
69 { 68 {
70 } 69 }
71 70
72 PassRefPtr<MediaControlPanelElement> MediaControlPanelElement::create(MediaContr ols& mediaControls) 71 PassRefPtr<MediaControlPanelElement> MediaControlPanelElement::create(MediaContr ols& mediaControls)
73 { 72 {
74 return adoptRef(new MediaControlPanelElement(mediaControls)); 73 return adoptRef(new MediaControlPanelElement(mediaControls));
75 } 74 }
76 75
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 void MediaControlPanelElement::makeOpaque() 184 void MediaControlPanelElement::makeOpaque()
186 { 185 {
187 if (m_opaque) 186 if (m_opaque)
188 return; 187 return;
189 188
190 setInlineStyleProperty(CSSPropertyTransitionProperty, CSSPropertyOpacity); 189 setInlineStyleProperty(CSSPropertyTransitionProperty, CSSPropertyOpacity);
191 setInlineStyleProperty(CSSPropertyTransitionDuration, fadeInDuration, CSSPri mitiveValue::CSS_S); 190 setInlineStyleProperty(CSSPropertyTransitionDuration, fadeInDuration, CSSPri mitiveValue::CSS_S);
192 setInlineStyleProperty(CSSPropertyOpacity, 1.0, CSSPrimitiveValue::CSS_NUMBE R); 191 setInlineStyleProperty(CSSPropertyOpacity, 1.0, CSSPrimitiveValue::CSS_NUMBE R);
193 192
194 m_opaque = true; 193 m_opaque = true;
195 194 show();
196 if (m_isDisplayed)
197 show();
198 } 195 }
199 196
200 void MediaControlPanelElement::makeTransparent() 197 void MediaControlPanelElement::makeTransparent()
201 { 198 {
202 if (!m_opaque) 199 if (!m_opaque)
203 return; 200 return;
204 201
205 setInlineStyleProperty(CSSPropertyTransitionProperty, CSSPropertyOpacity); 202 setInlineStyleProperty(CSSPropertyTransitionProperty, CSSPropertyOpacity);
206 setInlineStyleProperty(CSSPropertyTransitionDuration, fadeOutDuration, CSSPr imitiveValue::CSS_S); 203 setInlineStyleProperty(CSSPropertyTransitionDuration, fadeOutDuration, CSSPr imitiveValue::CSS_S);
207 setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValue::CSS_NUMBE R); 204 setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValue::CSS_NUMBE R);
(...skipping 25 matching lines...) Expand all
233 { 230 {
234 if (m_canBeDragged == canBeDragged) 231 if (m_canBeDragged == canBeDragged)
235 return; 232 return;
236 233
237 m_canBeDragged = canBeDragged; 234 m_canBeDragged = canBeDragged;
238 235
239 if (!canBeDragged) 236 if (!canBeDragged)
240 endDrag(); 237 endDrag();
241 } 238 }
242 239
243 void MediaControlPanelElement::setIsDisplayed(bool isDisplayed)
244 {
245 m_isDisplayed = isDisplayed;
246 }
247
248 // ---------------------------- 240 // ----------------------------
249 241
250 MediaControlPanelEnclosureElement::MediaControlPanelEnclosureElement(MediaContro ls& mediaControls) 242 MediaControlPanelEnclosureElement::MediaControlPanelEnclosureElement(MediaContro ls& mediaControls)
251 // Mapping onto same MediaControlElementType as panel element, since it has similar properties. 243 // Mapping onto same MediaControlElementType as panel element, since it has similar properties.
252 : MediaControlDivElement(mediaControls, MediaControlsPanel) 244 : MediaControlDivElement(mediaControls, MediaControlsPanel)
253 { 245 {
254 } 246 }
255 247
256 PassRefPtr<MediaControlPanelEnclosureElement> MediaControlPanelEnclosureElement: :create(MediaControls& mediaControls) 248 PassRefPtr<MediaControlPanelEnclosureElement> MediaControlPanelEnclosureElement: :create(MediaControls& mediaControls)
257 { 249 {
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 float fontSize = smallestDimension * 0.05f; 774 float fontSize = smallestDimension * 0.05f;
783 if (fontSize != m_fontSize) { 775 if (fontSize != m_fontSize) {
784 m_fontSize = fontSize; 776 m_fontSize = fontSize;
785 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); 777 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX);
786 } 778 }
787 } 779 }
788 780
789 // ---------------------------- 781 // ----------------------------
790 782
791 } // namespace WebCore 783 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/shadow/MediaControlElements.h ('k') | Source/core/html/shadow/MediaControls.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698