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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js

Issue 2889693008: DevTools: fix popover's account for scrollbar size when measuring content (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js b/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
index 1bd0b35867b9b01f7adb30b19fccd303ce737dd7..9375cb03a894a6ad5d75405ddb36ca667e63ef71 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
@@ -184,13 +184,13 @@ UI.GlassPane = class {
height = Math.min(height, this._maxSize.height);
}
- var measuredWidth = 0;
- var measuredHeight = 0;
if (this._sizeBehavior === UI.GlassPane.SizeBehavior.MeasureContent) {
- measuredWidth = this.contentElement.offsetWidth;
- measuredHeight = this.contentElement.offsetHeight;
- width = Math.min(width, measuredWidth);
- height = Math.min(height, measuredHeight);
+ var measuredWidth = this.contentElement.offsetWidth;
+ var measuredHeight = this.contentElement.offsetHeight;
+ var widthOverflow = height < measuredHeight ? scrollbarSize : 0;
+ var heightOverflow = width < measuredWidth ? scrollbarSize : 0;
+ width = Math.min(width, measuredWidth + widthOverflow);
+ height = Math.min(height, measuredHeight + heightOverflow);
}
if (this._anchorBox) {
@@ -212,8 +212,6 @@ UI.GlassPane = class {
positionY = Math.max(gutterSize, anchorBox.y - height - gutterSize);
var spaceTop = anchorBox.y - positionY - gutterSize;
if (this._sizeBehavior === UI.GlassPane.SizeBehavior.MeasureContent) {
- if (height < measuredHeight)
- width += scrollbarSize;
if (height > spaceTop) {
this._arrowElement.classList.add('arrow-none');
enoughHeight = false;
@@ -228,8 +226,6 @@ UI.GlassPane = class {
positionY = anchorBox.y + anchorBox.height + gutterSize;
var spaceBottom = containerHeight - positionY - gutterSize;
if (this._sizeBehavior === UI.GlassPane.SizeBehavior.MeasureContent) {
- if (height < measuredHeight)
- width += scrollbarSize;
if (height > spaceBottom) {
this._arrowElement.classList.add('arrow-none');
positionY = containerHeight - gutterSize - height;
@@ -270,8 +266,6 @@ UI.GlassPane = class {
positionX = Math.max(gutterSize, anchorBox.x - width - gutterSize);
var spaceLeft = anchorBox.x - positionX - gutterSize;
if (this._sizeBehavior === UI.GlassPane.SizeBehavior.MeasureContent) {
- if (width < measuredWidth)
- height += scrollbarSize;
if (width > spaceLeft) {
this._arrowElement.classList.add('arrow-none');
enoughWidth = false;
@@ -286,8 +280,6 @@ UI.GlassPane = class {
positionX = anchorBox.x + anchorBox.width + gutterSize;
var spaceRight = containerWidth - positionX - gutterSize;
if (this._sizeBehavior === UI.GlassPane.SizeBehavior.MeasureContent) {
- if (width < measuredWidth)
- height += scrollbarSize;
if (width > spaceRight) {
this._arrowElement.classList.add('arrow-none');
positionX = containerWidth - gutterSize - width;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698