Html bugs

This commit is contained in:
Oleg Korshul
2019-05-07 19:21:58 +03:00
committed by Alexey Golubev
parent 8af48b5ba9
commit c13cc5f29b
3 changed files with 63 additions and 2 deletions

View File

@ -13,7 +13,6 @@ include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri)
include($$CORE_ROOT_DIR/../desktop-sdk/ChromiumBasedEditors/lib/AscDocumentsCore_base.pri)
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lUnicodeConverter -lkernel -lgraphics
DESTDIR=$$CORE_BUILDS_LIBRARIES_PATH
HEADERS += \
@ -40,3 +39,6 @@ linux-g++ | linux-g++-64 | linux-g++-32 {
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN/converter\'"
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
}
#DEFINES += DEBUG_WINDOW_SHOW
#DESTDIR=$$CORE_ROOT_DIR/HtmlFile/test/Debug/HtmlFileInternal

View File

@ -100,6 +100,7 @@ class CHtmlClientHandler : public client::ClientHandler, public client::ClientHa
private:
std::wstring m_sTempFile;
std::wstring m_sCachePath;
bool m_bIsLoadedFirst;
public:
CGlobalHtmlFileParams* m_global;
@ -108,10 +109,17 @@ public:
CefRefPtr<CefBrowser> m_browser;
public:
CHtmlClientHandler(CGlobalHtmlFileParams* params) : client::ClientHandler(this, true, "html_file")
CHtmlClientHandler(CGlobalHtmlFileParams* params) : client::ClientHandler(this,
#ifdef DEBUG_WINDOW_SHOW
false,
#else
true,
#endif
"html_file")
{
m_global = params;
m_render = new CHtmlRenderHandler();
m_bIsLoadedFirst = false;
}
virtual CefRefPtr<CefRenderHandler> GetRenderHandler()
@ -283,6 +291,39 @@ window.onload = function ()\
return true;
}
virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool is_redirect)
{
//std::wstring sUrl = request->GetURL().ToWString();
bool bIsMain = frame->IsMain();
if (bIsMain)
{
if (m_bIsLoadedFirst)
return true;
m_bIsLoadedFirst = true;
}
return false;
}
virtual void OnBeforeDownload(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback)
{
CEF_REQUIRE_UI_THREAD();
callback->Continue("", false);
}
virtual void OnDownloadUpdated(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
CefRefPtr<CefDownloadItemCallback> callback) OVERRIDE
{
CEF_REQUIRE_UI_THREAD();
callback->Cancel();
}
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message)
@ -293,7 +334,9 @@ window.onload = function ()\
std::string message_name = message->GetName();
if (message_name == "Exit")
{
#ifndef DEBUG_WINDOW_SHOW
this->Exit();
#endif
return true;
}

View File

@ -81,6 +81,18 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
int nCmdShow)
{
std::wstring sXml(lpCmdLine);
#ifdef DEBUG_WINDOW_SHOW
// fix for qt debugger
if (sXml.length() > 2)
{
if ('\"' == sXml.c_str()[0])
sXml = sXml.substr(1);
if ('\"' == sXml.c_str()[sXml.length() - 1])
sXml = sXml.substr(0, sXml.length() - 1);
}
#endif
#endif
bool bIsChromiumSubprocess = true;
@ -204,7 +216,11 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
client_handler->Init();
CefWindowInfo window_info;
#ifdef DEBUG_WINDOW_SHOW
window_info.SetAsPopup(NULL, "HTML");
#else
window_info.SetAsWindowless(NULL);
#endif
CefRefPtr<CefRequestContext> request_context;
CefBrowserSettings browser_settings;