Skip to content

Instantly share code, notes, and snippets.

@NexAdn
Created May 18, 2018 11:07
Show Gist options
  • Save NexAdn/b86820b12e20f1c4beb86e6a77c7a5c8 to your computer and use it in GitHub Desktop.
Save NexAdn/b86820b12e20f1c4beb86e6a77c7a5c8 to your computer and use it in GitHub Desktop.
diff --git a/src/browser/browser-client.cpp b/src/browser/browser-client.cpp
index 744aae5..09dc31d 100644
--- a/src/browser/browser-client.cpp
+++ b/src/browser/browser-client.cpp
@@ -17,6 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <algorithm>
#include <math.h>
+#include <sstream>
+#include <string>
#include "base64.hpp"
#include "browser-client.hpp"
@@ -92,7 +94,7 @@ void BrowserClient::SetScroll(CefRefPtr<CefBrowser> browser, uint32_t vertical,
this->scroll_vertical = vertical;
this->scroll_horizontal = horizontal;
CefRefPtr<CefFrame> frame = browser->GetMainFrame();
- std::string script = "window.scrollTo(";
- script += std::to_string(horizontal) + "," + std::to_string(vertical) + ");";
- frame->ExecuteJavaScript(script, frame->GetURL(), 0);
+ std::stringstream script;
+ script << "window.scrollTo(" << horizontal << "," << vertical << ");";
+ frame->ExecuteJavaScript(script.str(), frame->GetURL(), 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment