diff options
author | Michael Stahl <mstahl@redhat.com> | 2018-01-22 19:48:06 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-06 21:37:57 +0100 |
commit | 12605a68effc52b887d9bc6b59bcf34920bdc05c (patch) | |
tree | 22d694ee4bba07a2176abb0b1bf76764cfa79a48 /sw/source/filter/html/swhtml.cxx | |
parent | cd9d633151727d68629a150fbb65be0c996e23c0 (diff) |
ofz#5566 sw: HTML import: ignore <DIV> in table structure elements
Looking at the HTML4 DTD https://www.w3.org/TR/html4/sgml/dtd.html,
inside TABLE only various elements defining the structure of the table
allowed, except inside cells (TD and TH elements).
DIV in a table but outside cells may cause cursor positions to go
off the rails, so better ignore such invalid DIV tags.
Reviewed-on: https://gerrit.libreoffice.org/48359
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 8b1a83bffe35ae0e71735569512c1586bcb37b25)
Reviewed-on: https://gerrit.libreoffice.org/48526
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 7283bdaf9cdc81dbec55c915ecd8c2571478bc4d)
Change-Id: Ia6195d80670631669c252d572242874b13642b74
Diffstat (limited to 'sw/source/filter/html/swhtml.cxx')
-rw-r--r-- | sw/source/filter/html/swhtml.cxx | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 058c39ad0b89..fb2a16ed1bff 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -296,6 +296,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn, m_bInFootEndNoteSymbol( false ), m_bIgnoreHTMLComments( bNoHTMLComments ), m_bRemoveHidden( false ), + m_isInTableStructure(false), m_pTempViewFrame(nullptr) { m_nEventId = nullptr; @@ -1543,26 +1544,32 @@ void SwHTMLParser::NextToken( int nToken ) // divisions case HTML_DIVISION_ON: case HTML_CENTER_ON: - if( m_nOpenParaToken ) - { - if( IsReadPRE() ) - m_nOpenParaToken = 0; - else - EndPara(); + if (!m_isInTableStructure) + { + if( m_nOpenParaToken ) + { + if( IsReadPRE() ) + m_nOpenParaToken = 0; + else + EndPara(); + } + NewDivision( nToken ); } - NewDivision( nToken ); break; case HTML_DIVISION_OFF: case HTML_CENTER_OFF: - if( m_nOpenParaToken ) + if (!m_isInTableStructure) { - if( IsReadPRE() ) - m_nOpenParaToken = 0; - else - EndPara(); + if( m_nOpenParaToken ) + { + if( IsReadPRE() ) + m_nOpenParaToken = 0; + else + EndPara(); + } + EndDivision( nToken ); } - EndDivision( nToken ); break; case HTML_MULTICOL_ON: |