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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 this._isCasting = true; | 120 this._isCasting = true; |
121 | 121 |
122 const maxImageDimension = 2048; | 122 const maxImageDimension = 2048; |
123 var dimensions = this._viewportDimensions(); | 123 var dimensions = this._viewportDimensions(); |
124 if (dimensions.width < 0 || dimensions.height < 0) { | 124 if (dimensions.width < 0 || dimensions.height < 0) { |
125 this._isCasting = false; | 125 this._isCasting = false; |
126 return; | 126 return; |
127 } | 127 } |
128 dimensions.width *= window.devicePixelRatio; | 128 dimensions.width *= window.devicePixelRatio; |
129 dimensions.height *= window.devicePixelRatio; | 129 dimensions.height *= window.devicePixelRatio; |
| 130 // Note: startScreencast with and height expect to be integers so must be fl
oored. |
130 this._target.pageAgent().startScreencast( | 131 this._target.pageAgent().startScreencast( |
131 'jpeg', 80, Math.min(maxImageDimension, dimensions.width), Math.min(maxI
mageDimension, dimensions.height)); | 132 'jpeg', 80, Math.floor(Math.min(maxImageDimension, dimensions.width)), |
| 133 Math.floor(Math.min(maxImageDimension, dimensions.height))); |
132 this._target.emulationAgent().setTouchEmulationEnabled(true); | 134 this._target.emulationAgent().setTouchEmulationEnabled(true); |
133 this._domModel.setHighlighter(this); | 135 this._domModel.setHighlighter(this); |
134 } | 136 } |
135 | 137 |
136 _stopCasting() { | 138 _stopCasting() { |
137 if (!this._isCasting) | 139 if (!this._isCasting) |
138 return; | 140 return; |
139 this._isCasting = false; | 141 this._isCasting = false; |
140 this._target.pageAgent().stopScreencast(); | 142 this._target.pageAgent().stopScreencast(); |
141 this._target.emulationAgent().setTouchEmulationEnabled(false); | 143 this._target.emulationAgent().setTouchEmulationEnabled(false); |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 if (this._maxDisplayedProgress >= progress) | 865 if (this._maxDisplayedProgress >= progress) |
864 return; | 866 return; |
865 this._maxDisplayedProgress = progress; | 867 this._maxDisplayedProgress = progress; |
866 this._displayProgress(progress); | 868 this._displayProgress(progress); |
867 } | 869 } |
868 | 870 |
869 _displayProgress(progress) { | 871 _displayProgress(progress) { |
870 this._element.style.width = (100 * progress) + '%'; | 872 this._element.style.width = (100 * progress) + '%'; |
871 } | 873 } |
872 }; | 874 }; |
OLD | NEW |