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

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.h

Issue 2280123002: Fix under-invalidation of media buffered ranges (Closed)
Patch Set: Synchronize buffered ranges when the current play time changes Created 4 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2011, 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 16 matching lines...) Expand all
27 #ifndef MediaControls_h 27 #ifndef MediaControls_h
28 #define MediaControls_h 28 #define MediaControls_h
29 29
30 #include "core/html/HTMLDivElement.h" 30 #include "core/html/HTMLDivElement.h"
31 #include "core/html/shadow/MediaControlElements.h" 31 #include "core/html/shadow/MediaControlElements.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class Event; 35 class Event;
36 class TextTrackContainer; 36 class TextTrackContainer;
37 class TimeRanges;
37 38
38 class CORE_EXPORT MediaControls final : public HTMLDivElement { 39 class CORE_EXPORT MediaControls final : public HTMLDivElement {
39 public: 40 public:
40 static MediaControls* create(HTMLMediaElement&); 41 static MediaControls* create(HTMLMediaElement&);
41 42
42 HTMLMediaElement& mediaElement() const { return *m_mediaElement; } 43 HTMLMediaElement& mediaElement() const { return *m_mediaElement; }
43 44
44 void reset(); 45 void reset();
45 46
46 void show(); 47 void show();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Returns the layout object for the part of the controls that should be 80 // Returns the layout object for the part of the controls that should be
80 // used for overlap checking during text track layout. May be null. 81 // used for overlap checking during text track layout. May be null.
81 LayoutObject* layoutObjectForTextTrackLayout(); 82 LayoutObject* layoutObjectForTextTrackLayout();
82 83
83 // Notify us that our controls enclosure has changed width. 84 // Notify us that our controls enclosure has changed width.
84 void notifyPanelWidthChanged(const LayoutUnit& newWidth); 85 void notifyPanelWidthChanged(const LayoutUnit& newWidth);
85 86
86 // Notify us that the media element's network state has changed. 87 // Notify us that the media element's network state has changed.
87 void networkStateChanged(); 88 void networkStateChanged();
88 89
90 // Returns the cached buffered ranges for painting updated by the m_buffered RangesPaintInvalidationTimer
91 // periodically while the media is loading. It can be null.
92 TimeRanges* bufferedRangesForPainting() const { return m_bufferedRangesForPa inting.get(); }
93
89 DECLARE_VIRTUAL_TRACE(); 94 DECLARE_VIRTUAL_TRACE();
90 95
91 private: 96 private:
92 void invalidate(Element*); 97 void invalidate(Element*);
93 98
94 class BatchedControlUpdate; 99 class BatchedControlUpdate;
95 100
96 explicit MediaControls(HTMLMediaElement&); 101 explicit MediaControls(HTMLMediaElement&);
97 102
98 void initializeControls(); 103 void initializeControls();
(...skipping 21 matching lines...) Expand all
120 // Hide elements that don't fit, and show those things that we want which 125 // Hide elements that don't fit, and show those things that we want which
121 // do fit. This requires that m_panelWidth is current. 126 // do fit. This requires that m_panelWidth is current.
122 void computeWhichControlsFit(); 127 void computeWhichControlsFit();
123 128
124 // Node 129 // Node
125 bool isMediaControls() const override { return true; } 130 bool isMediaControls() const override { return true; }
126 bool willRespondToMouseMoveEvents() override { return true; } 131 bool willRespondToMouseMoveEvents() override { return true; }
127 void defaultEventHandler(Event*) override; 132 void defaultEventHandler(Event*) override;
128 bool containsRelatedTarget(Event*); 133 bool containsRelatedTarget(Event*);
129 134
135 void updateTimelinePosition();
136 void updateBufferedRanges();
137 void bufferedRangesPaintInvalidationTimerFired(TimerBase*);
138
130 Member<HTMLMediaElement> m_mediaElement; 139 Member<HTMLMediaElement> m_mediaElement;
131 140
132 // Media control elements. 141 // Media control elements.
133 Member<MediaControlOverlayEnclosureElement> m_overlayEnclosure; 142 Member<MediaControlOverlayEnclosureElement> m_overlayEnclosure;
134 Member<MediaControlOverlayPlayButtonElement> m_overlayPlayButton; 143 Member<MediaControlOverlayPlayButtonElement> m_overlayPlayButton;
135 Member<MediaControlCastButtonElement> m_overlayCastButton; 144 Member<MediaControlCastButtonElement> m_overlayCastButton;
136 Member<MediaControlPanelEnclosureElement> m_enclosure; 145 Member<MediaControlPanelEnclosureElement> m_enclosure;
137 Member<MediaControlPanelElement> m_panel; 146 Member<MediaControlPanelElement> m_panel;
138 Member<MediaControlPlayButtonElement> m_playButton; 147 Member<MediaControlPlayButtonElement> m_playButton;
139 Member<MediaControlTimelineElement> m_timeline; 148 Member<MediaControlTimelineElement> m_timeline;
140 Member<MediaControlCurrentTimeDisplayElement> m_currentTimeDisplay; 149 Member<MediaControlCurrentTimeDisplayElement> m_currentTimeDisplay;
141 Member<MediaControlTimeRemainingDisplayElement> m_durationDisplay; 150 Member<MediaControlTimeRemainingDisplayElement> m_durationDisplay;
142 Member<MediaControlMuteButtonElement> m_muteButton; 151 Member<MediaControlMuteButtonElement> m_muteButton;
143 Member<MediaControlVolumeSliderElement> m_volumeSlider; 152 Member<MediaControlVolumeSliderElement> m_volumeSlider;
144 Member<MediaControlToggleClosedCaptionsButtonElement> m_toggleClosedCaptions Button; 153 Member<MediaControlToggleClosedCaptionsButtonElement> m_toggleClosedCaptions Button;
145 Member<MediaControlTextTrackListElement> m_textTrackList; 154 Member<MediaControlTextTrackListElement> m_textTrackList;
146 Member<MediaControlCastButtonElement> m_castButton; 155 Member<MediaControlCastButtonElement> m_castButton;
147 Member<MediaControlFullscreenButtonElement> m_fullScreenButton; 156 Member<MediaControlFullscreenButtonElement> m_fullScreenButton;
148 157
149 Timer<MediaControls> m_hideMediaControlsTimer; 158 Timer<MediaControls> m_hideMediaControlsTimer;
150 unsigned m_hideTimerBehaviorFlags; 159 unsigned m_hideTimerBehaviorFlags;
151 bool m_isMouseOverControls : 1; 160 bool m_isMouseOverControls : 1;
152 bool m_isPausedForScrubbing : 1; 161 bool m_isPausedForScrubbing : 1;
153 162
154 Timer<MediaControls> m_panelWidthChangedTimer; 163 Timer<MediaControls> m_panelWidthChangedTimer;
155 int m_panelWidth; 164 int m_panelWidth;
156 165
157 bool m_allowHiddenVolumeControls : 1; 166 bool m_allowHiddenVolumeControls : 1;
167
168 Timer<MediaControls> m_bufferedRangesPaintInvalidationTimer;
169 Member<TimeRanges> m_bufferedRangesForPainting;
158 }; 170 };
159 171
160 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls()); 172 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls());
161 173
162 } // namespace blink 174 } // namespace blink
163 175
164 #endif 176 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698