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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 this._target.pageAgent().stopScreencast(); | 143 this._target.pageAgent().stopScreencast(); |
144 this._target.emulationAgent().setTouchEmulationEnabled(false); | 144 this._target.emulationAgent().setTouchEmulationEnabled(false); |
145 this._domModel.setHighlighter(null); | 145 this._domModel.setHighlighter(null); |
146 }, | 146 }, |
147 | 147 |
148 /** | 148 /** |
149 * @param {!WebInspector.Event} event | 149 * @param {!WebInspector.Event} event |
150 */ | 150 */ |
151 _screencastFrame: function(event) | 151 _screencastFrame: function(event) |
152 { | 152 { |
| 153 this._target.pageAgent().screencastFrameAck(); |
| 154 |
153 var metadata = /** type {PageAgent.ScreencastFrameMetadata} */(event.dat
a.metadata); | 155 var metadata = /** type {PageAgent.ScreencastFrameMetadata} */(event.dat
a.metadata); |
154 var base64Data = /** type {string} */(event.data.data); | 156 var base64Data = /** type {string} */(event.data.data); |
155 this._imageElement.src = "data:image/jpg;base64," + base64Data; | 157 this._imageElement.src = "data:image/jpg;base64," + base64Data; |
156 this._pageScaleFactor = metadata.pageScaleFactor; | 158 this._pageScaleFactor = metadata.pageScaleFactor; |
157 this._screenOffsetTop = metadata.offsetTop; | 159 this._screenOffsetTop = metadata.offsetTop; |
158 this._scrollOffsetX = metadata.scrollOffsetX; | 160 this._scrollOffsetX = metadata.scrollOffsetX; |
159 this._scrollOffsetY = metadata.scrollOffsetY; | 161 this._scrollOffsetY = metadata.scrollOffsetY; |
160 | 162 |
161 if (event.data.frameNumber) | |
162 this._target.pageAgent().screencastFrameAck(event.data.frameNumber); | |
163 | |
164 var deviceSizeRatio = metadata.deviceHeight / metadata.deviceWidth; | 163 var deviceSizeRatio = metadata.deviceHeight / metadata.deviceWidth; |
165 var dimensionsCSS = this._viewportDimensions(); | 164 var dimensionsCSS = this._viewportDimensions(); |
166 | 165 |
167 this._imageZoom = Math.min(dimensionsCSS.width / this._imageElement.natu
ralWidth, dimensionsCSS.height / (this._imageElement.naturalWidth * deviceSizeRa
tio)); | 166 this._imageZoom = Math.min(dimensionsCSS.width / this._imageElement.natu
ralWidth, dimensionsCSS.height / (this._imageElement.naturalWidth * deviceSizeRa
tio)); |
168 this._viewportElement.classList.remove("hidden"); | 167 this._viewportElement.classList.remove("hidden"); |
169 var bordersSize = WebInspector.ScreencastView._bordersSize; | 168 var bordersSize = WebInspector.ScreencastView._bordersSize; |
170 if (this._imageZoom < 1.01 / window.devicePixelRatio) | 169 if (this._imageZoom < 1.01 / window.devicePixelRatio) |
171 this._imageZoom = 1 / window.devicePixelRatio; | 170 this._imageZoom = 1 / window.devicePixelRatio; |
172 this._screenZoom = this._imageElement.naturalWidth * this._imageZoom / m
etadata.deviceWidth; | 171 this._screenZoom = this._imageElement.naturalWidth * this._imageZoom / m
etadata.deviceWidth; |
173 this._viewportElement.style.width = metadata.deviceWidth * this._screenZ
oom + bordersSize + "px"; | 172 this._viewportElement.style.width = metadata.deviceWidth * this._screenZ
oom + bordersSize + "px"; |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 return; | 865 return; |
867 this._maxDisplayedProgress = progress; | 866 this._maxDisplayedProgress = progress; |
868 this._displayProgress(progress); | 867 this._displayProgress(progress); |
869 }, | 868 }, |
870 | 869 |
871 _displayProgress: function(progress) | 870 _displayProgress: function(progress) |
872 { | 871 { |
873 this._element.style.width = (100 * progress) + "%"; | 872 this._element.style.width = (100 * progress) + "%"; |
874 } | 873 } |
875 }; | 874 }; |
OLD | NEW |