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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 CORE_EXPORT HTMLMediaElement* toParentMediaElement(Node*); | 70 CORE_EXPORT HTMLMediaElement* toParentMediaElement(Node*); |
71 inline HTMLMediaElement* toParentMediaElement(LayoutObject* layoutObject) { retu
rn toParentMediaElement(layoutObject->node()); } | 71 inline HTMLMediaElement* toParentMediaElement(LayoutObject* layoutObject) { retu
rn toParentMediaElement(layoutObject->node()); } |
72 | 72 |
73 CORE_EXPORT MediaControlElementType mediaControlElementType(Node*); | 73 CORE_EXPORT MediaControlElementType mediaControlElementType(Node*); |
74 | 74 |
75 // ---------------------------- | 75 // ---------------------------- |
76 | 76 |
77 class MediaControlElement : public WillBeGarbageCollectedMixin { | 77 class MediaControlElement : public WillBeGarbageCollectedMixin { |
78 public: | 78 public: |
79 void hide(); | 79 // These hold the state about whether this control should be shown if |
80 void show(); | 80 // space permits. These will also show / hide as needed. |
| 81 void setIsWanted(bool); |
| 82 bool isWanted(); |
| 83 |
| 84 // Tell us whether we fit or not. This will hide / show the control as |
| 85 // needed, also. |
| 86 void setDoesFit(bool); |
| 87 |
| 88 // This returns the minimum width in pixels that we need to show |
| 89 // this control. Ideally, this would just be shorthand for the computed |
| 90 // style, but this must also work when the control is hidden. |
| 91 int minimumWidth(); |
81 | 92 |
82 MediaControlElementType displayType() { return m_displayType; } | 93 MediaControlElementType displayType() { return m_displayType; } |
83 | 94 |
84 DECLARE_VIRTUAL_TRACE(); | 95 DECLARE_VIRTUAL_TRACE(); |
85 | 96 |
86 protected: | 97 protected: |
87 MediaControlElement(MediaControls&, MediaControlElementType, HTMLElement*); | 98 MediaControlElement(MediaControls&, MediaControlElementType, HTMLElement*); |
88 | 99 |
89 MediaControls& mediaControls() const { return m_mediaControls; } | 100 MediaControls& mediaControls() const { return m_mediaControls; } |
90 HTMLMediaElement& mediaElement() const; | 101 HTMLMediaElement& mediaElement() const; |
91 | 102 |
92 void setDisplayType(MediaControlElementType); | 103 void setDisplayType(MediaControlElementType); |
93 | 104 |
94 private: | 105 private: |
| 106 // Hide or show based on our fits / wanted state. We want to show |
| 107 // if and only if we're wanted and we fit. |
| 108 void updateShownState(); |
| 109 |
95 MediaControls& m_mediaControls; | 110 MediaControls& m_mediaControls; |
96 MediaControlElementType m_displayType; | 111 MediaControlElementType m_displayType; |
97 RawPtrWillBeMember<HTMLElement> m_element; | 112 RawPtrWillBeMember<HTMLElement> m_element; |
| 113 bool m_isWanted : 1; |
| 114 bool m_doesFit : 1; |
98 }; | 115 }; |
99 | 116 |
100 // ---------------------------- | 117 // ---------------------------- |
101 | 118 |
102 class MediaControlDivElement : public HTMLDivElement, public MediaControlElement
{ | 119 class MediaControlDivElement : public HTMLDivElement, public MediaControlElement
{ |
103 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaControlDivElement); | 120 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaControlDivElement); |
104 public: | 121 public: |
105 DECLARE_VIRTUAL_TRACE(); | 122 DECLARE_VIRTUAL_TRACE(); |
106 | 123 |
107 protected: | 124 protected: |
(...skipping 29 matching lines...) Expand all Loading... |
137 protected: | 154 protected: |
138 MediaControlTimeDisplayElement(MediaControls&, MediaControlElementType); | 155 MediaControlTimeDisplayElement(MediaControls&, MediaControlElementType); |
139 | 156 |
140 private: | 157 private: |
141 double m_currentValue; | 158 double m_currentValue; |
142 }; | 159 }; |
143 | 160 |
144 } // namespace blink | 161 } // namespace blink |
145 | 162 |
146 #endif // MediaControlElementTypes_h | 163 #endif // MediaControlElementTypes_h |
OLD | NEW |