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

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

Issue 2626143004: DevTools: move from Common module - Geometry and CSSShadowModel (Closed)
Patch Set: minimize test diff Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js
index acea052bce094791db15928820f94b6d61d17ff1..bd206f7f032ed68b044970f5fef781ff119ad854 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js
@@ -11,13 +11,13 @@ Emulation.DeviceModeModel = class {
*/
constructor(updateCallback) {
this._updateCallback = updateCallback;
- this._screenRect = new Common.Rect(0, 0, 1, 1);
- this._visiblePageRect = new Common.Rect(0, 0, 1, 1);
- this._availableSize = new Size(1, 1);
- this._preferredSize = new Size(1, 1);
+ this._screenRect = new UI.Rect(0, 0, 1, 1);
+ this._visiblePageRect = new UI.Rect(0, 0, 1, 1);
+ this._availableSize = new UI.Size(1, 1);
+ this._preferredSize = new UI.Size(1, 1);
this._initialized = false;
this._deviceMetricsThrottler = new Common.Throttler(0);
- this._appliedDeviceSize = new Size(1, 1);
+ this._appliedDeviceSize = new UI.Size(1, 1);
this._appliedDeviceScaleFactor = window.devicePixelRatio;
this._appliedUserAgentType = Emulation.DeviceModeModel.UA.Desktop;
@@ -87,8 +87,8 @@ Emulation.DeviceModeModel = class {
}
/**
- * @param {!Size} availableSize
- * @param {!Size} preferredSize
+ * @param {!UI.Size} availableSize
+ * @param {!UI.Size} preferredSize
*/
setAvailableSize(availableSize, preferredSize) {
this._availableSize = availableSize;
@@ -210,21 +210,21 @@ Emulation.DeviceModeModel = class {
}
/**
- * @return {!Common.Rect}
+ * @return {!UI.Rect}
*/
outlineRect() {
return this._outlineRect;
}
/**
- * @return {!Common.Rect}
+ * @return {!UI.Rect}
*/
screenRect() {
return this._screenRect;
}
/**
- * @return {!Common.Rect}
+ * @return {!UI.Rect}
*/
visiblePageRect() {
return this._visiblePageRect;
@@ -245,7 +245,7 @@ Emulation.DeviceModeModel = class {
}
/**
- * @return {!Size}
+ * @return {!UI.Size}
*/
appliedDeviceSize() {
return this._appliedDeviceSize;
@@ -371,10 +371,10 @@ Emulation.DeviceModeModel = class {
}
/**
- * @return {!Insets}
+ * @return {!UI.Insets}
*/
_currentOutline() {
- var outline = new Insets(0, 0, 0, 0);
+ var outline = new UI.Insets(0, 0, 0, 0);
if (this._type !== Emulation.DeviceModeModel.Type.Device)
return outline;
var orientation = this._device.orientationByName(this._mode.orientation);
@@ -384,11 +384,11 @@ Emulation.DeviceModeModel = class {
}
/**
- * @return {!Insets}
+ * @return {!UI.Insets}
*/
_currentInsets() {
if (this._type !== Emulation.DeviceModeModel.Type.Device)
- return new Insets(0, 0, 0, 0);
+ return new UI.Insets(0, 0, 0, 0);
return this._mode.insets;
}
@@ -412,7 +412,7 @@ Emulation.DeviceModeModel = class {
this._device.touch() ? Emulation.DeviceModeModel.UA.DesktopTouch : Emulation.DeviceModeModel.UA.Desktop;
}
this._applyDeviceMetrics(
- new Size(orientation.width, orientation.height), insets, outline, this._scaleSetting.get(),
+ new UI.Size(orientation.width, orientation.height), insets, outline, this._scaleSetting.get(),
this._device.deviceScaleFactor, this._device.mobile(),
this._mode.orientation === Emulation.EmulatedDevice.Horizontal ? 'landscapePrimary' : 'portraitPrimary',
resetPageScaleFactor);
@@ -422,7 +422,8 @@ Emulation.DeviceModeModel = class {
this._fitScale = this._calculateFitScale(this._availableSize.width, this._availableSize.height);
this._appliedUserAgentType = Emulation.DeviceModeModel.UA.Desktop;
this._applyDeviceMetrics(
- this._availableSize, new Insets(0, 0, 0, 0), new Insets(0, 0, 0, 0), 1, 0, false, '', resetPageScaleFactor);
+ this._availableSize, new UI.Insets(0, 0, 0, 0), new UI.Insets(0, 0, 0, 0), 1, 0, false, '',
+ resetPageScaleFactor);
this._applyUserAgent('');
this._applyTouch(false, false);
} else if (this._type === Emulation.DeviceModeModel.Type.Responsive) {
@@ -438,8 +439,8 @@ Emulation.DeviceModeModel = class {
this._fitScale = this._calculateFitScale(this._widthSetting.get(), this._heightSetting.get());
this._appliedUserAgentType = this._uaSetting.get();
this._applyDeviceMetrics(
- new Size(screenWidth, screenHeight), new Insets(0, 0, 0, 0), new Insets(0, 0, 0, 0), this._scaleSetting.get(),
- this._deviceScaleFactorSetting.get() || defaultDeviceScaleFactor, mobile,
+ new UI.Size(screenWidth, screenHeight), new UI.Insets(0, 0, 0, 0), new UI.Insets(0, 0, 0, 0),
+ this._scaleSetting.get(), this._deviceScaleFactorSetting.get() || defaultDeviceScaleFactor, mobile,
screenHeight >= screenWidth ? 'portraitPrimary' : 'landscapePrimary', resetPageScaleFactor);
this._applyUserAgent(mobile ? Emulation.DeviceModeModel._defaultMobileUserAgent : '');
this._applyTouch(
@@ -455,8 +456,8 @@ Emulation.DeviceModeModel = class {
/**
* @param {number} screenWidth
* @param {number} screenHeight
- * @param {!Insets=} outline
- * @param {!Insets=} insets
+ * @param {!UI.Insets=} outline
+ * @param {!UI.Insets=} insets
* @return {number}
*/
_calculateFitScale(screenWidth, screenHeight, outline, insets) {
@@ -500,9 +501,9 @@ Emulation.DeviceModeModel = class {
}
/**
- * @param {!Size} screenSize
- * @param {!Insets} insets
- * @param {!Insets} outline
+ * @param {!UI.Size} screenSize
+ * @param {!UI.Insets} insets
+ * @param {!UI.Insets} outline
* @param {number} scale
* @param {number} deviceScaleFactor
* @param {boolean} mobile
@@ -530,13 +531,13 @@ Emulation.DeviceModeModel = class {
this._appliedDeviceSize = screenSize;
this._appliedDeviceScaleFactor = deviceScaleFactor || window.devicePixelRatio;
- this._screenRect = new Common.Rect(
+ this._screenRect = new UI.Rect(
Math.max(0, (this._availableSize.width - screenSize.width * scale) / 2), outline.top * scale,
screenSize.width * scale, screenSize.height * scale);
- this._outlineRect = new Common.Rect(
+ this._outlineRect = new UI.Rect(
this._screenRect.left - outline.left * scale, 0, (outline.left + screenSize.width + outline.right) * scale,
(outline.top + screenSize.height + outline.bottom) * scale);
- this._visiblePageRect = new Common.Rect(
+ this._visiblePageRect = new UI.Rect(
positionX * scale, positionY * scale,
Math.min(pageWidth * scale, this._availableSize.width - this._screenRect.left - positionX * scale),
Math.min(pageHeight * scale, this._availableSize.height - this._screenRect.top - positionY * scale));

Powered by Google App Engine
This is Rietveld 408576698