Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron 2.0.x: characters render duplicated when opacity is used in editor #52196

Closed
ggovan opened this issue Jun 18, 2018 · 18 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug electron Issues and items related to Electron electron-blocker Issues in next update of Electron preventing update verified Verification succeeded
Milestone

Comments

@ggovan
Copy link

ggovan commented Jun 18, 2018

Issue Type: Bug

In a JS or TS file create an unused import import * as unused from 'somewhere'

The editor then reads

import **asaunused from 'somewhere';

The text when copy and pasted is correct. The DOM looks correct. removing the opacity of the &nbsp elements fixes the issue.

image

VS Code version: Code - Insiders 1.25.0-insider (c51cf86, 2018-06-18T08:50:30.859Z)
OS version: Windows_NT x64 10.0.16299

System Info
Item Value
CPUs Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz (4 x 3392)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 15.91GB (5.10GB free)
Process Argv C:\Program Files\Microsoft VS Code Insiders\Code - Insiders.exe --disable-extensions
Screen Reader no
VM 0%
Extensions disabled
@vscodebot vscodebot bot added the terminal Integrated terminal issues label Jun 18, 2018
@mjbvz mjbvz assigned mjbvz and unassigned Tyriar Jun 18, 2018
@mjbvz mjbvz added javascript JavaScript support issues and removed terminal Integrated terminal issues labels Jun 18, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Jun 18, 2018

So if you paste import * as unused from 'somewhere' in to an editor, the text looks corrupted?

Can you please share you user configuration. Have you configured a font for example?

@mjbvz mjbvz added the info-needed Issue requires more information from poster label Jun 18, 2018
@ggovan
Copy link
Author

ggovan commented Jun 19, 2018

Here is my user config. I get the same issue if I remove the zoomLevel.

{
    "window.zoomLevel": -1,
    "todohighlight.isCaseSensitive": false,
    "todohighlight.include": "{**/*.cs,**/*.jsx,**/*.ts,**/*.html,**/*.php,**/*.css,**/*.scss}",
    "vsicons.dontShowNewVersionMessage": true,
    "workbench.iconTheme": "vscode-icons",
    "workbench.colorTheme": "Solarized Light",
    "java.home": "C:\\Program Files\\Java\\jdk1.8.0_131",
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
    "java.errors.incompleteClasspath.severity": "ignore",
    "diffEditor.ignoreTrimWhitespace": false,
}

@mjbvz mjbvz removed the javascript JavaScript support issues label Jun 19, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Jun 19, 2018

@alexandrudima @rebornix Any thoughts on this issue? I haven't been able to repo it

@rebornix
Copy link
Member

@mjbvz I ran into this issue a couple of times last week when doing refactoring. Will see If I can have a stable reproduce.

@ggovan ggovan closed this as completed Jun 20, 2018
@ggovan ggovan reopened this Jun 20, 2018
@ggovan
Copy link
Author

ggovan commented Jun 20, 2018

Sorry wrong, button.

I meant to say that I have tried this on another machine with the same setup and was unable to reproduce it. But on my main machine it is consistent across multiple projects and restarts.

@alexdima
Copy link
Member

I am also not able to reproduce.

@joaomoreno
Copy link
Member

Just reproduced it! 🎆

Paste these contents in a .ts file:

function foo() {
    const a = `hdshhdasha;
    return `hello`;
}

And have this tsconfig.json:

{
    "compilerOptions": {
        "noUnusedLocals": true
    }
}

A mysterious a creeps out from under the shadows!!! 😨

image

@joaomoreno
Copy link
Member

joaomoreno commented Jun 21, 2018

OK, what. It doesn't repro with --disable-gpu. It doesn't repro in Electron < 2.

My graphics card specs are:

Intel Iris Pro:

  Chipset Model:	Intel Iris Pro
  Type:	GPU
  Bus:	Built-In
  VRAM (Dynamic, Max):	1536 MB
  Vendor:	Intel
  Device ID:	0x0d26
  Revision ID:	0x0008
  Metal:	Supported, feature set macOS GPUFamily1 v3
  Displays:
Color LCD:
  Display Type:	Built-In Retina LCD
  Resolution:	2880 x 1800 Retina
  Framebuffer Depth:	24-Bit Color (ARGB8888)
  Main Display:	Yes
  Mirror:	Off
  Online:	Yes
  Rotation:	Supported
  Automatically Adjust Brightness:	No

@ggovan What's your graphics card?

@joaomoreno joaomoreno added bug Issue identified by VS Code Team member as probable bug electron-update electron Issues and items related to Electron and removed info-needed Issue requires more information from poster labels Jun 21, 2018
@joaomoreno joaomoreno added this to the Backlog milestone Jun 21, 2018
@joaomoreno joaomoreno assigned bpasero and unassigned rebornix, alexdima and mjbvz Jun 21, 2018
@ggovan
Copy link
Author

ggovan commented Jun 21, 2018

Good to see it's not just me.

Name	- Intel(R) HD Graphics 4600
PNP Device ID	- PCI\VEN_8086&DEV_0412&SUBSYS_05A41028&REV_06\3&11583659&0&10
Adapter Type	- Intel(R) HD Graphics Family, Intel Corporation compatible
Adapter Description	- Intel(R) HD Graphics 4600
Adapter RAM	 - 1.00 GB (1,073,741,824 bytes)
Installed Drivers	- igdumdim64.dll,igd10iumd64.dll,igd10iumd64.dll,igd12umd64.dll
Driver Version -	20.19.15.4531
INF File	- oem76.inf (iHSWD_w10 section)
Colour Planes- Not Available
Colour Table Entries -	4294967296
Resolution	- 1680 x 1050 x 59 hertz
Bits/Pixel -	32
Memory Address	- 0xF7800000-0xF7BFFFFF
Memory Address	- 0xE0000000-0xEFFFFFFF
I/O Port	- 0x0000F000-0x0000F03F
IRQ Channel - IRQ 4294967290
I/O Port	- 0x000003B0-0x000003BB
I/O Port	- 0x000003C0-0x000003DF
Memory Address	- 0xA0000-0xBFFFF
Driver	- c:\windows\system32\drivers\igdkmd64.sys (20.19.15.4531, 7.61 MB (7,974,904 bytes), 22/02/2017 00:31)

@joaomoreno
Copy link
Member

@ggovan Can you reproduce with --disable-gpu?

@ggovan
Copy link
Author

ggovan commented Jun 21, 2018

Everything works fine when I --disable-gpu.

@alexdima
Copy link
Member

@chrmarti does this work fine for you when running with --disable-gpu ?

@chrmarti
Copy link
Contributor

To reproduce in Electrom:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Hello World!</title>
  </head>
  <body>
<style>
  .squiggly-inline-unnecessary {
  opacity: 0.6;
}
.view-line {
  font-family: "Monaco";
    font-weight: normal;
    font-size: 14px;
    line-height: 21px;
    letter-spacing: 0px;
}
  </style>
<div style="top:21px;height:21px;" class="view-line"><span><span class="mtk1">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="mtk5 squiggly-inline-unnecessary">const</span><span class="mtk1 squiggly-inline-unnecessary">&nbsp;</span><span class="mtk13 squiggly-inline-unnecessary">a</span><span class="mtk1 squiggly-inline-unnecessary">&nbsp;</span><span class="mtk17 squiggly-inline-unnecessary">=</span><span class="mtk1 squiggly-inline-unnecessary">&nbsp;</span><span class="mtk9 squiggly-inline-unnecessary">`hdshhdasha;</span></span></div>

    <h1>Hello World!</h1>
    <!-- All of the Node.js APIs are available in this renderer process. -->
    We are using Node.js <script>document.write(process.versions.node)</script>,
    Chromium <script>document.write(process.versions.chrome)</script>,
    and Electron <script>document.write(process.versions.electron)</script>.

    <script>
      // You can also require other files to run in this process
      require('./renderer.js')
    </script>
  </body>
</html>

image

@alexdima
Copy link
Member

alexdima commented Jun 21, 2018

I've created electron/electron#13367 to track this upstream.

@bpasero bpasero removed this from the Backlog milestone Jun 25, 2018
@ggovan
Copy link
Author

ggovan commented Jul 11, 2018

I no longer have this issue on 1.26.0-insider (Commit: bbafa06 Date: 2018-07-09T05:49:15.364Z).

I'm happy for this to be closed.

@bpasero
Copy link
Member

bpasero commented Jul 12, 2018

@alexandrudima @rebornix since I cannot find a correlating issue at Chrome so far, I am thinking of a workaround we could apply in VSCode. Looks like adding will-change: transform; to the .squiggly-inline-unnecessary class fixes it, but the implications are not entirely clear to me (other than knowing that Chrome will put the elements matching this class on a separate layer for painting).

Also, I wonder if there could be another case where this hits us in the editor that we did not discover yet, e.g. is there another case where we combine &nbsp; with opacity and monospace fonts.

Another thing that seems to help is to NOT assign the squiggly-inline-unnecessary class to <span>&nbsp;</span>, but I am not sure how much control over that is possible.

I do not think we should ship an update with this bug as I can cause too much confusion, so I am adding the electron-blocker label.

@bpasero bpasero added the electron-blocker Issues in next update of Electron preventing update label Jul 12, 2018
@bpasero bpasero changed the title Unused imports appear to contain repeated characters Electron 2.0.x: characters render duplicated when opacity is used in editor Jul 12, 2018
bpasero added a commit that referenced this issue Jul 17, 2018
@Tyriar
Copy link
Member

Tyriar commented Jul 18, 2018

Moving to Chromium v63's version of skia appears to have fixed the issue (@deepak1556 put a build together for me to test).

Before:

screen shot 2018-07-18 at 2 07 53 pm

After:

screen shot 2018-07-18 at 2 10 02 pm

Tested on mid 2014 mac with Intel Iris Pro 1536 MB.

@bpasero
Copy link
Member

bpasero commented Aug 6, 2018

We pushed a workaround using will-change:opacity for these.

@bpasero bpasero closed this as completed Aug 6, 2018
@bpasero bpasero added this to the July 2018 milestone Aug 6, 2018
@joaomoreno joaomoreno added the verified Verification succeeded label Aug 6, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug electron Issues and items related to Electron electron-blocker Issues in next update of Electron preventing update verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

8 participants