Bug 81297 - FILEOPEN: HTML file loads with header <h4> in gray rather than black
Summary: FILEOPEN: HTML file loads with header <h4> in gray rather than black
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks: Writer-Styles-Heading HTML-Import
  Show dependency treegraph
 
Reported: 2014-07-13 15:07 UTC by Yousuf Philips (jay) (retired)
Modified: 2017-10-22 20:07 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Philips (jay) (retired) 2014-07-13 15:07:32 UTC
While checking bug 80668, I see that with LibO 4.2 and above, the <h4> html tag is being shown in gray rather than in attachment 102656 [details].

Steps:
1) open attachment 102656 [details]
2) look at the text 'Фильтры' underneath the horizontal line

Observed: text is in gray

Expected: text to be in black

There is no html or css code defined that it should be gray, so LibO is using its own heading 4 style found in text document files rather than using the standard html styling.

How it looks in 4.1 vs 4.2 and above - attachment 102682 [details]
Comment 1 Jorendc 2014-07-16 19:44:40 UTC
Repro, Linux Mint 17 x64 with LibreOffice Version: 4.4.0.0.alpha0+
Build ID: 7ed283b9bcdde1ae7d858d04880115a1b5a45315

Kind regards,
Joren
Comment 2 Michael Stahl (CIB) 2014-07-23 15:27:59 UTC
bibisect range:
832586588c3ed5f1686a4ecebc2ed198ce049b24..3c01203ea657b9a3538f9956591b3d4da5fce6e7

commit 5cf62a6ab450c25eb07a1ec08c857f17f674ef67
Author:     Ahmad H. Al Harthi <aalharthi@kacst.edu.sa>
AuthorDate: Mon Nov 4 15:37:48 2013 +0300
    First modification on the default template for the Writer
    
    Headings modified and resized based on discussions at
    http://nabble.documentfoundation.org/Default-Writer-Template-td4076271.html
    

so the built-in defaults for headings changed.

i am not sure if this is really a bug - are there default values
specified for font properties of headings in HTML, or is
this up to applications to do what they want?
Comment 3 Jorendc 2014-07-23 15:38:19 UTC
(In reply to comment #2)
> i am not sure if this is really a bug - are there default values
> specified for font properties of headings in HTML, or is
> this up to applications to do what they want?

True. There is indeed no header style in the CSS either. But if it is not specified, I guess we shouldn't forcing it as 'black' as other applications do to?
Comment 4 Jan Holesovsky 2014-07-23 16:02:42 UTC
It is good to use the standard LibreOffice styles in the html import, as you can directly paste stuff, and it is formatted as expected; so I don't think we want to introduce special 'HTML styles' that would be only black.

So that would leave us with setting black with direct formatting; which is worse than having a special HTML style :-)

So unless we want to revert the Heading 4 style back to black, I think we should resolve this bug as NOTABUG - let's see if we get some other complaints about this.
Comment 5 Yousuf Philips (jay) (retired) 2014-07-23 20:02:12 UTC
There are default html styles for html tags and libreoffice should be following them, as it did in LibO 4.1.

http://www.w3.org/wiki/HTML/Elements/h1,_h2,_h3,_h4,_h5,_and_h6

If libreoffice is attempting to act like a WYSIWYG html editor, it should show html styles like it will be presented in a browser and not document styles. IMHO.
Comment 6 V Stuart Foote 2014-12-24 03:18:57 UTC
(In reply to Jay Philips from comment #5)
> There are default html styles for html tags and libreoffice should be
> following them, as it did in LibO 4.1.
> ... 
> If libreoffice is attempting to act like a WYSIWYG html editor, it should
> show html styles like it will be presented in a browser and not document
> styles. IMHO.

@Jay, I know this is kind of old and moldy, but a browser default color is not specified for <h1> - <h6> elements--is that what you meant?  See refs

When saved and opened as HTML in a browser a LibreOffice generated HTML document does not specify, nor show a color.  It is only when opened with LibreOffice writer with defaults that it currently will show gray in heading 3 <h3> and heading 4 <h4> elements because of Ahmad H. Al Harthi's default template rework in Oct 2013 defining the headline values for the default template style.

I've posted a proposed patch to bug 82041 to remove the gray color from headline 3 and headline 4--will allow HTML documents with <h3> and <h4> elements to use defaults.

Was it just the color that was objectionable--or was there a more general concern that LibreOffice should behave as if it also embedded "default" CSS2 for HTML 4 elements.

Believe these are the "suggested" W3C CSS defaults--note no color specification, but as can be seen in the refs each browser (and application) will set their own.  Should LibreOffice?

You'll see this or similar described as default CSS Settings for the heading elements -- LibreOffice does not seem to comply when viewing HTML markup.

h1 {
    display: block;
    font-size: 2em;
    margin-top: 0.67em;
    margin-bottom: 0.67em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
}
h2 {
    display: block;
    font-size: 1.5em;
    margin-top: 0.83em;
    margin-bottom: 0.83em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
}
h3 {
    display: block;
    font-size: 1.17em;
    margin-top: 1em;
    margin-bottom: 1em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
}
h4 {
    display: block;
    margin-top: 1.33em;
    margin-bottom: 1.33em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
}
h5 {
    display: block;
    font-size: .83em;
    margin-top: 1.67em;
    margin-bottom: 1.67em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
}
h6 {
    display: block;
    font-size: .67em;
    margin-top: 2.33em;
    margin-bottom: 2.33em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
}


-=refs=-
Geko/Mozilla
mxr.mozilla.org/mozilla-central/source/layout/style/html.css#164
Chrome/Safari
http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css
Internet Explorer
http://www.iecss.com/
Comment 7 Yousuf Philips (jay) (retired) 2014-12-24 05:07:22 UTC
(In reply to V Stuart Foote from comment #6)
> @Jay, I know this is kind of old and moldy, but a browser default color is
> not specified for <h1> - <h6> elements--is that what you meant?  See refs

@Stuart, yes there isnt a default color used in h1 to h6 elements but all browsers show it in black by default, so LO showing it in gray wasnt good.

> When saved and opened as HTML in a browser a LibreOffice generated HTML
> document does not specify, nor show a color.  It is only when opened with
> LibreOffice writer with defaults that it currently will show gray in heading
> 3 <h3> and heading 4 <h4> elements because of Ahmad H. Al Harthi's default
> template rework in Oct 2013 defining the headline values for the default
> template style.

Yes this was the main conflict i wanted to address that rendering in LO and the browser were different and they shouldnt be.

> I've posted a proposed patch to bug 82041 to remove the gray color from
> headline 3 and headline 4--will allow HTML documents with <h3> and <h4>
> elements to use defaults.

Thanks for that.

> Was it just the color that was objectionable--or was there a more general
> concern that LibreOffice should behave as if it also embedded "default" CSS2
> for HTML 4 elements.

Well this bug was only trying to address the color aspect of it, but ideally LO should use html default styles when working with html documents.

> Believe these are the "suggested" W3C CSS defaults--note no color
> specification, but as can be seen in the refs each browser (and application)
> will set their own.  Should LibreOffice?

Looking at the refs, i can see all of them use the same style for h1, but may add additional things to it that are only supported by their browser.

Mozilla
h1 {
  display: block;
  font-size: 2em;
  font-weight: bold;
  margin: .67em 0;
}

Webkit
h1 {
    display: block;
    font-size: 2em;
    -webkit-margin-before: 0.67em;
    -webkit-margin-after: 0.67em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

IE 9
h1 {
	display: block;
	font-size: 2em;
	font-weight: bold;
	margin: 0.67em 0;
	page-break-after: avoid;
}

I think we should use mozilla's specification as they stick to css standards and dont add in their own browser-specific css.

> You'll see this or similar described as default CSS Settings for the heading
> elements -- LibreOffice does not seem to comply when viewing HTML markup.

If it is possible to load up default html styles into writer when it opens as writer web, then LO should show an html document with html styles if it wants to be considered an WYSIWYG html editor, as it should look no different in LO as it does in a browser.