Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js

Issue 1650243004: [DevTools] Option to show device frames in emulation mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {function()} updateCallback 7 * @param {function()} updateCallback
8 * @implements {WebInspector.TargetManager.Observer} 8 * @implements {WebInspector.TargetManager.Observer}
9 */ 9 */
10 WebInspector.DeviceModeModel = function(updateCallback) 10 WebInspector.DeviceModeModel = function(updateCallback)
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 /** 229 /**
230 * @return {string} 230 * @return {string}
231 */ 231 */
232 screenImage: function() 232 screenImage: function()
233 { 233 {
234 return (this._device && this._mode) ? this._device.modeImage(this._mode) : ""; 234 return (this._device && this._mode) ? this._device.modeImage(this._mode) : "";
235 }, 235 },
236 236
237 /** 237 /**
238 * @return {string}
239 */
240 outlineImage: function()
241 {
242 return (this._device && this._mode) ? this._device.outlineImage(this._mo de) : "";
243 },
244
245 /**
246 * @return {Insets|string|null}
dgozman 2016/02/01 17:18:27 ?Insets
mmccoy 2016/02/10 20:06:33 Done.
247 */
248 outlineInsets: function()
249 {
250 return (this._device && this._mode) ? this._device.outlineInsets(this._m ode) : "";
251 },
252
253 /**
254 * @return {Object|string|null}
255 */
256 outlineDimensions: function()
257 {
258 return (this._device && this._mode) ? this._device.outlineDimensions(thi s._mode) : "";
259 },
260
261 /**
238 * @return {!WebInspector.Rect} 262 * @return {!WebInspector.Rect}
239 */ 263 */
240 screenRect: function() 264 screenRect: function()
241 { 265 {
242 return this._screenRect; 266 return this._screenRect;
243 }, 267 },
244 268
245 /** 269 /**
246 * @return {!WebInspector.Rect} 270 * @return {!WebInspector.Rect}
247 */ 271 */
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 * @param {boolean} resetPageScaleFactor 444 * @param {boolean} resetPageScaleFactor
421 */ 445 */
422 _calculateAndEmulate: function(resetPageScaleFactor) 446 _calculateAndEmulate: function(resetPageScaleFactor)
423 { 447 {
424 if (!this._target) 448 if (!this._target)
425 this._onTargetAvailable = this._calculateAndEmulate.bind(this, reset PageScaleFactor); 449 this._onTargetAvailable = this._calculateAndEmulate.bind(this, reset PageScaleFactor);
426 450
427 if (this._type === WebInspector.DeviceModeModel.Type.Device) { 451 if (this._type === WebInspector.DeviceModeModel.Type.Device) {
428 var orientation = this._device.orientationByName(this._mode.orientat ion); 452 var orientation = this._device.orientationByName(this._mode.orientat ion);
429 this._fitScale = this._calculateFitScale(orientation.width, orientat ion.height); 453 this._fitScale = this._calculateFitScale(orientation.width, orientat ion.height);
454
dgozman 2016/02/01 17:18:27 Revert this one.
430 this._applyDeviceMetrics(new Size(orientation.width, orientation.hei ght), this._mode.insets, this._scaleSetting.get(), this._device.deviceScaleFacto r, this._device.mobile(), resetPageScaleFactor); 455 this._applyDeviceMetrics(new Size(orientation.width, orientation.hei ght), this._mode.insets, this._scaleSetting.get(), this._device.deviceScaleFacto r, this._device.mobile(), resetPageScaleFactor);
431 this._applyUserAgent(this._device.userAgent); 456 this._applyUserAgent(this._device.userAgent);
432 this._applyTouch(this._device.touch(), this._device.mobile()); 457 this._applyTouch(this._device.touch(), this._device.mobile());
433 this._applyScreenOrientation(this._mode.orientation == WebInspector. EmulatedDevice.Horizontal ? "landscapePrimary" : "portraitPrimary"); 458 this._applyScreenOrientation(this._mode.orientation == WebInspector. EmulatedDevice.Horizontal ? "landscapePrimary" : "portraitPrimary");
434 } else if (this._type === WebInspector.DeviceModeModel.Type.None) { 459 } else if (this._type === WebInspector.DeviceModeModel.Type.None) {
435 this._fitScale = this._calculateFitScale(this._availableSize.width, this._availableSize.height); 460 this._fitScale = this._calculateFitScale(this._availableSize.width, this._availableSize.height);
436 this._applyDeviceMetrics(this._availableSize, new Insets(0, 0, 0, 0) , 1, 0, false, resetPageScaleFactor); 461 this._applyDeviceMetrics(this._availableSize, new Insets(0, 0, 0, 0) , 1, 0, false, resetPageScaleFactor);
437 this._applyUserAgent(""); 462 this._applyUserAgent("");
438 this._applyTouch(false, false); 463 this._applyTouch(false, false);
439 this._applyScreenOrientation(""); 464 this._applyScreenOrientation("");
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 if (!this._target || orientation === this._screenOrientation) 635 if (!this._target || orientation === this._screenOrientation)
611 return; 636 return;
612 637
613 this._screenOrientation = orientation; 638 this._screenOrientation = orientation;
614 if (!this._screenOrientation) 639 if (!this._screenOrientation)
615 this._target.screenOrientationAgent().clearScreenOrientationOverride (); 640 this._target.screenOrientationAgent().clearScreenOrientationOverride ();
616 else 641 else
617 this._target.screenOrientationAgent().setScreenOrientationOverride(t his._screenOrientation === "landscapePrimary" ? 90 : 0, /** @type {!ScreenOrient ationAgent.OrientationType} */ (this._screenOrientation)); 642 this._target.screenOrientationAgent().setScreenOrientationOverride(t his._screenOrientation === "landscapePrimary" ? 90 : 0, /** @type {!ScreenOrient ationAgent.OrientationType} */ (this._screenOrientation));
618 } 643 }
619 } 644 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698