RESOLVED FIXED 134208
Reduce synchronous layout triggered by JavaScript-based media controls
https://bugs.webkit.org/show_bug.cgi?id=134208
Summary Reduce synchronous layout triggered by JavaScript-based media controls
Joseph Pecoraro
Reported 2014-06-23 12:36:25 PDT
JavaScript-based media controls are triggering synchronous layout potentially multiple times during page loads with media elements. This causes unnecessary work during page loads. Specifically, the Apple and iOS media controls updateProgress methods, querying the offsetWidth/offsetHeight of the timeline: > updateProgress: function() { > Controller.prototype.updateProgress.call(this); > > var width = this.controls.timeline.offsetWidth; > var height = this.controls.timeline.offsetHeight; > ... > } During a normal page load of a <video controls url="..."> this gets triggered 8 times. We should be able to reduce that.
Attachments
[PATCH] Proposed Fix (9.20 KB, patch)
2014-06-23 12:47 PDT, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2014-06-23 12:47:59 PDT
Created attachment 233628 [details] [PATCH] Proposed Fix Based on measurements from Andreas this improved PLT by ~0.5%. It reduces the number of calls to offsetWidth from 8 to 3 when just loading a page with a video and controls. I see one possible issue with this patch, if the media element itself changes size the cached values may be wrong. That is because the timeline is flex based and we do not know when the element itself changed size. So that may be a regression that could be addressed later.
WebKit Commit Bot
Comment 2 2014-06-23 14:01:44 PDT
Comment on attachment 233628 [details] [PATCH] Proposed Fix Clearing flags on attachment: 233628 Committed r170315: <http://trac.webkit.org/changeset/170315>
WebKit Commit Bot
Comment 3 2014-06-23 14:01:48 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.