Timelines are sharing the same canvas background
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Mar 2015 00:44:22 +0000 (00:44 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Mar 2015 00:44:22 +0000 (00:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142994
<rdar://problem/20209466>

Reviewed by Brent Fulgham.

Since each MediaControl lives in an isolated world, we
can't rely on a global variable to provide a unique
identifier for a named canvas. The fix is to expose
WebCore's UUID generator, and have each canvas use
that for a name.

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::generateUUID): New method on the
MediaControlsHost that generates a UUID.
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:

* Modules/mediacontrols/mediaControlsApple.js: Remove the global
variable unique ID that wasn't working, and instead get
an ID from the MediaControlsHost.
(Controller.prototype.createControls):
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181882 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp
Source/WebCore/Modules/mediacontrols/MediaControlsHost.h
Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl
Source/WebCore/Modules/mediacontrols/mediaControlsApple.js
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js

index 5ae5d14..fb49fd5 100644 (file)
@@ -1,3 +1,30 @@
+2015-03-23  Dean Jackson  <dino@apple.com>
+
+        Timelines are sharing the same canvas background
+        https://bugs.webkit.org/show_bug.cgi?id=142994
+        <rdar://problem/20209466>
+
+        Reviewed by Brent Fulgham.
+
+        Since each MediaControl lives in an isolated world, we
+        can't rely on a global variable to provide a unique
+        identifier for a named canvas. The fix is to expose
+        WebCore's UUID generator, and have each canvas use
+        that for a name.
+
+        * Modules/mediacontrols/MediaControlsHost.cpp:
+        (WebCore::MediaControlsHost::generateUUID): New method on the
+        MediaControlsHost that generates a UUID.
+        * Modules/mediacontrols/MediaControlsHost.h:
+        * Modules/mediacontrols/MediaControlsHost.idl:
+
+        * Modules/mediacontrols/mediaControlsApple.js: Remove the global
+        variable unique ID that wasn't working, and instead get
+        an ID from the MediaControlsHost.
+        (Controller.prototype.createControls):
+        * Modules/mediacontrols/mediaControlsiOS.js:
+        (ControllerIOS):
+
 2015-03-23  Brent Fulgham  <bfulgham@apple.com>
 
         Scroll latching logic can get stuck in 'scrollable="no"' iframes
index a376080..c09b564 100644 (file)
@@ -38,6 +38,7 @@
 #include "PageGroup.h"
 #include "TextTrack.h"
 #include "TextTrackList.h"
+#include "UUID.h"
 #include <runtime/JSCJSValueInlines.h>
 
 namespace WebCore {
@@ -292,6 +293,11 @@ String MediaControlsHost::mediaUIImageData(const String& partID) const
     return emptyString();
 }
 
+String MediaControlsHost::generateUUID() const
+{
+    return createCanonicalUUIDString();
+}
+
 }
 
 #endif
index ae3b5f8..c64e47c 100644 (file)
@@ -80,6 +80,8 @@ public:
     bool controlsDependOnPageScaleFactor() const;
     void setControlsDependOnPageScaleFactor(bool v);
 
+    String generateUUID() const;
+
 private:
     MediaControlsHost(HTMLMediaElement*);
 
index 072c03c..8a00761 100644 (file)
@@ -62,4 +62,6 @@ enum MediaUIPartID {
     void exitedFullscreen();
     void enterFullscreenOptimized();
     DOMString mediaUIImageData(MediaUIPartID partID);
+
+    DOMString generateUUID();
 };
index 67e96dc..1f9f22b 100644 (file)
@@ -45,7 +45,6 @@ Controller.PlayAfterSeeking = 0;
 Controller.PauseAfterSeeking = 1;
 
 /* Globals */
-Controller.gLastTimelineId = 0;
 Controller.gWirelessImage = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 245"><g fill="#1060FE"><path d="M193.6,6.3v121.6H6.4V6.3H193.6 M199.1,0.7H0.9v132.7h198.2V0.7L199.1,0.7z"/><path d="M43.5,139.3c15.8,8,35.3,12.7,56.5,12.7s40.7-4.7,56.5-12.7H43.5z"/></g><g text-anchor="middle" font-family="Helvetica Neue"><text x="100" y="204" fill="white" font-size="24">##DEVICE_TYPE##</text><text x="100" y="234" fill="#5C5C5C" font-size="21">##DEVICE_NAME##</text></g></svg>';
 Controller.gSimulateWirelessPlaybackTarget = false; // Used for testing when there are no wireless targets.
 Controller.gSimulateOptimizedFullscreenAvailable = false; // Used for testing when optimized fullscreen is not available.
@@ -362,7 +361,7 @@ Controller.prototype = {
         this.listenFor(timeline, 'mouseup', this.handleTimelineMouseUp);
         timeline.step = .01;
 
-        this.timelineContextName = "_webkit-media-controls-timeline-" + Controller.gLastTimelineId;
+        this.timelineContextName = "_webkit-media-controls-timeline-" + this.host.generateUUID();
         timeline.style.backgroundImage = '-webkit-canvas(' + this.timelineContextName + ')';
         
         var thumbnailTrack = this.controls.thumbnailTrack = document.createElement('div');
@@ -410,9 +409,8 @@ Controller.prototype = {
         volume.step = .01;
         this.listenFor(volume, 'input', this.handleVolumeSliderInput);
 
-        this.volumeContextName = "_webkit-media-controls-volume-" + Controller.gLastTimelineId;
+        this.volumeContextName = "_webkit-media-controls-volume-" + this.host.generateUUID();
         volume.style.backgroundImage = '-webkit-canvas(' + this.volumeContextName + ')';
-        Controller.gLastTimelineId++;
         
         var captionButton = this.controls.captionButton = document.createElement('button');
         captionButton.setAttribute('pseudo', '-webkit-media-controls-toggle-closed-captions-button');
index bee9286..30e0b28 100644 (file)
@@ -8,7 +8,7 @@ function ControllerIOS(root, video, host)
     this.doingSetup = true;
     this._pageScaleFactor = 1;
 
-    this.timelineContextName = "_webkit-media-controls-timeline-" + ControllerIOS.gLastTimelineId++;
+    this.timelineContextName = "_webkit-media-controls-timeline-" + host.generateUUID();
 
     Controller.call(this, root, video, host);
 
@@ -29,8 +29,6 @@ ControllerIOS.ButtonWidth = 42;
 /* Enums */
 ControllerIOS.StartPlaybackControls = 2;
 
-/* Globals */
-ControllerIOS.gLastTimelineId = 0;
 
 ControllerIOS.prototype = {
     addVideoListeners: function() {