Changeset 54059 in webkit


Ignore:
Timestamp:
Jan 29, 2010 6:10:54 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2010-01-29 Alexander Pavlov <apavlov@chromium.org>

Reviewed by Timothy Hatcher.

Web Inspector: Source view displays text using wrong fonts
https://bugs.webkit.org/show_bug.cgi?id=34269

  • inspector/front-end/TextEditor.js: (WebInspector.TextEditor): (WebInspector.TextEditor.prototype._initFont):
  • inspector/front-end/inspector.js:
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r54056 r54059  
     12010-01-29  Alexander Pavlov  <apavlov@chromium.org>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Web Inspector: Source view displays text using wrong fonts
     6        https://bugs.webkit.org/show_bug.cgi?id=34269
     7
     8        * inspector/front-end/TextEditor.js:
     9        (WebInspector.TextEditor):
     10        (WebInspector.TextEditor.prototype._initFont):
     11        * inspector/front-end/inspector.js:
     12
    1132010-01-29  Philippe Normand  <pnormand@igalia.com>
    214
  • trunk/WebCore/inspector/front-end/TextEditor.js

    r54052 r54059  
    7979    this._selection = new WebInspector.TextSelectionModel(this._selectionChanged.bind(this));
    8080
    81     this._isMacTiger = platform === "mac-tiger";
    82     this._isMacLeopard = platform === "mac-leopard";
    83     this._isMac = this._isMacTiger || this._isMacLeopard;
    84     this._isWin = platform === "windows";
     81    this._isMac = platform && (platform.indexOf("mac") === 0);
    8582
    8683    this._initFont();
     
    949946    },
    950947
    951     _initFont: function(sansSerif, fontSize)
    952     {
     948    _initFont: function(sansSerif)
     949    {
     950        if (!WebInspector.TextEditor.PlatformFonts) {
     951            WebInspector.TextEditor.PlatformFonts = {};
     952            WebInspector.TextEditor.PlatformFonts[WebInspector.OS.Windows] = {size: 12, face: "Lucida Console"};
     953            WebInspector.TextEditor.PlatformFonts[WebInspector.OS.WindowsVistaOrLater] = {size: 12, face: "Courier"};
     954            WebInspector.TextEditor.PlatformFonts[WebInspector.OS.MacSnowLeopard] = {size: 11, face: "Menlo"};
     955            WebInspector.TextEditor.PlatformFonts[WebInspector.OS.MacLeopard] = {size: 10, face: "Monaco"};
     956            WebInspector.TextEditor.PlatformFonts[WebInspector.OS.MacTiger] = {size: 10, face: "Monaco"};
     957        }
     958
    953959        if (sansSerif) {
    954960            this._isMonospace = false;
    955             this._fontSize = fontSize || 11;
     961            this._fontSize = 11;
    956962            this._font = this._fontSize + "px sans-serif";
    957963        } else {
    958964            this._isMonospace = true;
    959             this._fontSize = fontSize || 10;
    960             this._font = this._fontSize + "px monospace";
    961             if (this._isMac)
    962                 this._font = this._fontSize + "px Monaco";
    963             else if (this._isWin)
    964                 this._font = (this._fontSize + 1) + "px Courier New";
     965            const platform = WebInspector.platform;
     966            const fontInfo = WebInspector.TextEditor.PlatformFonts[platform] || {size: 10, face: "monospace"};
     967            this._fontSize = fontInfo.size;
     968            this._font = this._fontSize + "px " + fontInfo.face;
    965969        }
    966970        this._ctx.font = this._font;
  • trunk/WebCore/inspector/front-end/inspector.js

    r54001 r54059  
    5656    missingLocalizedStrings: {},
    5757    pendingDispatches: 0,
    58     OS: {
    59         Windows: "windows",
    60         WindowsVistaOrLater: "windows-vista-or-later",
    61         MacTiger: "mac-tiger",
    62         MacLeopard: "mac-leopard",
    63         MacSnowLeopard: "mac-snowleopard"
    64     },
    6558
    6659    // RegExp groups:
     
    421414        }
    422415    }
     416}
     417
     418WebInspector.OS = {
     419    Windows: "windows",
     420    WindowsVistaOrLater: "windows-vista-or-later",
     421    MacTiger: "mac-tiger",
     422    MacLeopard: "mac-leopard",
     423    MacSnowLeopard: "mac-snowleopard"
    423424}
    424425
Note: See TracChangeset for help on using the changeset viewer.