From eb433d8d6604160e862045cf3f75283688bec281 Mon Sep 17 00:00:00 2001 From: Adam Fowler <adamfowleruk@gmail.com> Date: Wed, 1 Jan 2020 10:44:08 -0500 Subject: [PATCH] Added rendering of html string --- containers/haiku/container_haiku.cpp | 16 +++++++++++++++- containers/haiku/container_haiku.h | 7 +++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/containers/haiku/container_haiku.cpp b/containers/haiku/container_haiku.cpp index 21d40ed..e919a6d 100644 --- a/containers/haiku/container_haiku.cpp +++ b/containers/haiku/container_haiku.cpp @@ -1,3 +1,9 @@ +/* + * Copyright 2019-2020 Haiku Inc. + * All rights reserved. Distributed under the terms of the BSD 3-clause license. + * Constributors + * 2019-2020 Adam Fowler <adamfowleruk@gmail.com> + */ #include "container_haiku.h" #include <string> @@ -67,9 +73,17 @@ LiteHtmlView::RenderFile(const char* localFilePath) set_base_url(dirPath.Path()); //std::cout << " base url now:" << m_base_url << std::endl; + RenderHTML(html); +} + +void +LiteHtmlView::RenderHTML(const std::string& htmlText) +{ + std::cout << "RenderHTML" << std::endl; + // now use this string m_html = litehtml::document::createFromString( - html.c_str(), this, fContext); + htmlText.c_str(), this, fContext); if (m_html) { std::cout << "Successfully read html" << std::endl; diff --git a/containers/haiku/container_haiku.h b/containers/haiku/container_haiku.h index 73b7864..31d7f12 100644 --- a/containers/haiku/container_haiku.h +++ b/containers/haiku/container_haiku.h @@ -1,3 +1,9 @@ +/* + * Copyright 2019-2020 Haiku Inc. + * All rights reserved. Distributed under the terms of the BSD 3-clause license. + * Constributors + * 2019-2020 Adam Fowler <adamfowleruk@gmail.com> + */ #ifndef LITEHTMLVIEW_H #define LITEHTMLVIEW_H @@ -26,6 +32,7 @@ public: void SetContext(litehtml::context* ctx); void RenderFile(const char* localFilePath); + void RenderHTML(const std::string& htmlText); virtual litehtml::uint_ptr create_font(const litehtml::tchar_t* faceName, int size, int weight, litehtml::font_style italic, unsigned int decoration, litehtml::font_metrics* fm) override;