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