Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @param {!WebInspector.ViewportControl.Provider} provider | 33 * @param {!WebInspector.ViewportControl.Provider} provider |
| 34 */ | 34 */ |
| 35 WebInspector.ViewportControl = function(provider) | 35 WebInspector.ViewportControl = function(provider) |
| 36 { | 36 { |
| 37 this.element = createElement("div"); | 37 this.element = createElement("div"); |
| 38 this.element.style.overflow = "auto"; | 38 this.element.style.overflow = "auto"; |
| 39 this._topGapElement = this.element.createChild("div"); | 39 this._topGapElement = this.element.createChild("div"); |
| 40 this._topGapElement.textContent = "."; | |
|
pfeldman
2016/01/22 01:37:34
lushnikov@ says that "." was here to render select
skobes
2016/01/22 01:51:53
I first tried eliminating the text content but ins
| |
| 41 this._topGapElement.style.height = "0px"; | 40 this._topGapElement.style.height = "0px"; |
|
pfeldman
2016/01/22 01:37:34
how come it contributes to the height? - it has ze
skobes
2016/01/22 01:51:53
The text content produces overflow which contribut
| |
| 42 this._topGapElement.style.color = "transparent"; | 41 this._topGapElement.style.color = "transparent"; |
| 43 this._contentElement = this.element.createChild("div"); | 42 this._contentElement = this.element.createChild("div"); |
| 44 this._bottomGapElement = this.element.createChild("div"); | 43 this._bottomGapElement = this.element.createChild("div"); |
| 45 this._bottomGapElement.textContent = "."; | |
| 46 this._bottomGapElement.style.height = "0px"; | 44 this._bottomGapElement.style.height = "0px"; |
| 47 this._bottomGapElement.style.color = "transparent"; | 45 this._bottomGapElement.style.color = "transparent"; |
| 48 | 46 |
| 47 // Text content needed for range intersection checks in _updateSelectionMode l. | |
| 48 // Use Unicode ZERO WIDTH NO-BREAK SPACE, which avoids contributing any heig ht to the element's layout overflow. | |
| 49 this._topGapElement.textContent = "\uFEFF"; | |
| 50 this._bottomGapElement.textContent = "\uFEFF"; | |
| 51 | |
| 49 this._provider = provider; | 52 this._provider = provider; |
| 50 this.element.addEventListener("scroll", this._onScroll.bind(this), false); | 53 this.element.addEventListener("scroll", this._onScroll.bind(this), false); |
| 51 this.element.addEventListener("copy", this._onCopy.bind(this), false); | 54 this.element.addEventListener("copy", this._onCopy.bind(this), false); |
| 52 this.element.addEventListener("dragstart", this._onDragStart.bind(this), fal se); | 55 this.element.addEventListener("dragstart", this._onDragStart.bind(this), fal se); |
| 53 | 56 |
| 54 this._firstVisibleIndex = 0; | 57 this._firstVisibleIndex = 0; |
| 55 this._lastVisibleIndex = -1; | 58 this._lastVisibleIndex = -1; |
| 56 this._renderedItems = []; | 59 this._renderedItems = []; |
| 57 this._anchorSelection = null; | 60 this._anchorSelection = null; |
| 58 this._headSelection = null; | 61 this._headSelection = null; |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 627 | 630 |
| 628 /** | 631 /** |
| 629 * @return {number} | 632 * @return {number} |
| 630 */ | 633 */ |
| 631 _visibleHeight: function() | 634 _visibleHeight: function() |
| 632 { | 635 { |
| 633 // Use offsetHeight instead of clientHeight to avoid being affected by h orizontal scroll. | 636 // Use offsetHeight instead of clientHeight to avoid being affected by h orizontal scroll. |
| 634 return this.element.offsetHeight; | 637 return this.element.offsetHeight; |
| 635 } | 638 } |
| 636 } | 639 } |
| OLD | NEW |