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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 this._renderedItems = []; | 59 this._renderedItems = []; |
60 this._anchorSelection = null; | 60 this._anchorSelection = null; |
61 this._headSelection = null; | 61 this._headSelection = null; |
62 this._itemCount = 0; | 62 this._itemCount = 0; |
63 | 63 |
64 // Listen for any changes to descendants and trigger a refresh. This ensures | 64 // Listen for any changes to descendants and trigger a refresh. This ensures |
65 // that items updated asynchronously will not break stick-to-bottom behavior | 65 // that items updated asynchronously will not break stick-to-bottom behavior |
66 // if they change the scroll height. | 66 // if they change the scroll height. |
67 this._observer = new MutationObserver(this.refresh.bind(this)); | 67 this._observer = new MutationObserver(this.refresh.bind(this)); |
68 this._observerConfig = { childList: true, subtree: true }; | 68 this._observerConfig = { childList: true, subtree: true }; |
69 } | 69 }; |
70 | 70 |
71 /** | 71 /** |
72 * @interface | 72 * @interface |
73 */ | 73 */ |
74 WebInspector.ViewportControl.Provider = function() | 74 WebInspector.ViewportControl.Provider = function() |
75 { | 75 { |
76 } | 76 }; |
77 | 77 |
78 WebInspector.ViewportControl.Provider.prototype = { | 78 WebInspector.ViewportControl.Provider.prototype = { |
79 /** | 79 /** |
80 * @param {number} index | 80 * @param {number} index |
81 * @return {number} | 81 * @return {number} |
82 */ | 82 */ |
83 fastHeight: function(index) { return 0; }, | 83 fastHeight: function(index) { return 0; }, |
84 | 84 |
85 /** | 85 /** |
86 * @return {number} | 86 * @return {number} |
87 */ | 87 */ |
88 itemCount: function() { return 0; }, | 88 itemCount: function() { return 0; }, |
89 | 89 |
90 /** | 90 /** |
91 * @return {number} | 91 * @return {number} |
92 */ | 92 */ |
93 minimumRowHeight: function() { return 0; }, | 93 minimumRowHeight: function() { return 0; }, |
94 | 94 |
95 /** | 95 /** |
96 * @param {number} index | 96 * @param {number} index |
97 * @return {?WebInspector.ViewportElement} | 97 * @return {?WebInspector.ViewportElement} |
98 */ | 98 */ |
99 itemElement: function(index) { return null; } | 99 itemElement: function(index) { return null; } |
100 } | 100 }; |
101 | 101 |
102 /** | 102 /** |
103 * @interface | 103 * @interface |
104 */ | 104 */ |
105 WebInspector.ViewportElement = function() { } | 105 WebInspector.ViewportElement = function() { }; |
106 WebInspector.ViewportElement.prototype = { | 106 WebInspector.ViewportElement.prototype = { |
107 willHide: function() { }, | 107 willHide: function() { }, |
108 | 108 |
109 wasShown: function() { }, | 109 wasShown: function() { }, |
110 | 110 |
111 /** | 111 /** |
112 * @return {!Element} | 112 * @return {!Element} |
113 */ | 113 */ |
114 element: function() { }, | 114 element: function() { }, |
115 } | 115 }; |
116 | 116 |
117 /** | 117 /** |
118 * @constructor | 118 * @constructor |
119 * @implements {WebInspector.ViewportElement} | 119 * @implements {WebInspector.ViewportElement} |
120 * @param {!Element} element | 120 * @param {!Element} element |
121 */ | 121 */ |
122 WebInspector.StaticViewportElement = function(element) | 122 WebInspector.StaticViewportElement = function(element) |
123 { | 123 { |
124 this._element = element; | 124 this._element = element; |
125 } | 125 }; |
126 | 126 |
127 WebInspector.StaticViewportElement.prototype = { | 127 WebInspector.StaticViewportElement.prototype = { |
128 /** | 128 /** |
129 * @override | 129 * @override |
130 */ | 130 */ |
131 willHide: function() { }, | 131 willHide: function() { }, |
132 | 132 |
133 /** | 133 /** |
134 * @override | 134 * @override |
135 */ | 135 */ |
136 wasShown: function() { }, | 136 wasShown: function() { }, |
137 | 137 |
138 /** | 138 /** |
139 * @override | 139 * @override |
140 * @return {!Element} | 140 * @return {!Element} |
141 */ | 141 */ |
142 element: function() | 142 element: function() |
143 { | 143 { |
144 return this._element; | 144 return this._element; |
145 }, | 145 }, |
146 } | 146 }; |
147 | 147 |
148 WebInspector.ViewportControl.prototype = { | 148 WebInspector.ViewportControl.prototype = { |
149 /** | 149 /** |
150 * @return {boolean} | 150 * @return {boolean} |
151 */ | 151 */ |
152 stickToBottom: function() | 152 stickToBottom: function() |
153 { | 153 { |
154 return this._stickToBottom; | 154 return this._stickToBottom; |
155 }, | 155 }, |
156 | 156 |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 }, | 659 }, |
660 | 660 |
661 /** | 661 /** |
662 * @return {number} | 662 * @return {number} |
663 */ | 663 */ |
664 _visibleHeight: function() | 664 _visibleHeight: function() |
665 { | 665 { |
666 // Use offsetHeight instead of clientHeight to avoid being affected by h
orizontal scroll. | 666 // Use offsetHeight instead of clientHeight to avoid being affected by h
orizontal scroll. |
667 return this.element.offsetHeight; | 667 return this.element.offsetHeight; |
668 } | 668 } |
669 } | 669 }; |
OLD | NEW |