Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / devtools / front_end / source_frame / FontView.js
index 38963d3..da28f5f 100644 (file)
  */
 
 /**
- * @extends {WebInspector.ResourceView}
+ * @extends {WebInspector.VBox}
  * @constructor
+ * @param {string} url
  */
-WebInspector.FontView = function(resource)
+WebInspector.FontView = function(url)
 {
-    WebInspector.ResourceView.call(this, resource);
-
-    this.element.classList.add("font");
+    WebInspector.VBox.call(this);
+    this.registerRequiredCSS("source_frame/fontView.css");
+    this.element.classList.add("font-view");
+    this._url = url
 }
 
 WebInspector.FontView._fontPreviewLines = [ "ABCDEFGHIJKLM", "NOPQRSTUVWXYZ", "abcdefghijklm", "nopqrstuvwxyz", "1234567890" ];
@@ -44,14 +46,6 @@ WebInspector.FontView._fontId = 0;
 WebInspector.FontView._measureFontSize = 50;
 
 WebInspector.FontView.prototype = {
-    /**
-     * @return {boolean}
-     */
-    hasContent: function()
-    {
-        return true;
-    },
-
     _createContentIfNeeded: function()
     {
         if (this.fontPreviewElement)
@@ -59,11 +53,11 @@ WebInspector.FontView.prototype = {
 
         var uniqueFontName = "WebInspectorFontPreview" + (++WebInspector.FontView._fontId);
 
-        this.fontStyleElement = document.createElement("style");
-        this.fontStyleElement.textContent = "@font-face { font-family: \"" + uniqueFontName + "\"; src: url(" + this.resource.url + "); }";
-        document.head.appendChild(this.fontStyleElement);
+        this.fontStyleElement = createElement("style");
+        this.fontStyleElement.textContent = "@font-face { font-family: \"" + uniqueFontName + "\"; src: url(" + this._url + "); }";
+        this.element.ownerDocument.head.appendChild(this.fontStyleElement);
 
-        var fontPreview = document.createElement("div");
+        var fontPreview = createElement("div");
         for (var i = 0; i < WebInspector.FontView._fontPreviewLines.length; ++i) {
             if (i > 0)
                 fontPreview.createChild("br");
@@ -140,5 +134,5 @@ WebInspector.FontView.prototype = {
         this.fontPreviewElement.style.setProperty("font-size", finalFontSize + "px", null);
     },
 
-    __proto__: WebInspector.ResourceView.prototype
+    __proto__: WebInspector.VBox.prototype
 }