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

Unified Diff: chrome/browser/resources/file_manager/js/text_measure.js

Issue 39123003: [Files.app] Split the JavaScript files into subdirectories: common, background, and foreground (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed test failure. Created 7 years, 2 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
Index: chrome/browser/resources/file_manager/js/text_measure.js
diff --git a/chrome/browser/resources/file_manager/js/text_measure.js b/chrome/browser/resources/file_manager/js/text_measure.js
deleted file mode 100644
index a8db83ae5825ccdb0cbab3f26abefe92d9178772..0000000000000000000000000000000000000000
--- a/chrome/browser/resources/file_manager/js/text_measure.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-'use strict';
-
-/**
- * TextMeasure constructor.
- *
- * TextMeasure is a measure for text that returns the width of text. This
- * class has a dummy span element. When measuring the width of text, it sets
- * the text to the element and obtains the element's size by
- * getBoundingClientRect.
- *
- * @constructor
- * @param {HTMLElement} element Element that has styles of measured text. The
- * width of text is measures like as it is rendered in this element.
- */
-var TextMeasure = function(element) {
- var doc = element.ownerDocument;
- this.dummySpan_ = doc.createElement('span');
- this.dummySpan_ = doc.getElementsByTagName('body')[0].
- appendChild(this.dummySpan_);
- this.dummySpan_.style.position = 'absolute';
- this.dummySpan_.style.visibility = 'hidden';
- var styles = window.getComputedStyle(element, '');
- var stylesToBeCopied = [
- 'fontSize',
- 'fontStyle',
- 'fontWeight',
- 'fontFamily',
- 'letterSpacing'
- ];
- for (var i = 0; i < stylesToBeCopied.length; i++) {
- this.dummySpan_.style[stylesToBeCopied[i]] = styles[stylesToBeCopied[i]];
- }
- Object.seal(this);
-};
-
-/**
- * Measures the width of text.
- *
- * @param {string} text Text that is measured the width.
- * @return {number} Width of the specified text.
- */
-TextMeasure.prototype.getWidth = function(text) {
- this.dummySpan_.innerText = text;
- var rect = this.dummySpan_.getBoundingClientRect();
- return rect ? rect.width : 0;
-};
« no previous file with comments | « chrome/browser/resources/file_manager/js/test_util.js ('k') | chrome/browser/resources/file_manager/js/tree.css.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698