Am 16.05.2011 16:23, schrieb Michael Meeks:
Hi Christina,

On Mon, 2011-03-14 at 16:33 +0100, Christina Roßmanith wrote:
I'm playing with bug 34666 and observed that the token
HTML_UNKNOWNCONTROL_OFF is never encountered:
        Ho hum - did this get fixed - it seems that 34666 is now closed with
Indeed it has been fixed with my patch (17.3.2011) and closed (18.3.2011).
this:

        https://bugs.freedesktop.org/show_bug.cgi?id=36080#c2
This is a different problem which persists with the patch mentioned above. The attached patch (0001-*) fixes bug 36390 which is equivalent to the behaviour described in https://bugs.freedesktop.org/show_bug.cgi?id=36080#c2 . There are translations in this patch as well - sorry for that. A second patch (0005-*) introduces a test, whether it's a token that can be switched off.

Open question: Which bugs should be mentioned in the comment? Only 36390 and 34666 or 36080 as well because the patch fixes a problem discussed in the comments of that bug? Maybe there is no strict rule and it's more a matter of taste - then I'd keep 36080...

Christina
>From 547ae6618e085029c90c612861c86975f3296c96 Mon Sep 17 00:00:00 2001
From: Christina Rossmanith <[email protected]>
Date: Sat, 23 Apr 2011 22:25:26 +0200
Subject: [PATCH 1/5] Bug 36390 <title /> breaks html filter fixed

---
 svtools/source/svhtml/parhtml.cxx |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index aa760fa..77bdb75 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -372,7 +372,7 @@ int HTMLParser::FilterToken( int nToken )
     {
     case sal_Unicode(EOF):
         nToken = 0;
-        break;			// nicht verschicken
+        break;			// don't pass
 
     case HTML_HEAD_OFF:
         bIsInBody = sal_True;
@@ -393,7 +393,7 @@ int HTMLParser::FilterToken( int nToken )
     case HTML_HTML_OFF:
         nToken = 0;
         bReadPRE = bReadListing = bReadXMP = sal_False;
-        break;		// HTML_ON wurde auch nicht verschickt !
+        break;		// HTML_ON hasn't been passed either !
 
     case HTML_PREFORMTXT_ON:
         StartPRE();
@@ -1223,12 +1223,10 @@ int HTMLParser::_GetNextToken()
                     {
                         ScanText( '>' );
 
-                        // fdo#34666: closing "/>"?:
-                        // return HTML_UNKNOWNCONTROL_OFF instead of
-                        // HTML_UNKNOWNCONTROL_ON
+                        // fdo#34666 fdo#36080 fdo#36390: closing "/>"?:
+                        // return HTML_<TOKEN>_OFF instead of HTML_<TOKEN>_ON
                         if (aToken.Len() >= 1 && '/' == aToken.GetChar(aToken.Len()-1)) {
-                            if (HTML_UNKNOWNCONTROL_ON == nRet)
-                                nRet = HTML_UNKNOWNCONTROL_OFF;
+                            nRet += 1; // HTML_<TOKEN>_ON -> HTML_<TOKEN>_OFF;
                         }
                         if( sal_Unicode(EOF) == nNextCh && rInput.IsEof() )
                         {
@@ -1351,7 +1349,6 @@ int HTMLParser::_GetNextToken()
                         bReadStyle = sal_False;
                         break;
                     }
-
                 }
             }
             break;
@@ -1648,7 +1645,7 @@ int HTMLParser::FilterPRE( int nToken )
         {
             xub_StrLen nSpaces = sal::static_int_cast< xub_StrLen >(
                 8 - (nPre_LinePos % 8));
-            DBG_ASSERT( !aToken.Len(), "Wieso ist das Token nicht leer?" );
+            DBG_ASSERT( !aToken.Len(), "Why is the token not empty?" );
             aToken.Expand( nSpaces, ' ' );
             nPre_LinePos += nSpaces;
             nToken = HTML_TEXTTOKEN;
-- 
1.7.0.4

>From d283b2949c972e8236faceae3fc27fa6c71fa93e Mon Sep 17 00:00:00 2001
From: Christina Rossmanith <[email protected]>
Date: Thu, 12 May 2011 11:18:14 +0200
Subject: [PATCH 5/5] Added HTML_TOKEN_ONOFF test

---
 svtools/source/svhtml/parhtml.cxx |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 77bdb75..66ef97c 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -1225,8 +1225,9 @@ int HTMLParser::_GetNextToken()
 
                         // fdo#34666 fdo#36080 fdo#36390: closing "/>"?:
                         // return HTML_<TOKEN>_OFF instead of HTML_<TOKEN>_ON
-                        if (aToken.Len() >= 1 && '/' == aToken.GetChar(aToken.Len()-1)) {
-                            nRet += 1; // HTML_<TOKEN>_ON -> HTML_<TOKEN>_OFF;
+                        if ((HTML_TOKEN_ONOFF & nRet) && (aToken.Len() >= 1) &&
+                            ('/' == aToken.GetChar(aToken.Len()-1))) {
+                            ++nRet; // HTML_<TOKEN>_ON -> HTML_<TOKEN>_OFF;
                         }
                         if( sal_Unicode(EOF) == nNextCh && rInput.IsEof() )
                         {
-- 
1.7.0.4

_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to