Bug 161038

Summary: Web Inspector: Styles -> Computed -> Box Model shows NaN x NaN for invisible elements
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, hi, joepeck, mattbaker, nvasilyev, saam, timothy, webkit-bug-importer
Priority: P2 Keywords: EasyFix, GoodFirstBug, InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[Image] Bug
none
Patch
none
Patch none

Description Nikita Vasilyev 2016-08-21 14:44:44 PDT
Created attachment 286574 [details]
[Image] Bug

Steps:
1. Inspect <head>
2. Open Styles -> Computed -> Box Model

Actual:
NaN x NaN in the middle of the box.

Expected:
Nothing or an em-dash in the middle of the box.
Comment 1 Radar WebKit Bug Importer 2016-08-21 14:44:57 PDT
<rdar://problem/27941030>
Comment 2 Devin Rousso 2016-08-21 21:00:32 PDT
Created attachment 286583 [details]
Patch
Comment 3 Joseph Pecoraro 2016-08-22 14:44:07 PDT
Comment on attachment 286583 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=286583&action=review

r- for the const issue, but the patch looks good otherwise. If you can confirm, or move back to var, r=me

> Source/WebInspectorUI/UserInterface/Base/Utilities.js:29
> -var emDash = "\u2014";
> -var enDash = "\u2013";
> -var ellipsis = "\u2026";
> +const emDash = "\u2014";
> +const enDash = "\u2013";
> +const figureDash = "\u2012";
> +const ellipsis = "\u2026";

Wow! I didn't know about "Figure Dash". Crazy!

I am pretty sure these need to be `var` and cannot be `const`. Based on what I learned from r187012 which made "WebInspector" in WebInspector.js non-const:

>    Source/WebInspectorUI:
>    
>    "const" variables do not live on the global object and are only
>    accessible within the "Program" they're defined in. Therefore,
>    the WebInspector global must be defined as "var" and not "const".
>    
>    * UserInterface/Base/WebInspector.js:

My understanding is that by using let/const these variables are scoped to this file and this file only. So when other files attempt to use these "global variables" they won't work.

With script:

    var globalVar;
    let globalLet;
    const globalConst;

You can think of this as:

    GlobalScope (globalVar)
        GlobalLexicalEnvironment (globalLet, globalConst)

And each file (program) shares the GlobalScope but has its own GlobalLexicalEnvironment.

While this might work in Production builds where we combine all resources, I think it wouldn't work in local builds where Utilities.js is included separately as its own file.

Can you verify that? If not, then we may have an ES6 issue (/cc Saam).
Comment 4 Devin Rousso 2016-08-22 14:53:04 PDT
(In reply to comment #3)
> Can you verify that? If not, then we may have an ES6 issue (/cc Saam).

When I tested this on my computer, it seemed to work just fine.  ಠ_ಠ
Comment 5 Devin Rousso 2016-08-22 20:37:41 PDT
Created attachment 286661 [details]
Patch
Comment 6 Joseph Pecoraro 2016-08-22 21:31:28 PDT
Comment on attachment 286661 [details]
Patch

r=me
Comment 7 WebKit Commit Bot 2016-08-22 23:11:16 PDT
Comment on attachment 286661 [details]
Patch

Clearing flags on attachment: 286661

Committed r204759: <http://trac.webkit.org/changeset/204759>
Comment 8 WebKit Commit Bot 2016-08-22 23:11:21 PDT
All reviewed patches have been landed.  Closing bug.