Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 525465

Summary: [10.13] TextLayout with embedded images is missing text on macOS High Sierra
Product: [Eclipse Project] Platform Reporter: Peter Severin <peter>
Component: SWTAssignee: Lakshmi P Shanmugam <lshanmug>
Status: VERIFIED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: baza, lpvoisin, lshanmug, picard, register.eclipse, sravankumarl
Version: 4.7.1Flags: sravankumarl: review+
Target Milestone: 4.7.2   
Hardware: Macintosh   
OS: Mac OS X   
See Also: https://git.eclipse.org/r/111535
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=9efbe4a8235bbb98fd1e36720eea53d0f012e240
https://git.eclipse.org/r/111623
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=c3e3b10064d80fba27e34154f06a6ca0e75e381a
Whiteboard:
Bug Depends on:    
Bug Blocks: 527287    
Attachments:
Description Flags
Snippet205 on macOS High Sierra
none
Snippet205 on macOS Sierra none

Description Peter Severin CLA 2017-10-02 11:42:05 EDT
Created attachment 270785 [details]
Snippet205 on macOS High Sierra

TextLayout with embedded images is missing text on macOS High Sierra. This bug can be easily reproduced by running Snippet205 that shows how to embed images and widgets in text.

I'm attaching screenshots that show the difference when running the snippet on macOS Sierra and macOS High Sierra. I've also tested the beta version 10.13.1 of macOS High Sierra (the next release) and the problem is still there.

I'll try to investigate a little more to see if I can find an obvious issue. However if the problem is low level, then it's most probably out of my reach.

I've tested multiple versions of Eclipse, starting with 4.4 through 4.7.1 and the problem occurs on all of them.

Can someone from SWT Team look into it and if possible include the fix in the next bug fix version of 4.7 as being planned for Bug 519724?
Comment 1 Peter Severin CLA 2017-10-02 11:42:23 EDT
Created attachment 270786 [details]
Snippet205 on macOS Sierra
Comment 2 Peter Severin CLA 2017-10-02 12:13:20 EDT
I've investigated some more and I see a warning in the console that is most probably related to this issue:

... [SWTTextAttachmentCell attachment]: unrecognized selector sent to instance 0x79...

This warning is generated by the call to NSLayoutManager#drawGlyphsForGlyphRange from the TextLayout#draw method.

This method translates to the following:
  OS.objc_msgSend(this.id, OS.sel_drawGlyphsForGlyphRange_atPoint_, glyphsToShow, origin);

I hope this helps to identify the issue.
Comment 3 Peter Severin CLA 2017-10-05 07:55:13 EDT
Note that this bug also occurs with nightly builds of Eclipse 4.8. Is there anyone who look into this issue? It makes the product I am developing (WireframeSketcher) unusable under macOS High Sierra.
Comment 4 Maxim Bazarov CLA 2017-10-06 08:05:12 EDT
Guys, please fix this blocker.
Comment 5 Lakshmi P Shanmugam CLA 2017-10-09 12:52:13 EDT
I'm able to reproduce the problem and currently investigating it.
Setting target to 4.7.2.
Comment 6 Peter Severin CLA 2017-10-19 04:29:42 EDT
Lakshmi, do you have any update on this issue? It's rather critical for us. Thanks!
Comment 7 Peter Severin CLA 2017-11-09 23:48:56 EST
Version 4.7.2 is close to be released, but there is no fix for this bug. Is there any chance for it to be fixed?
Comment 8 Lakshmi P Shanmugam CLA 2017-11-09 23:57:37 EST
(In reply to Peter Severin from comment #7)
> Version 4.7.2 is close to be released, but there is no fix for this bug. Is
> there any chance for it to be fixed?

I'm currently working on this and plan to fix for 4.7.2.
Comment 9 Lakshmi P Shanmugam CLA 2017-11-13 15:08:57 EST
Hi Till, any idea on what has changed in NSTextAttachment/Cell?
Comment 10 Till Brychcy CLA 2017-11-14 03:43:35 EST
(In reply to Lakshmi Shanmugam from comment #9)
> Hi Till, any idea on what has changed in NSTextAttachment/Cell?

See https://developer.apple.com/documentation/appkit/nstextattachmentcellprotocol

NSTextAttachmentCellProtocol has this new and required property "attachment" (it seems since since 10.11):
https://developer.apple.com/documentation/appkit/nstextattachmentcellprotocol/1508396-attachment
Comment 11 Eclipse Genie CLA 2017-11-14 08:26:18 EST
New Gerrit change created: https://git.eclipse.org/r/111535
Comment 12 Peter Severin CLA 2017-11-14 09:35:56 EST
Will this change work on earlier versions of macOS than 10.11?
Comment 13 Lakshmi P Shanmugam CLA 2017-11-14 15:15:28 EST
(In reply to Till Brychcy from comment #10)
> (In reply to Lakshmi Shanmugam from comment #9)
> > Hi Till, any idea on what has changed in NSTextAttachment/Cell?
> 
> See
> https://developer.apple.com/documentation/appkit/nstextattachmentcellprotocol
> 
> NSTextAttachmentCellProtocol has this new and required property "attachment"
> (it seems since since 10.11):
> https://developer.apple.com/documentation/appkit/nstextattachmentcellprotocol/1508396-attachment
> 

Thanks Till! Adding the attachment method to SWTTextAttachmentCell fixes the problem. Looks like providing an implementation for attachment method is not required.
Comment 14 Lakshmi P Shanmugam CLA 2017-11-14 15:17:19 EST
(In reply to Peter Severin from comment #12)
> Will this change work on earlier versions of macOS than 10.11?

I've a updated the gerrit with a simplified patch and added a version check. I've not tested, but this should work with 10.10 as well.
Comment 16 Lakshmi P Shanmugam CLA 2017-11-15 07:21:07 EST
Verified the fix on 10.13 & 10.10.5 with I20171115-0115.
Comment 17 Eclipse Genie CLA 2017-11-15 07:53:36 EST
New Gerrit change created: https://git.eclipse.org/r/111623
Comment 19 Lakshmi P Shanmugam CLA 2017-11-16 01:28:07 EST
Thanks for the review, Sravan!
Marking as resolved.
Comment 20 Lakshmi P Shanmugam CLA 2017-11-16 04:16:21 EST
Verified with Build M20171115-1700 on macOS 10.13.1.
Comment 21 Laurent Voisin CLA 2017-11-17 03:44:28 EST
Thank you very much for fixing this ugly bug.