Bug 535108 - HTMLPrinter should not use deprecated HTML attributes
Summary: HTMLPrinter should not use deprecated HTML attributes
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.8   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Matthias Becker CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-25 06:33 EDT by Matthias Becker CLA
Modified: 2020-06-09 10:12 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Becker CLA 2018-05-25 06:33:17 EDT
Currently HTML printer add the deprecated attributes "text" and "bgColor" on the "body" element.
This happens in the insertPageProlog methods.

As you see on https://www.w3schools.com/tags/tag_body.asp these attributes are deprecated and no longer part of HTML5.
So we should use CSS styling instead.

And as you see on https://www.w3schools.com/code/tryit.asp?filename=FRNK6GARW2H9 CSS rules overrule these attributes on the <body> tag (tested on chrome, safari and IE).
Comment 1 Eclipse Genie CLA 2018-05-25 06:35:00 EDT
New Gerrit change created: https://git.eclipse.org/r/123323
Comment 2 Lars Vogel CLA 2018-05-25 06:40:03 EDT
+1
Comment 3 Matthias Becker CLA 2018-05-25 06:41:22 EDT
A manual test of my fix should be performed. The JDT code element information hovers e.g. use HTML printer. The should look the same way as before.
Comment 4 Dani Megert CLA 2018-05-25 11:17:10 EDT
(In reply to Matthias Becker from comment #3)
> A manual test of my fix should be performed. The JDT code element
> information hovers e.g. use HTML printer. The should look the same way as
> before.

That class (or better, the package) is marked as friends to many. There is a big chance that you break things here.
Comment 5 Matthias Becker CLA 2018-06-07 02:05:49 EDT
Can someone pls. test my patch on windows and linux. I am a Mac guy.
Comment 6 Matthias Becker CLA 2018-06-15 09:55:05 EDT
(In reply to Dani Megert from comment #4)
> That class (or better, the package) is marked as friends to many. There is a
> big chance that you break things here.

I added a second patchset that changes the implementation in a way that the old and
the new behavior *should* be the same.

In the old implementation the colors added to the body tag could be overrules by color specifications of the body element in the provided sytlesheet.

The new implementation added the colors also as CSS rules but at the first position. Due to the "cascading" in CSS rules that come later in the sytlesheet overrule rules that appeared before.

Shouldn't we give it a try?
Comment 7 Lars Vogel CLA 2018-06-15 10:02:33 EDT
+1
Comment 8 Matthias Becker CLA 2018-06-18 11:46:36 EDT
I existing code does assume that HTMLPrinter adds the "text" and the "bgcolor" attributes on the "body" element, this change would break that existing code.
See: https://git.eclipse.org/r/#/c/124564/
Comment 9 Dani Megert CLA 2018-06-18 11:54:40 EDT
(In reply to Matthias Becker from comment #8)
> I existing code does assume that HTMLPrinter adds the "text" and the
> "bgcolor" attributes on the "body" element, this change would break that
> existing code.
> See: https://git.eclipse.org/r/#/c/124564/

As I said. Touching HTMLPrinter will most likely cause havoc.
Comment 10 Matthias Becker CLA 2018-06-19 01:46:12 EDT
(In reply to Dani Megert from comment #9)
> As I said. Touching HTMLPrinter will most likely cause havoc.
I would say that relying on the HTML code that is generated by HTMLPrinter (by replacing parts of it) is a miss-use of HTMLPrinter.
I just browsed a bit through JDT, PDE and Platform and all the usages of HTMLPrinter look good for me
Comment 11 Lars Vogel CLA 2018-08-23 09:37:05 EDT
Matthias, would be nice to close this for RC1.
Comment 12 Matthias Becker CLA 2018-08-24 06:48:22 EDT
(In reply to Matthias Becker from comment #10)
> (In reply to Dani Megert from comment #9)
> > As I said. Touching HTMLPrinter will most likely cause havoc.
> I would say that relying on the HTML code that is generated by HTMLPrinter
> (by replacing parts of it) is a miss-use of HTMLPrinter.
> I just browsed a bit through JDT, PDE and Platform and all the usages of
> HTMLPrinter look good for me

So it was only patchset 1 and 2 that did string-manipulate the resulting HTML it optained from HTMLPrinter. In the final version of that change everything is fine.
As stated above the behaviour of the generated HTML is the same. But the generated HTML  code is different. So everbody that makes assumptions about the generated HTML code (and tries to manipulate it) might break. But as stated above I would say this a miss-use.

My change brings JUnit test with it that document the behaviour and does these all combinations - we didn't have JUnits for HTMLPrinter before.
So I still would propose to merge this change - but maybe not in the RC-phase as time is short once we find places that break. So should we merge it beginning for 4.10?
Comment 13 Dani Megert CLA 2018-08-24 06:57:49 EDT
(In reply to Matthias Becker from comment #12)
> I still would propose to merge this change - but maybe not in the
> RC-phase as time is short once we find places that break. So should we merge
> it beginning for 4.10?

+1.
Comment 14 Eclipse Genie CLA 2018-08-24 07:27:27 EDT
New Gerrit change created: https://git.eclipse.org/r/128023
Comment 15 Matthias Becker CLA 2018-08-24 07:29:53 EDT
(In reply to Eclipse Genie from comment #14)
> New Gerrit change created: https://git.eclipse.org/r/128023

Some of the friends of HTMLPrinter's package (org.eclipse.ui.workbench.texteditor and
org.eclipse.jdt.debug.ui) did no longer use that package.
So I removed these friends. I did not get any new warnings / errors about using not released stuff - or did I miss something?
Comment 16 Dani Megert CLA 2018-08-24 09:40:09 EDT
(In reply to Matthias Becker from comment #15)
> (In reply to Eclipse Genie from comment #14)
> > New Gerrit change created: https://git.eclipse.org/r/128023
> 
> Some of the friends of HTMLPrinter's package
> (org.eclipse.ui.workbench.texteditor and
> org.eclipse.jdt.debug.ui) did no longer use that package.
> So I removed these friends. I did not get any new warnings / errors about
> using not released stuff - or did I miss something?

Sounds reasonable.
Comment 18 Mickael Istria CLA 2018-11-19 16:11:20 EST
What's missing here? Can it be marked as resolved?
Comment 19 Dani Megert CLA 2018-11-22 09:21:10 EST
(In reply to Mickael Istria from comment #18)
> What's missing here?

https://git.eclipse.org/r/#/c/123323/

Moving t. 4.11 (see latest comment in the Gerrit change).
Comment 20 Dani Megert CLA 2019-06-26 12:10:57 EDT
What's the status here?
Comment 21 Lars Vogel CLA 2019-09-05 04:26:49 EDT
Matthias, can you finish this one in 4.14?