Bug 118957 - Heading styles are changed after pasting html text
Summary: Heading styles are changed after pasting html text
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: Not Assigned
Depends on:
Blocks: HTML-Paste
  Show dependency treegraph
Reported: 2018-07-26 14:56 UTC by info
Modified: 2021-07-03 05:28 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:
Regression By:

Example HTML (349 bytes, text/html)
2018-09-06 18:24 UTC, Buovjaga

Note You need to log in before you can comment on or make changes to this bug.
Description info 2018-07-26 14:56:41 UTC
After pasting some html text, e.g. from FireFox, into LibreOffice Writer, the text font defined under "Default" in the styles manager is applied to all sections except for headings. 
For sections enclosed in <hn>-tags (e.g. <h1>,<h2>) the font of the associated 
heading style will always be changed to "Liberation Serif".

Steps to Reproduce:
1. Empty page, all fonts set to "Liberation Sans" at 
"Tools > Options > LibreOffice Writer > Basic Fonts (Western)"

2. Paste some html text from FireFox:
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<p>Some <b>sample text</b> for demonstration</p>
  <li>List 1</li>
  <li>List 2</li>

Actual Results:
In the styles "Heading 1" and "Heading 2" the font is changed to "Liberation Serif". All other text remains in the default font.

Expected Results:
Headings should use the font assigned by the associated style

Reproducible: Always

User Profile Reset: No

Additional Info:
Comment 1 Buovjaga 2018-09-06 18:24:51 UTC
Created attachment 144724 [details]
Example HTML

I reproduce, but the font displayed by browsers *is* a serif one, so I think we would get bug reports if we changed this.

Would prefer developer feedback.

Arch Linux 64-bit
Build ID: 033a68c49fe2b8aa397832d92d400eb0259ea809
CPU threads: 8; OS: Linux 4.18; UI render: default; VCL: gtk3_kde5; 
Locale: fi-FI (fi_FI.UTF-8); Calc: threaded
Built on September 5th 2018

3.3.0 on Win 10
Comment 2 info 2018-09-07 10:01:51 UTC
Browser will display the font which is specified in the style information of the web page. This must not be a "serif" font. 

But, when pasting a snippet from a web page, no font information will be transferred (see my sample text in the bug report). Just check the pasted text using a normal text editor.
Comment 3 Buovjaga 2018-09-07 10:57:20 UTC
Yep, it's true that even if I have

h1, h2 {
font-family: sans-serif;

LibreOffice uses serif
Comment 4 QA Administrators 2019-09-08 05:03:17 UTC Comment hidden (obsolete)
Comment 5 info 2019-09-08 09:58:34 UTC
The bug is still present in LibreOffice Version (x86)
Build-ID: 1ec314fa52f458adc18c4f025c545a4e8b22c15
Comment 6 info 2019-09-09 14:58:26 UTC
Same in version
Build-ID: b79626edf0065ac373bd1df5c28bd630b4424273