From 659212a433df33cae44ecee2eedcb70563f3ad9c Mon Sep 17 00:00:00 2001 From: openkraken-bot Date: Tue, 17 May 2022 09:15:40 +0000 Subject: [PATCH] Committing clang-format changes --- bridge/bindings/qjs/atomic_string.h | 4 +++- bridge/bindings/qjs/binding_initializer.cc | 2 +- bridge/core/dom/document.cc | 3 ++- bridge/core/dom/scripted_animation_controller.cc | 11 ++++++++--- bridge/core/frame/legacy/location.cc | 3 ++- bridge/core/frame/legacy/location.h | 4 ++-- bridge/core/frame/window.cc | 7 +++---- bridge/core/frame/window_test.cc | 6 +++--- 8 files changed, 24 insertions(+), 16 deletions(-) diff --git a/bridge/bindings/qjs/atomic_string.h b/bridge/bindings/qjs/atomic_string.h index 1b323602e5..4e213b292e 100644 --- a/bridge/bindings/qjs/atomic_string.h +++ b/bridge/bindings/qjs/atomic_string.h @@ -41,7 +41,9 @@ class AtomicString { // Return the undefined string value from atom key. JSValue ToQuickJS(JSContext* ctx) const { - if (ctx_ == nullptr) { return JS_NULL; } + if (ctx_ == nullptr) { + return JS_NULL; + } assert(ctx_ != nullptr); return JS_AtomToValue(ctx, atom_); diff --git a/bridge/bindings/qjs/binding_initializer.cc b/bridge/bindings/qjs/binding_initializer.cc index 7c4eb430df..5d16aaeaae 100644 --- a/bridge/bindings/qjs/binding_initializer.cc +++ b/bridge/bindings/qjs/binding_initializer.cc @@ -24,6 +24,7 @@ #include "qjs_html_html_element.h" #include "qjs_html_template_element.h" #include "qjs_html_unknown_element.h" +#include "qjs_location.h" #include "qjs_message_event.h" #include "qjs_module_manager.h" #include "qjs_node.h" @@ -31,7 +32,6 @@ #include "qjs_text.h" #include "qjs_window.h" #include "qjs_window_or_worker_global_scope.h" -#include "qjs_location.h" namespace kraken { diff --git a/bridge/core/dom/document.cc b/bridge/core/dom/document.cc index 1fb057da7b..caafad4177 100644 --- a/bridge/core/dom/document.cc +++ b/bridge/core/dom/document.cc @@ -196,7 +196,8 @@ HTMLHeadElement* Document::head() const { return Traversal::FirstChild(*de); } -uint32_t Document::RequestAnimationFrame(const std::shared_ptr& callback, ExceptionState& exception_state) { +uint32_t Document::RequestAnimationFrame(const std::shared_ptr& callback, + ExceptionState& exception_state) { return script_animation_controller_.RegisterFrameCallback(callback, exception_state); } diff --git a/bridge/core/dom/scripted_animation_controller.cc b/bridge/core/dom/scripted_animation_controller.cc index c02f15434b..16dcbafcca 100644 --- a/bridge/core/dom/scripted_animation_controller.cc +++ b/bridge/core/dom/scripted_animation_controller.cc @@ -24,11 +24,14 @@ static void handleRAFTransientCallback(void* ptr, int32_t contextId, double high frame_callback->Fire(highResTimeStamp); } -uint32_t ScriptAnimationController::RegisterFrameCallback(const std::shared_ptr& frame_callback, ExceptionState& exception_state) { +uint32_t ScriptAnimationController::RegisterFrameCallback(const std::shared_ptr& frame_callback, + ExceptionState& exception_state) { auto* context = frame_callback->context(); if (context->dartMethodPtr()->requestAnimationFrame == nullptr) { - exception_state.ThrowException(context->ctx(), ErrorType::InternalError, "Failed to execute 'requestAnimationFrame': dart method (requestAnimationFrame) is not registered."); + exception_state.ThrowException( + context->ctx(), ErrorType::InternalError, + "Failed to execute 'requestAnimationFrame': dart method (requestAnimationFrame) is not registered."); return -1; } @@ -45,7 +48,9 @@ void ScriptAnimationController::CancelFrameCallback(ExecutingContext* context, uint32_t callbackId, ExceptionState& exception_state) { if (context->dartMethodPtr()->cancelAnimationFrame == nullptr) { - exception_state.ThrowException(context->ctx(), ErrorType::InternalError, "Failed to execute 'cancelAnimationFrame': dart method (cancelAnimationFrame) is not registered."); + exception_state.ThrowException( + context->ctx(), ErrorType::InternalError, + "Failed to execute 'cancelAnimationFrame': dart method (cancelAnimationFrame) is not registered."); return; } diff --git a/bridge/core/frame/legacy/location.cc b/bridge/core/frame/legacy/location.cc index 419aa215ac..7f5aa9175f 100644 --- a/bridge/core/frame/legacy/location.cc +++ b/bridge/core/frame/legacy/location.cc @@ -10,7 +10,8 @@ namespace kraken { void Location::__kraken_location_reload__(ExecutingContext* context, ExceptionState& exception_state) { if (context->dartMethodPtr()->reloadApp == nullptr) { - exception_state.ThrowException(context->ctx(), ErrorType::InternalError, "Failed to execute 'reload': dart method (reloadApp) is not registered."); + exception_state.ThrowException(context->ctx(), ErrorType::InternalError, + "Failed to execute 'reload': dart method (reloadApp) is not registered."); return; } diff --git a/bridge/core/frame/legacy/location.h b/bridge/core/frame/legacy/location.h index 7d8dee3f7c..86c2be89d5 100644 --- a/bridge/core/frame/legacy/location.h +++ b/bridge/core/frame/legacy/location.h @@ -6,12 +6,12 @@ #ifndef KRAKENBRIDGE_LOCATION_H #define KRAKENBRIDGE_LOCATION_H -#include "bindings/qjs/script_wrappable.h" #include "bindings/qjs/exception_state.h" +#include "bindings/qjs/script_wrappable.h" namespace kraken { -class Location { +class Location { public: static void __kraken_location_reload__(ExecutingContext* context, ExceptionState& exception_state); }; diff --git a/bridge/core/frame/window.cc b/bridge/core/frame/window.cc index c45f99452c..a53682a1cf 100644 --- a/bridge/core/frame/window.cc +++ b/bridge/core/frame/window.cc @@ -98,10 +98,9 @@ void Window::postMessage(const ScriptValue& message, double Window::requestAnimationFrame(const std::shared_ptr& callback, ExceptionState& exceptionState) { if (GetExecutingContext()->dartMethodPtr()->flushUICommand == nullptr) { - exceptionState.ThrowException( - ctx(), ErrorType::InternalError, - "Failed to execute 'flushUICommand': dart method (flushUICommand) executed " - "with unexpected error."); + exceptionState.ThrowException(ctx(), ErrorType::InternalError, + "Failed to execute 'flushUICommand': dart method (flushUICommand) executed " + "with unexpected error."); return 0; } diff --git a/bridge/core/frame/window_test.cc b/bridge/core/frame/window_test.cc index 78c98d4562..cc3a4c85bc 100644 --- a/bridge/core/frame/window_test.cc +++ b/bridge/core/frame/window_test.cc @@ -67,7 +67,7 @@ requestAnimationFrame(() => { EXPECT_EQ(logCalled, true); } - TEST(Window, cancelAnimationFrame) { +TEST(Window, cancelAnimationFrame) { auto bridge = TEST_init(); kraken::KrakenPage::consoleMessageHandler = [](void* ctx, const std::string& message, int logLevel) { abort(); }; @@ -83,7 +83,7 @@ requestAnimationFrame(() => { TEST_runLoop(bridge->GetExecutingContext()); } - TEST(Window, postMessage) { +TEST(Window, postMessage) { { auto bridge = TEST_init(); static bool logCalled = false; @@ -107,7 +107,7 @@ requestAnimationFrame(() => { { TEST_init(); } } - TEST(Window, location) { +TEST(Window, location) { auto bridge = TEST_init(); static bool logCalled = false; kraken::KrakenPage::consoleMessageHandler = [](void* ctx, const std::string& message, int logLevel) {