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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js

Issue 2456203002: DevTools: Don't let the suggestbox overflow its bounds (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 this._overlay.setLeftOffset(anchorBox.x); 129 this._overlay.setLeftOffset(anchorBox.x);
130 130
131 var under = underHeight >= aboveHeight; 131 var under = underHeight >= aboveHeight;
132 if (under) 132 if (under)
133 this._overlay.setVerticalOffset(anchorBox.y + anchorBox.height, true ); 133 this._overlay.setVerticalOffset(anchorBox.y + anchorBox.height, true );
134 else 134 else
135 this._overlay.setVerticalOffset(totalHeight - anchorBox.y, false); 135 this._overlay.setVerticalOffset(totalHeight - anchorBox.y, false);
136 136
137 var spacer = 6; 137 var spacer = 6;
138 var maxHeight = this._maxItemsHeight ? this._maxItemsHeight * this._rowH eight : Math.max(underHeight, aboveHeight) - spacer; 138 var maxHeight = Math.min(Math.max(underHeight, aboveHeight) - spacer, th is._maxItemsHeight ? this._maxItemsHeight * this._rowHeight : 0);
139 var height = this._rowHeight * this._items.length; 139 var height = this._rowHeight * this._items.length;
140 this._hasVerticalScroll = height > maxHeight; 140 this._hasVerticalScroll = height > maxHeight;
141 this._element.style.height = Math.min(maxHeight, height) + "px"; 141 this._element.style.height = Math.min(maxHeight, height) + "px";
142 }, 142 },
143 143
144 _updateWidth: function() 144 _updateWidth: function()
145 { 145 {
146 if (this._hasVerticalScroll) { 146 if (this._hasVerticalScroll) {
147 this._element.style.width = "100vw"; 147 this._element.style.width = "100vw";
148 return; 148 return;
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 this.element.style.top = containerBox.y + "px"; 603 this.element.style.top = containerBox.y + "px";
604 this.element.style.height = containerBox.height + "px"; 604 this.element.style.height = containerBox.height + "px";
605 this.element.style.width = containerBox.width + "px"; 605 this.element.style.width = containerBox.width + "px";
606 }, 606 },
607 607
608 dispose: function() 608 dispose: function()
609 { 609 {
610 this.element.remove(); 610 this.element.remove();
611 } 611 }
612 }; 612 };
OLDNEW
« 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