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

Unified Diff: tools/cc-frame-viewer/src/ui.js

Issue 12225131: [cc] Initial checkin of cc-frame-viewer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 10 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 | « tools/cc-frame-viewer/src/tree_quad_view_test.html ('k') | tools/cc-frame-viewer/src/ui/drag_handle.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cc-frame-viewer/src/ui.js
diff --git a/chrome/common/extensions/docs/examples/api/fontSettings/js/cr/ui.js b/tools/cc-frame-viewer/src/ui.js
similarity index 93%
copy from chrome/common/extensions/docs/examples/api/fontSettings/js/cr/ui.js
copy to tools/cc-frame-viewer/src/ui.js
index d48d3a8e010fd0c2026394356372266fe8974053..3dfb446b0235d185fe19c5faa7c176359c9e5c04 100644
--- a/chrome/common/extensions/docs/examples/api/fontSettings/js/cr/ui.js
+++ b/tools/cc-frame-viewer/src/ui.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('cr.ui', function() {
+base.exportTo('ui', function() {
/**
* Decorates elements as an instance of a class.
@@ -15,7 +15,7 @@ cr.define('cr.ui', function() {
function decorate(source, constr) {
var elements;
if (typeof source == 'string')
- elements = cr.doc.querySelectorAll(source);
+ elements = base.doc.querySelectorAll(source);
else
elements = [source];
@@ -34,7 +34,7 @@ cr.define('cr.ui', function() {
if (opt_bag && opt_bag.ownerDocument)
doc = opt_bag.ownerDocument;
else
- doc = cr.doc;
+ doc = base.doc;
return doc.createElement(tagName);
}
@@ -43,7 +43,7 @@ cr.define('cr.ui', function() {
*
* Usage:
* <pre>
- * var List = cr.ui.define('list');
+ * var List = ui.define('list');
* List.prototype = {
* __proto__: HTMLUListElement.prototype,
* decorate: function() {
@@ -106,9 +106,8 @@ cr.define('cr.ui', function() {
* @param {HTMLElement} el The element to limit the width for.
* @param {number} parentEl The parent element that should limit the size.
* @param {number} min The minimum width.
- * @param {number} opt_scale Optional scale factor to apply to the width.
*/
- function limitInputWidth(el, parentEl, min, opt_scale) {
+ function limitInputWidth(el, parentEl, min) {
// Needs a size larger than borders
el.style.width = '10px';
var doc = el.ownerDocument;
@@ -135,8 +134,6 @@ cr.define('cr.ui', function() {
parseInt(parentComputedStyle.paddingRight, 10);
var max = parentEl.clientWidth - startPos - inner - parentPadding;
- if (opt_scale)
- max *= opt_scale;
function limit() {
if (el.scrollWidth > max) {
@@ -168,10 +165,18 @@ cr.define('cr.ui', function() {
return Math.round(pixels) + 'px';
}
+ function createSpan(opt_text) {
+ var spanEl = document.createElement('span');
+ if (opt_text)
+ spanEl.textContent = opt_text;
+ return spanEl;
+ };
+
return {
decorate: decorate,
define: define,
limitInputWidth: limitInputWidth,
toCssPx: toCssPx,
+ createSpan: createSpan
};
});
« no previous file with comments | « tools/cc-frame-viewer/src/tree_quad_view_test.html ('k') | tools/cc-frame-viewer/src/ui/drag_handle.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698