OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Base class to represent a "view". A view is an absolutely positioned box on | 6 * Base class to represent a "view". A view is an absolutely positioned box on |
7 * the page. | 7 * the page. |
8 * | 8 * |
9 * @constructor | 9 * @constructor |
10 */ | 10 */ |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 | 73 |
74 /** | 74 /** |
75 * DivView is an implementation of View that wraps a DIV. | 75 * DivView is an implementation of View that wraps a DIV. |
76 * | 76 * |
77 * @constructor | 77 * @constructor |
78 */ | 78 */ |
79 function DivView(divId) { | 79 function DivView(divId) { |
80 View.call(this); | 80 View.call(this); |
81 | 81 |
82 this.node_ = document.getElementById(divId); | 82 this.node_ = document.getElementById(divId); |
83 if(!this.node_) | |
84 throw new Error("Element " + divId + " not found"); | |
arv (Not doing code reviews)
2010/12/08 17:55:19
use single quotes
nduca
2010/12/08 19:08:22
Done.
| |
83 | 85 |
84 // Initialize the default values to those of the DIV. | 86 // Initialize the default values to those of the DIV. |
85 this.width_ = this.node_.offsetWidth; | 87 this.width_ = this.node_.offsetWidth; |
86 this.height_ = this.node_.offsetHeight; | 88 this.height_ = this.node_.offsetHeight; |
87 this.isVisible_ = this.node_.style.display != 'none'; | 89 this.isVisible_ = this.node_.style.display != 'none'; |
88 } | 90 } |
89 | 91 |
90 inherits(DivView, View); | 92 inherits(DivView, View); |
91 | 93 |
92 DivView.prototype.setGeometry = function(left, top, width, height) { | 94 DivView.prototype.setGeometry = function(left, top, width, height) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 | 134 |
133 WindowView.prototype.show = function() { | 135 WindowView.prototype.show = function() { |
134 WindowView.superClass_.show.call(this, isVisible); | 136 WindowView.superClass_.show.call(this, isVisible); |
135 this.childView_.show(isVisible); | 137 this.childView_.show(isVisible); |
136 }; | 138 }; |
137 | 139 |
138 WindowView.prototype.resetGeometry = function() { | 140 WindowView.prototype.resetGeometry = function() { |
139 this.setGeometry(0, 0, window.innerWidth, window.innerHeight); | 141 this.setGeometry(0, 0, window.innerWidth, window.innerHeight); |
140 }; | 142 }; |
141 | 143 |
OLD | NEW |