OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 var metadata = /** type {PageAgent.ScreencastFrameMetadata} */(event.dat
a.metadata); | 146 var metadata = /** type {PageAgent.ScreencastFrameMetadata} */(event.dat
a.metadata); |
147 var base64Data = /** type {string} */(event.data.data); | 147 var base64Data = /** type {string} */(event.data.data); |
148 this._imageElement.src = "data:image/jpg;base64," + base64Data; | 148 this._imageElement.src = "data:image/jpg;base64," + base64Data; |
149 this._pageScaleFactor = metadata.pageScaleFactor; | 149 this._pageScaleFactor = metadata.pageScaleFactor; |
150 this._screenOffsetTop = metadata.offsetTop; | 150 this._screenOffsetTop = metadata.offsetTop; |
151 this._deviceWidth = metadata.deviceWidth; | 151 this._deviceWidth = metadata.deviceWidth; |
152 this._deviceHeight = metadata.deviceHeight; | 152 this._deviceHeight = metadata.deviceHeight; |
153 this._scrollOffsetX = metadata.scrollOffsetX; | 153 this._scrollOffsetX = metadata.scrollOffsetX; |
154 this._scrollOffsetY = metadata.scrollOffsetY; | 154 this._scrollOffsetY = metadata.scrollOffsetY; |
155 | 155 |
| 156 if (event.data.frameNumber) |
| 157 this._target.pageAgent().screencastFrameAck(event.data.frameNumber); |
| 158 |
156 var deviceSizeRatio = metadata.deviceHeight / metadata.deviceWidth; | 159 var deviceSizeRatio = metadata.deviceHeight / metadata.deviceWidth; |
157 var dimensionsCSS = this._viewportDimensions(); | 160 var dimensionsCSS = this._viewportDimensions(); |
158 | 161 |
159 this._imageZoom = Math.min(dimensionsCSS.width / this._imageElement.natu
ralWidth, dimensionsCSS.height / (this._imageElement.naturalWidth * deviceSizeRa
tio)); | 162 this._imageZoom = Math.min(dimensionsCSS.width / this._imageElement.natu
ralWidth, dimensionsCSS.height / (this._imageElement.naturalWidth * deviceSizeRa
tio)); |
160 this._viewportElement.classList.remove("hidden"); | 163 this._viewportElement.classList.remove("hidden"); |
161 var bordersSize = WebInspector.ScreencastView._bordersSize; | 164 var bordersSize = WebInspector.ScreencastView._bordersSize; |
162 if (this._imageZoom < 1.01 / window.devicePixelRatio) | 165 if (this._imageZoom < 1.01 / window.devicePixelRatio) |
163 this._imageZoom = 1 / window.devicePixelRatio; | 166 this._imageZoom = 1 / window.devicePixelRatio; |
164 this._screenZoom = this._imageElement.naturalWidth * this._imageZoom / m
etadata.deviceWidth; | 167 this._screenZoom = this._imageElement.naturalWidth * this._imageZoom / m
etadata.deviceWidth; |
165 this._viewportElement.style.width = metadata.deviceWidth * this._screenZ
oom + bordersSize + "px"; | 168 this._viewportElement.style.width = metadata.deviceWidth * this._screenZ
oom + bordersSize + "px"; |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 return; | 859 return; |
857 this._maxDisplayedProgress = progress; | 860 this._maxDisplayedProgress = progress; |
858 this._displayProgress(progress); | 861 this._displayProgress(progress); |
859 }, | 862 }, |
860 | 863 |
861 _displayProgress: function(progress) | 864 _displayProgress: function(progress) |
862 { | 865 { |
863 this._element.style.width = (100 * progress) + "%"; | 866 this._element.style.width = (100 * progress) + "%"; |
864 } | 867 } |
865 }; | 868 }; |
OLD | NEW |