]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix handling of spaces after <img> tag in wxHTML.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 Sep 2012 22:20:34 +0000 (22:20 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 Sep 2012 22:20:34 +0000 (22:20 +0000)
Don't collapse the spaces following this tag with the ones preceding it.

See #14557.

Closes #2980.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/html/winpars.h
src/html/m_image.cpp

index f01c8c190080776fd857f5f1212a2310405b2db0..1e268512a1d3a99ccb30f9a77ab3ec33f7e9f3bb 100644 (file)
@@ -138,6 +138,11 @@ public:
     // applies current parser state (link, sub/supscript, ...) to given cell
     void ApplyStateToCell(wxHtmlCell *cell);
 
+    // Needs to be called after inserting a cell that interrupts the flow of
+    // the text like e.g. <img> and tells us to not consider any of the
+    // following space as being part of the same space run as before.
+    void StopCollapsingSpaces() { m_tmpLastWasSpace = false; }
+
 #if !wxUSE_UNICODE
     void SetInputEncoding(wxFontEncoding enc);
     wxFontEncoding GetInputEncoding() const { return m_InputEnc; }
index df6295ecc75ec0715d52546634e689002bd3be9b..87aa320f80a392c70eb2c691fc00d08201df45ab 100644 (file)
@@ -718,6 +718,7 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
                                           m_WParser->GetPixelScale(),
                                           al, mn);
                 m_WParser->ApplyStateToCell(cel);
+                m_WParser->StopCollapsingSpaces();
                 cel->SetId(tag.GetParam(wxT("id"))); // may be empty
                 cel->SetAlt(tag.GetParam(wxT("alt")));
                 m_WParser->GetContainer()->InsertCell(cel);