Skip to content

Commit

Permalink
Bug 675165 - Uses <img> instead of <object> html tag for SVG images
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri van Heesch committed May 15, 2016
1 parent ab96c07 commit 8ccd986
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions src/htmldocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@ void HtmlDocVisitor::visitPre(DocHtmlTable *t)
}
else
{
m_t << "<table " << htmlAttribsToString(t->attribs()) << ">\n";
m_t << "<table" << htmlAttribsToString(t->attribs()) << ">\n";
}
}

Expand Down Expand Up @@ -1429,17 +1429,43 @@ void HtmlDocVisitor::visitPre(DocImage *img)
}
m_t << "<div class=\"image\">" << endl;
QCString url = img->url();
QCString sizeAttribs;
if (!img->width().isEmpty())
{
sizeAttribs+=" width=\""+img->width()+"\"";
}
if (!img->height().isEmpty())
{
sizeAttribs+=" height=\""+img->height()+"\"";
}
if (url.isEmpty())
{
m_t << "<img src=\"" << img->relPath() << img->name() << "\" alt=\""
<< baseName << "\"" << htmlAttribsToString(img->attribs())
<< "/>" << endl;
if (img->name().right(4)==".svg")
{
m_t << "<object type=\"image/svg+xml\" data=\"" << img->relPath() << img->name()
<< "\"" << sizeAttribs << htmlAttribsToString(img->attribs()) << ">" << baseName
<< "</object>" << endl;
}
else
{
m_t << "<img src=\"" << img->relPath() << img->name() << "\" alt=\""
<< baseName << "\"" << sizeAttribs << htmlAttribsToString(img->attribs())
<< "/>" << endl;
}
}
else
{
m_t << "<img src=\"" << correctURL(url,img->relPath()) << "\" "
<< htmlAttribsToString(img->attribs())
<< "/>" << endl;
if (url.right(4)==".svg")
{
m_t << "<object type=\"image/svg+xml\" data=\"" << correctURL(url,img->relPath())
<< "\"" << sizeAttribs << htmlAttribsToString(img->attribs()) << "></object>" << endl;
}
else
{
m_t << "<img src=\"" << correctURL(url,img->relPath()) << "\""
<< sizeAttribs << htmlAttribsToString(img->attribs())
<< "/>" << endl;
}
}
if (img->hasCaption())
{
Expand Down Expand Up @@ -1810,7 +1836,7 @@ void HtmlDocVisitor::visitPre(DocHtmlBlockQuote *b)
}
else
{
m_t << "<blockquote " << htmlAttribsToString(b->attribs()) << ">\n";
m_t << "<blockquote" << htmlAttribsToString(b->attribs()) << ">\n";
}
}

Expand Down

0 comments on commit 8ccd986

Please sign in to comment.