Avoid using wxHtmlTag::HasParam() unnecessarily.

Use GetParamAsXXX() accessors instead as they combine the calls to HasParam()
and GetParam() and make the code shorter and avoid the duplication of the tag
name.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74881 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-09-30 23:48:46 +00:00
parent 6d2190fcb4
commit 534f87c6c4
7 changed files with 81 additions and 127 deletions

View File

@@ -212,9 +212,10 @@ TAG_HANDLER_BEGIN(DIV, "DIV")
TAG_HANDLER_PROC(tag)
{
if(tag.HasParam(wxT("STYLE")))
wxString style;
if(tag.GetParamAsString(wxT("STYLE"), &style))
{
if(tag.GetParam(wxT("STYLE")).IsSameAs(wxT("PAGE-BREAK-BEFORE:ALWAYS"), false))
if(style.IsSameAs(wxT("PAGE-BREAK-BEFORE:ALWAYS"), false))
{
m_WParser->CloseContainer();
m_WParser->OpenContainer()->InsertCell(new wxHtmlPageBreakCell);
@@ -330,13 +331,10 @@ TAG_HANDLER_BEGIN(BODY, "BODY")
if ( !winIface )
return false;
if (tag.HasParam(wxT("BACKGROUND")))
wxString bg;
if (tag.GetParamAsString(wxT("BACKGROUND"), &bg))
{
wxFSFile *fileBgImage = m_WParser->OpenURL
(
wxHTML_URL_IMAGE,
tag.GetParam(wxT("BACKGROUND"))
);
wxFSFile *fileBgImage = m_WParser->OpenURL(wxHTML_URL_IMAGE, bg);
if ( fileBgImage )
{
wxInputStream *is = fileBgImage->GetStream();