Browse Source

The great formattening - format all library source code and documents

- Format C++ source code (clang-format).
- Remove function definition comments (duplicated from headers).
- Remove macros for unused parameters.
- Make consistent indentation for RML and RCSS files.
- Remove trailing whitespace.
- Update copyright year.
Michael Ragazzon 2 years ago
parent
commit
7492876298
100 changed files with 2253 additions and 2596 deletions
  1. 7 0
      .editorconfig
  2. 1 1
      Backends/RmlUi_Backend.h
  3. 5 6
      Backends/RmlUi_Backend_GLFW_GL2.cpp
  4. 5 6
      Backends/RmlUi_Backend_GLFW_GL3.cpp
  5. 2 2
      Backends/RmlUi_Backend_GLFW_VK.cpp
  6. 5 4
      Backends/RmlUi_Backend_SDL_GL2.cpp
  7. 5 4
      Backends/RmlUi_Backend_SDL_GL3.cpp
  8. 6 5
      Backends/RmlUi_Backend_SDL_SDLrenderer.cpp
  9. 7 6
      Backends/RmlUi_Backend_SDL_VK.cpp
  10. 4 10
      Backends/RmlUi_Backend_SFML_GL2.cpp
  11. 5 5
      Backends/RmlUi_Backend_Win32_GL2.cpp
  12. 6 6
      Backends/RmlUi_Backend_Win32_VK.cpp
  13. 11 9
      Backends/RmlUi_Backend_X11_GL2.cpp
  14. 1 1
      Backends/RmlUi_Include_Windows.h
  15. 1 1
      Backends/RmlUi_Include_Xlib.h
  16. 4 10
      Backends/RmlUi_Platform_GLFW.cpp
  17. 1 1
      Backends/RmlUi_Platform_GLFW.h
  18. 11 26
      Backends/RmlUi_Platform_SDL.cpp
  19. 1 1
      Backends/RmlUi_Platform_SDL.h
  20. 9 24
      Backends/RmlUi_Platform_SFML.cpp
  21. 2 2
      Backends/RmlUi_Platform_SFML.h
  22. 8 21
      Backends/RmlUi_Platform_Win32.cpp
  23. 1 1
      Backends/RmlUi_Platform_Win32.h
  24. 13 24
      Backends/RmlUi_Platform_X11.cpp
  25. 1 1
      Backends/RmlUi_Platform_X11.h
  26. 1 1
      Backends/RmlUi_Renderer_GL2.cpp
  27. 1 1
      Backends/RmlUi_Renderer_GL2.h
  28. 1 1
      Backends/RmlUi_Renderer_GL3.cpp
  29. 1 1
      Backends/RmlUi_Renderer_GL3.h
  30. 1 1
      Backends/RmlUi_Renderer_SDL.cpp
  31. 1 1
      Backends/RmlUi_Renderer_SDL.h
  32. 15 11
      Backends/RmlUi_Renderer_VK.cpp
  33. 3 3
      Backends/RmlUi_Renderer_VK.h
  34. 2 0
      Backends/RmlUi_Vulkan/.clang-format
  35. 1 1
      Backends/RmlUi_Vulkan/compile_shaders.py
  36. 2 2
      CMake/BackendFileList.cmake
  37. 0 0
      CMake/Modules/FindLuaJIT.cmake
  38. 63 64
      CMakeLists.txt
  39. 130 123
      Include/RmlUi/Config/Config.h
  40. 7 7
      Include/RmlUi/Core.h
  41. 29 10
      Include/RmlUi/Core/Animation.h
  42. 91 92
      Include/RmlUi/Core/BaseXMLParser.h
  43. 12 24
      Include/RmlUi/Core/Box.h
  44. 9 12
      Include/RmlUi/Core/Colour.h
  45. 29 32
      Include/RmlUi/Core/Colour.inl
  46. 1 1
      Include/RmlUi/Core/ComputedValues.h
  47. 28 20
      Include/RmlUi/Core/Context.h
  48. 5 6
      Include/RmlUi/Core/ContextInstancer.h
  49. 10 10
      Include/RmlUi/Core/ConvolutionFilter.h
  50. 9 9
      Include/RmlUi/Core/Core.h
  51. 33 31
      Include/RmlUi/Core/DataModelHandle.h
  52. 54 51
      Include/RmlUi/Core/DataStructHandle.h
  53. 16 20
      Include/RmlUi/Core/DataTypeRegister.h
  54. 25 28
      Include/RmlUi/Core/DataTypes.h
  55. 48 70
      Include/RmlUi/Core/DataVariable.h
  56. 64 54
      Include/RmlUi/Core/Debug.h
  57. 6 7
      Include/RmlUi/Core/Decorator.h
  58. 14 12
      Include/RmlUi/Core/DecoratorInstancer.h
  59. 3 3
      Include/RmlUi/Core/Dictionary.h
  60. 31 29
      Include/RmlUi/Core/Element.h
  61. 8 8
      Include/RmlUi/Core/Element.inl
  62. 17 20
      Include/RmlUi/Core/ElementDocument.h
  63. 28 37
      Include/RmlUi/Core/ElementInstancer.h
  64. 7 13
      Include/RmlUi/Core/ElementScroll.h
  65. 14 13
      Include/RmlUi/Core/ElementText.h
  66. 9 9
      Include/RmlUi/Core/ElementUtilities.h
  67. 5 6
      Include/RmlUi/Core/Elements/ElementForm.h
  68. 5 6
      Include/RmlUi/Core/Elements/ElementFormControl.h
  69. 5 6
      Include/RmlUi/Core/Elements/ElementFormControlInput.h
  70. 10 9
      Include/RmlUi/Core/Elements/ElementFormControlSelect.h
  71. 5 6
      Include/RmlUi/Core/Elements/ElementFormControlTextArea.h
  72. 17 18
      Include/RmlUi/Core/Elements/ElementProgress.h
  73. 5 6
      Include/RmlUi/Core/Elements/ElementTabSet.h
  74. 10 12
      Include/RmlUi/Core/Event.h
  75. 6 7
      Include/RmlUi/Core/EventInstancer.h
  76. 8 15
      Include/RmlUi/Core/EventListener.h
  77. 8 9
      Include/RmlUi/Core/EventListenerInstancer.h
  78. 8 9
      Include/RmlUi/Core/Factory.h
  79. 11 11
      Include/RmlUi/Core/FileInterface.h
  80. 8 7
      Include/RmlUi/Core/FontEffect.h
  81. 11 11
      Include/RmlUi/Core/FontEffectInstancer.h
  82. 12 12
      Include/RmlUi/Core/FontEngineInterface.h
  83. 5 5
      Include/RmlUi/Core/FontGlyph.h
  84. 5 5
      Include/RmlUi/Core/FontMetrics.h
  85. 10 11
      Include/RmlUi/Core/Geometry.h
  86. 10 9
      Include/RmlUi/Core/GeometryUtilities.h
  87. 3 3
      Include/RmlUi/Core/Header.h
  88. 7 13
      Include/RmlUi/Core/ID.h
  89. 66 69
      Include/RmlUi/Core/Input.h
  90. 8 10
      Include/RmlUi/Core/Log.h
  91. 198 197
      Include/RmlUi/Core/Math.h
  92. 432 443
      Include/RmlUi/Core/Matrix4.h
  93. 268 435
      Include/RmlUi/Core/Matrix4.inl
  94. 47 50
      Include/RmlUi/Core/ObserverPtr.h
  95. 7 70
      Include/RmlUi/Core/Platform.h
  96. 13 16
      Include/RmlUi/Core/Plugin.h
  97. 34 36
      Include/RmlUi/Core/Profiling.h
  98. 12 12
      Include/RmlUi/Core/PropertiesIteratorView.h
  99. 37 39
      Include/RmlUi/Core/Property.h
  100. 6 8
      Include/RmlUi/Core/PropertyDefinition.h

+ 7 - 0
.editorconfig

@@ -3,3 +3,10 @@ root = true
 [CMakeLists.txt]
 indent_style = tab
 indent_size = 4
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.{rcss,rml}]
+indent_style = tab
+trim_trailing_whitespace = true
+insert_final_newline = true

+ 1 - 1
Backends/RmlUi_Backend.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 5 - 6
Backends/RmlUi_Backend_GLFW_GL2.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -148,9 +148,10 @@ bool Backend::ProcessEvents(Rml::Context* context, KeyDownCallback key_down_call
 	data->context = context;
 	data->key_down_callback = key_down_callback;
 
-	if(power_save)
+	if (power_save)
 		glfwWaitEventsTimeout(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0));
-	else glfwPollEvents();
+	else
+		glfwPollEvents();
 
 	data->context = nullptr;
 	data->key_down_callback = nullptr;
@@ -220,9 +221,7 @@ static void SetupCallbacks(GLFWwindow* window)
 				break;
 		}
 		break;
-		case GLFW_RELEASE:
-			RmlGLFW::ProcessKeyCallback(context, glfw_key, glfw_action, glfw_mods);
-			break;
+		case GLFW_RELEASE: RmlGLFW::ProcessKeyCallback(context, glfw_key, glfw_action, glfw_mods); break;
 		}
 	});
 

+ 5 - 6
Backends/RmlUi_Backend_GLFW_GL3.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -160,9 +160,10 @@ bool Backend::ProcessEvents(Rml::Context* context, KeyDownCallback key_down_call
 	data->context = context;
 	data->key_down_callback = key_down_callback;
 
-	if(power_save)
+	if (power_save)
 		glfwWaitEventsTimeout(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0));
-	else glfwPollEvents();
+	else
+		glfwPollEvents();
 
 	data->context = nullptr;
 	data->key_down_callback = nullptr;
@@ -232,9 +233,7 @@ static void SetupCallbacks(GLFWwindow* window)
 				break;
 		}
 		break;
-		case GLFW_RELEASE:
-			RmlGLFW::ProcessKeyCallback(context, glfw_key, glfw_action, glfw_mods);
-			break;
+		case GLFW_RELEASE: RmlGLFW::ProcessKeyCallback(context, glfw_key, glfw_action, glfw_mods); break;
 		}
 	});
 

+ 2 - 2
Backends/RmlUi_Backend_GLFW_VK.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -291,4 +291,4 @@ static void SetupCallbacks(GLFWwindow* window)
 
 	glfwSetWindowContentScaleCallback(window,
 		[](GLFWwindow* /*window*/, float xscale, float /*yscale*/) { RmlGLFW::ProcessContentScaleCallback(data->context, xscale); });
-}
+}

+ 5 - 4
Backends/RmlUi_Backend_SDL_GL2.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -265,9 +265,10 @@ bool Backend::ProcessEvents(Rml::Context* context, KeyDownCallback key_down_call
 
 	SDL_Event ev;
 	int has_event = 0;
-	if(power_save)
-		has_event = SDL_WaitEventTimeout(&ev, static_cast<int>(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0)*1000));
-	else has_event = SDL_PollEvent(&ev);
+	if (power_save)
+		has_event = SDL_WaitEventTimeout(&ev, static_cast<int>(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0) * 1000));
+	else
+		has_event = SDL_PollEvent(&ev);
 	while (has_event)
 	{
 		switch (ev.type)

+ 5 - 4
Backends/RmlUi_Backend_SDL_GL3.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -244,9 +244,10 @@ bool Backend::ProcessEvents(Rml::Context* context, KeyDownCallback key_down_call
 
 	SDL_Event ev;
 	int has_event = 0;
-	if(power_save)
-		has_event = SDL_WaitEventTimeout(&ev, static_cast<int>(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0)*1000));
-	else has_event = SDL_PollEvent(&ev);
+	if (power_save)
+		has_event = SDL_WaitEventTimeout(&ev, static_cast<int>(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0) * 1000));
+	else
+		has_event = SDL_PollEvent(&ev);
 	while (has_event)
 	{
 		switch (ev.type)

+ 6 - 5
Backends/RmlUi_Backend_SDL_SDLrenderer.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -129,11 +129,12 @@ bool Backend::ProcessEvents(Rml::Context* context, KeyDownCallback key_down_call
 
 	bool result = data->running;
 	SDL_Event ev;
-	
+
 	int has_event = 0;
-	if(power_save)
-		has_event = SDL_WaitEventTimeout(&ev, static_cast<int>(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0)*1000));
-	else has_event = SDL_PollEvent(&ev);
+	if (power_save)
+		has_event = SDL_WaitEventTimeout(&ev, static_cast<int>(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0) * 1000));
+	else
+		has_event = SDL_PollEvent(&ev);
 	while (has_event)
 	{
 		switch (ev.type)

+ 7 - 6
Backends/RmlUi_Backend_SDL_VK.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -79,14 +79,14 @@ bool Backend::Initialize(const char* window_name, int width, int height, bool al
 	Rml::Vector<const char*> extensions;
 	{
 		unsigned int count;
-		if(!SDL_Vulkan_GetInstanceExtensions(window, &count, nullptr))
+		if (!SDL_Vulkan_GetInstanceExtensions(window, &count, nullptr))
 		{
 			data.reset();
 			fprintf(stderr, "Could not get required vulkan extensions");
 			return false;
 		}
 		extensions.resize(count);
-		if(!SDL_Vulkan_GetInstanceExtensions(window, &count, extensions.data()))
+		if (!SDL_Vulkan_GetInstanceExtensions(window, &count, extensions.data()))
 		{
 			data.reset();
 			fprintf(stderr, "Could not get required vulkan extensions");
@@ -167,9 +167,10 @@ bool Backend::ProcessEvents(Rml::Context* context, KeyDownCallback key_down_call
 	SDL_Event ev;
 
 	int has_event = 0;
-	if(power_save)
-		has_event = SDL_WaitEventTimeout(&ev, static_cast<int>(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0)*1000));
-	else has_event = SDL_PollEvent(&ev);
+	if (power_save)
+		has_event = SDL_WaitEventTimeout(&ev, static_cast<int>(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0) * 1000));
+	else
+		has_event = SDL_PollEvent(&ev);
 	while (has_event)
 	{
 		switch (ev.type)

+ 4 - 10
Backends/RmlUi_Backend_SFML_GL2.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -205,9 +205,7 @@ bool Backend::ProcessEvents(Rml::Context* context, KeyDownCallback key_down_call
 	{
 		switch (ev.type)
 		{
-		case sf::Event::Resized:
-			UpdateWindowDimensions(data->window, data->render_interface, context);
-			break;
+		case sf::Event::Resized: UpdateWindowDimensions(data->window, data->render_interface, context); break;
 		case sf::Event::KeyPressed:
 		{
 			const Rml::Input::KeyIdentifier key = RmlSFML::ConvertKey(ev.key.code);
@@ -225,12 +223,8 @@ bool Backend::ProcessEvents(Rml::Context* context, KeyDownCallback key_down_call
 				break;
 		}
 		break;
-		case sf::Event::Closed:
-			result = false;
-			break;
-		default:
-			RmlSFML::InputHandler(context, ev);
-			break;
+		case sf::Event::Closed: result = false; break;
+		default: RmlSFML::InputHandler(context, ev); break;
 		}
 	}
 

+ 5 - 5
Backends/RmlUi_Backend_Win32_GL2.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -191,12 +191,12 @@ Rml::RenderInterface* Backend::GetRenderInterface()
 
 static bool NextEvent(MSG& message, UINT timeout)
 {
-	if(timeout != 0)
+	if (timeout != 0)
 	{
 		UINT_PTR timer_id = SetTimer(NULL, NULL, timeout, NULL);
 		BOOL res = GetMessage(&message, NULL, 0, 0);
 		KillTimer(NULL, timer_id);
-		if(message.message != WM_TIMER || message.hwnd != nullptr || message.wParam != timer_id)
+		if (message.message != WM_TIMER || message.hwnd != nullptr || message.wParam != timer_id)
 			return res;
 	}
 	return PeekMessage(&message, nullptr, 0, 0, PM_REMOVE);
@@ -219,7 +219,7 @@ bool Backend::ProcessEvents(Rml::Context* context, KeyDownCallback key_down_call
 	data->key_down_callback = key_down_callback;
 
 	MSG message;
-	bool has_message = NextEvent(message, power_save ? static_cast<int>(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0)*1000.0) : 0);
+	bool has_message = NextEvent(message, power_save ? static_cast<int>(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0) * 1000.0) : 0);
 	while (has_message)
 	{
 		// Dispatch the message to our local event handler below.
@@ -461,4 +461,4 @@ static void DetachFromNative(HWND window_handle, HDC device_context, HGLRC rende
 	{
 		ReleaseDC(window_handle, device_context);
 	}
-}
+}

+ 6 - 6
Backends/RmlUi_Backend_Win32_VK.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -193,12 +193,12 @@ Rml::RenderInterface* Backend::GetRenderInterface()
 
 static bool NextEvent(MSG& message, UINT timeout)
 {
-	if(timeout != 0)
+	if (timeout != 0)
 	{
 		UINT_PTR timer_id = SetTimer(NULL, NULL, timeout, NULL);
 		BOOL res = GetMessage(&message, NULL, 0, 0);
 		KillTimer(NULL, timer_id);
-		if(message.message != WM_TIMER || message.hwnd != nullptr || message.wParam != timer_id)
+		if (message.message != WM_TIMER || message.hwnd != nullptr || message.wParam != timer_id)
 			return res;
 	}
 	return PeekMessage(&message, nullptr, 0, 0, PM_REMOVE);
@@ -222,10 +222,10 @@ bool Backend::ProcessEvents(Rml::Context* context, KeyDownCallback key_down_call
 
 	MSG message;
 	// Process events.
-	bool has_message = NextEvent(message, power_save ? static_cast<int>(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0)*1000.0) : 0);
+	bool has_message = NextEvent(message, power_save ? static_cast<int>(Rml::Math::Min(context->GetNextUpdateDelay(), 10.0) * 1000.0) : 0);
 	while (has_message || !data->render_interface.IsSwapchainValid())
 	{
-		if(has_message)
+		if (has_message)
 		{
 			// Dispatch the message to our local event handler below.
 			TranslateMessage(&message);
@@ -237,7 +237,7 @@ bool Backend::ProcessEvents(Rml::Context* context, KeyDownCallback key_down_call
 		// we trap the application inside this loop until we are able to recreate the swapchain and render again.
 		if (!data->render_interface.IsSwapchainValid())
 			data->render_interface.RecreateSwapchain();
-		
+
 		has_message = NextEvent(message, 0);
 	}
 

+ 11 - 9
Backends/RmlUi_Backend_X11_GL2.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -39,6 +39,7 @@
 #include <X11/Xlib.h>
 #include <X11/cursorfont.h>
 #include <X11/extensions/xf86vmode.h>
+#include <cmath>
 #include <limits.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -48,7 +49,6 @@
 #include <sys/types.h>
 #include <time.h>
 #include <unistd.h>
-#include <cmath>
 
 // Attach the OpenGL context to the window.
 static bool AttachToNative(GLXContext& out_gl_context, Display* display, Window window, XVisualInfo* visual_info)
@@ -215,24 +215,26 @@ bool Backend::ProcessEvents(Rml::Context* context, KeyDownCallback key_down_call
 	bool result = data->running;
 	data->running = true;
 
-	if(power_save && XPending(display) == 0) {
+	if (power_save && XPending(display) == 0)
+	{
 		int display_fd = ConnectionNumber(display);
 		fd_set fds{};
 		FD_ZERO(&fds);
-        FD_SET(display_fd, &fds);
+		FD_SET(display_fd, &fds);
 
 		double timeout = Rml::Math::Min(context->GetNextUpdateDelay(), 10.0);
-		struct timeval tv{};
+		struct timeval tv {};
 		double seconds;
-        tv.tv_usec = std::modf(timeout, &seconds)*1000000.0;
-        tv.tv_sec = seconds;
+		tv.tv_usec = std::modf(timeout, &seconds) * 1000000.0;
+		tv.tv_sec = seconds;
 
 		int ready_fd_count;
-		do {
+		do
+		{
 			ready_fd_count = select(display_fd + 1, &fds, NULL, NULL, &tv);
 			// We don't care about the return value as long as select didn't error out
 			RMLUI_ASSERT(ready_fd_count >= 0);
-		} while(XPending(display) == 0 && ready_fd_count != 0);
+		} while (XPending(display) == 0 && ready_fd_count != 0);
 	}
 
 	while (XPending(display) > 0)

+ 1 - 1
Backends/RmlUi_Include_Windows.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
Backends/RmlUi_Include_Xlib.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 4 - 10
Backends/RmlUi_Platform_GLFW.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -110,9 +110,7 @@ bool RmlGLFW::ProcessKeyCallback(Rml::Context* context, int key, int action, int
 		if (key == GLFW_KEY_ENTER || key == GLFW_KEY_KP_ENTER)
 			result &= context->ProcessTextInput('\n');
 		break;
-	case GLFW_RELEASE:
-		result = context->ProcessKeyUp(RmlGLFW::ConvertKey(key), RmlGLFW::ConvertKeyModifiers(mods));
-		break;
+	case GLFW_RELEASE: result = context->ProcessKeyUp(RmlGLFW::ConvertKey(key), RmlGLFW::ConvertKeyModifiers(mods)); break;
 	}
 
 	return result;
@@ -155,12 +153,8 @@ bool RmlGLFW::ProcessMouseButtonCallback(Rml::Context* context, int button, int
 
 	switch (action)
 	{
-	case GLFW_PRESS:
-		result = context->ProcessMouseButtonDown(button, RmlGLFW::ConvertKeyModifiers(mods));
-		break;
-	case GLFW_RELEASE:
-		result = context->ProcessMouseButtonUp(button, RmlGLFW::ConvertKeyModifiers(mods));
-		break;
+	case GLFW_PRESS: result = context->ProcessMouseButtonDown(button, RmlGLFW::ConvertKeyModifiers(mods)); break;
+	case GLFW_RELEASE: result = context->ProcessMouseButtonUp(button, RmlGLFW::ConvertKeyModifiers(mods)); break;
 	}
 	return result;
 }

+ 1 - 1
Backends/RmlUi_Platform_GLFW.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 11 - 26
Backends/RmlUi_Platform_SDL.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -110,9 +110,7 @@ bool RmlSDL::InputEventHandler(Rml::Context* context, SDL_Event& ev)
 
 	switch (ev.type)
 	{
-	case SDL_MOUSEMOTION:
-		result = context->ProcessMouseMove(ev.motion.x, ev.motion.y, GetKeyModifierState());
-		break;
+	case SDL_MOUSEMOTION: result = context->ProcessMouseMove(ev.motion.x, ev.motion.y, GetKeyModifierState()); break;
 	case SDL_MOUSEBUTTONDOWN:
 		result = context->ProcessMouseButtonDown(ConvertMouseButton(ev.button.button), GetKeyModifierState());
 		SDL_CaptureMouse(SDL_TRUE);
@@ -121,20 +119,14 @@ bool RmlSDL::InputEventHandler(Rml::Context* context, SDL_Event& ev)
 		SDL_CaptureMouse(SDL_FALSE);
 		result = context->ProcessMouseButtonUp(ConvertMouseButton(ev.button.button), GetKeyModifierState());
 		break;
-	case SDL_MOUSEWHEEL:
-		result = context->ProcessMouseWheel(float(-ev.wheel.y), GetKeyModifierState());
-		break;
+	case SDL_MOUSEWHEEL: result = context->ProcessMouseWheel(float(-ev.wheel.y), GetKeyModifierState()); break;
 	case SDL_KEYDOWN:
 		result = context->ProcessKeyDown(ConvertKey(ev.key.keysym.sym), GetKeyModifierState());
 		if (ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_KP_ENTER)
 			result &= context->ProcessTextInput('\n');
 		break;
-	case SDL_KEYUP:
-		result = context->ProcessKeyUp(ConvertKey(ev.key.keysym.sym), GetKeyModifierState());
-		break;
-	case SDL_TEXTINPUT:
-		result = context->ProcessTextInput(Rml::String(&ev.text.text[0]));
-		break;
+	case SDL_KEYUP: result = context->ProcessKeyUp(ConvertKey(ev.key.keysym.sym), GetKeyModifierState()); break;
+	case SDL_TEXTINPUT: result = context->ProcessTextInput(Rml::String(&ev.text.text[0])); break;
 	case SDL_WINDOWEVENT:
 	{
 		switch (ev.window.event)
@@ -145,14 +137,11 @@ bool RmlSDL::InputEventHandler(Rml::Context* context, SDL_Event& ev)
 			context->SetDimensions(dimensions);
 		}
 		break;
-		case SDL_WINDOWEVENT_LEAVE:
-			context->ProcessMouseLeave();
-			break;
+		case SDL_WINDOWEVENT_LEAVE: context->ProcessMouseLeave(); break;
 		}
 	}
 	break;
-	default:
-		break;
+	default: break;
 	}
 
 	return result;
@@ -287,14 +276,10 @@ int RmlSDL::ConvertMouseButton(int button)
 {
 	switch (button)
 	{
-	case SDL_BUTTON_LEFT:
-		return 0;
-	case SDL_BUTTON_RIGHT:
-		return 1;
-	case SDL_BUTTON_MIDDLE:
-		return 2;
-	default:
-		return 3;
+	case SDL_BUTTON_LEFT: return 0;
+	case SDL_BUTTON_RIGHT: return 1;
+	case SDL_BUTTON_MIDDLE: return 2;
+	default: return 3;
 	}
 }
 

+ 1 - 1
Backends/RmlUi_Platform_SDL.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 9 - 24
Backends/RmlUi_Platform_SFML.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -100,21 +100,11 @@ bool RmlSFML::InputHandler(Rml::Context* context, sf::Event& ev)
 
 	switch (ev.type)
 	{
-	case sf::Event::MouseMoved:
-		result = context->ProcessMouseMove(ev.mouseMove.x, ev.mouseMove.y, RmlSFML::GetKeyModifierState());
-		break;
-	case sf::Event::MouseButtonPressed:
-		result = context->ProcessMouseButtonDown(ev.mouseButton.button, RmlSFML::GetKeyModifierState());
-		break;
-	case sf::Event::MouseButtonReleased:
-		result = context->ProcessMouseButtonUp(ev.mouseButton.button, RmlSFML::GetKeyModifierState());
-		break;
-	case sf::Event::MouseWheelMoved:
-		result = context->ProcessMouseWheel(float(-ev.mouseWheel.delta), RmlSFML::GetKeyModifierState());
-		break;
-	case sf::Event::MouseLeft:
-		result = context->ProcessMouseLeave();
-		break;
+	case sf::Event::MouseMoved: result = context->ProcessMouseMove(ev.mouseMove.x, ev.mouseMove.y, RmlSFML::GetKeyModifierState()); break;
+	case sf::Event::MouseButtonPressed: result = context->ProcessMouseButtonDown(ev.mouseButton.button, RmlSFML::GetKeyModifierState()); break;
+	case sf::Event::MouseButtonReleased: result = context->ProcessMouseButtonUp(ev.mouseButton.button, RmlSFML::GetKeyModifierState()); break;
+	case sf::Event::MouseWheelMoved: result = context->ProcessMouseWheel(float(-ev.mouseWheel.delta), RmlSFML::GetKeyModifierState()); break;
+	case sf::Event::MouseLeft: result = context->ProcessMouseLeave(); break;
 	case sf::Event::TextEntered:
 	{
 		Rml::Character character = Rml::Character(ev.text.unicode);
@@ -125,14 +115,9 @@ bool RmlSFML::InputHandler(Rml::Context* context, sf::Event& ev)
 			result = context->ProcessTextInput(character);
 	}
 	break;
-	case sf::Event::KeyPressed:
-		result = context->ProcessKeyDown(RmlSFML::ConvertKey(ev.key.code), RmlSFML::GetKeyModifierState());
-		break;
-	case sf::Event::KeyReleased:
-		result = context->ProcessKeyUp(RmlSFML::ConvertKey(ev.key.code), RmlSFML::GetKeyModifierState());
-		break;
-	default:
-		break;
+	case sf::Event::KeyPressed: result = context->ProcessKeyDown(RmlSFML::ConvertKey(ev.key.code), RmlSFML::GetKeyModifierState()); break;
+	case sf::Event::KeyReleased: result = context->ProcessKeyUp(RmlSFML::ConvertKey(ev.key.code), RmlSFML::GetKeyModifierState()); break;
+	default: break;
 	}
 
 	return result;

+ 2 - 2
Backends/RmlUi_Platform_SFML.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -42,7 +42,7 @@ public:
 
 	// Optionally, provide or change the window to be used for setting the mouse cursors.
 	// @lifetime Any window provided here must be destroyed before the system interface.
-	// @lifetime The currently active window must stay alive until after the call to Rml::Shutdown. 
+	// @lifetime The currently active window must stay alive until after the call to Rml::Shutdown.
 	void SetWindow(sf::RenderWindow* window);
 
 	// -- Inherited from Rml::SystemInterface  --

+ 8 - 21
Backends/RmlUi_Platform_Win32.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -204,18 +204,10 @@ bool RmlWin32::WindowProcedure(Rml::Context* context, HWND window_handle, UINT m
 		ReleaseCapture();
 		result = context->ProcessMouseButtonUp(0, RmlWin32::GetKeyModifierState());
 		break;
-	case WM_RBUTTONDOWN:
-		result = context->ProcessMouseButtonDown(1, RmlWin32::GetKeyModifierState());
-		break;
-	case WM_RBUTTONUP:
-		result = context->ProcessMouseButtonUp(1, RmlWin32::GetKeyModifierState());
-		break;
-	case WM_MBUTTONDOWN:
-		result = context->ProcessMouseButtonDown(2, RmlWin32::GetKeyModifierState());
-		break;
-	case WM_MBUTTONUP:
-		result = context->ProcessMouseButtonUp(2, RmlWin32::GetKeyModifierState());
-		break;
+	case WM_RBUTTONDOWN: result = context->ProcessMouseButtonDown(1, RmlWin32::GetKeyModifierState()); break;
+	case WM_RBUTTONUP: result = context->ProcessMouseButtonUp(1, RmlWin32::GetKeyModifierState()); break;
+	case WM_MBUTTONDOWN: result = context->ProcessMouseButtonDown(2, RmlWin32::GetKeyModifierState()); break;
+	case WM_MBUTTONUP: result = context->ProcessMouseButtonUp(2, RmlWin32::GetKeyModifierState()); break;
 	case WM_MOUSEMOVE:
 		result = context->ProcessMouseMove(static_cast<int>((short)LOWORD(l_param)), static_cast<int>((short)HIWORD(l_param)),
 			RmlWin32::GetKeyModifierState());
@@ -237,12 +229,8 @@ bool RmlWin32::WindowProcedure(Rml::Context* context, HWND window_handle, UINT m
 		result = context->ProcessMouseLeave();
 		tracking_mouse_leave = false;
 		break;
-	case WM_KEYDOWN:
-		result = context->ProcessKeyDown(RmlWin32::ConvertKey((int)w_param), RmlWin32::GetKeyModifierState());
-		break;
-	case WM_KEYUP:
-		result = context->ProcessKeyUp(RmlWin32::ConvertKey((int)w_param), RmlWin32::GetKeyModifierState());
-		break;
+	case WM_KEYDOWN: result = context->ProcessKeyDown(RmlWin32::ConvertKey((int)w_param), RmlWin32::GetKeyModifierState()); break;
+	case WM_KEYUP: result = context->ProcessKeyUp(RmlWin32::ConvertKey((int)w_param), RmlWin32::GetKeyModifierState()); break;
 	case WM_CHAR:
 	{
 		static wchar_t first_u16_code_unit = 0;
@@ -278,8 +266,7 @@ bool RmlWin32::WindowProcedure(Rml::Context* context, HWND window_handle, UINT m
 		}
 	}
 	break;
-	default:
-		break;
+	default: break;
 	}
 
 	return result;

+ 1 - 1
Backends/RmlUi_Platform_Win32.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 13 - 24
Backends/RmlUi_Platform_X11.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -247,14 +247,10 @@ bool RmlX11::HandleInputEvent(Rml::Context* context, Display* display, const XEv
 		{
 		case Button1:
 		case Button2:
-		case Button3:
-			return context->ProcessMouseButtonDown(ConvertMouseButton(ev.xbutton.button), RmlX11::GetKeyModifierState(ev.xbutton.state));
-		case Button4:
-			return context->ProcessMouseWheel(-1, RmlX11::GetKeyModifierState(ev.xbutton.state));
-		case Button5:
-			return context->ProcessMouseWheel(1, RmlX11::GetKeyModifierState(ev.xbutton.state));
-		default:
-			return true;
+		case Button3: return context->ProcessMouseButtonDown(ConvertMouseButton(ev.xbutton.button), RmlX11::GetKeyModifierState(ev.xbutton.state));
+		case Button4: return context->ProcessMouseWheel(-1, RmlX11::GetKeyModifierState(ev.xbutton.state));
+		case Button5: return context->ProcessMouseWheel(1, RmlX11::GetKeyModifierState(ev.xbutton.state));
+		default: return true;
 		}
 	}
 	break;
@@ -264,10 +260,8 @@ bool RmlX11::HandleInputEvent(Rml::Context* context, Display* display, const XEv
 		{
 		case Button1:
 		case Button2:
-		case Button3:
-			return context->ProcessMouseButtonUp(ConvertMouseButton(ev.xbutton.button), RmlX11::GetKeyModifierState(ev.xbutton.state));
-		default:
-			return true;
+		case Button3: return context->ProcessMouseButtonUp(ConvertMouseButton(ev.xbutton.button), RmlX11::GetKeyModifierState(ev.xbutton.state));
+		default: return true;
 		}
 	}
 	break;
@@ -311,8 +305,7 @@ bool RmlX11::HandleInputEvent(Rml::Context* context, Display* display, const XEv
 		return propagates;
 	}
 	break;
-	default:
-		break;
+	default: break;
 	}
 
 	return true;
@@ -391,7 +384,7 @@ Rml::Input::KeyIdentifier RmlX11::ConvertKey(Display* display, unsigned int x11_
 {
 	RMLUI_ASSERT(display);
 	const XKeyData& key_data = GetXKeyData(display);
-	
+
 	const int group_index = 0; // this is always 0 for our limited example
 	KeySym sym = {};
 
@@ -573,14 +566,10 @@ int RmlX11::ConvertMouseButton(unsigned int x11_mouse_button)
 {
 	switch (x11_mouse_button)
 	{
-	case Button1:
-		return 0;
-	case Button2:
-		return 2;
-	case Button3:
-		return 1;
-	default:
-		break;
+	case Button1: return 0;
+	case Button2: return 2;
+	case Button3: return 1;
+	default: break;
 	}
 	return 0;
 }

+ 1 - 1
Backends/RmlUi_Platform_X11.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
Backends/RmlUi_Renderer_GL2.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
Backends/RmlUi_Renderer_GL2.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
Backends/RmlUi_Renderer_GL3.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
Backends/RmlUi_Renderer_GL3.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
Backends/RmlUi_Renderer_SDL.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
Backends/RmlUi_Renderer_SDL.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 15 - 11
Backends/RmlUi_Renderer_VK.cpp

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -85,10 +85,10 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL MyDebugReportCallback(VkDebugReportFlagsEX
 #endif
 
 RenderInterface_VK::RenderInterface_VK() :
-	m_is_transform_enabled{false}, m_is_apply_to_regular_geometry_stencil{false}, m_is_use_scissor_specified{false},
-	m_is_use_stencil_pipeline{false}, m_width{}, m_height{}, m_queue_index_present{}, m_queue_index_graphics{}, m_queue_index_compute{},
-	m_semaphore_index{}, m_semaphore_index_previous{}, m_image_index{}, m_p_instance{}, m_p_device{}, m_p_physical_device{}, m_p_surface{},
-	m_p_swapchain{}, m_p_allocator{}, m_p_current_command_buffer{}, m_p_descriptor_set_layout_vertex_transform{}, m_p_descriptor_set_layout_texture{},
+	m_is_transform_enabled{false}, m_is_apply_to_regular_geometry_stencil{false}, m_is_use_scissor_specified{false}, m_is_use_stencil_pipeline{false},
+	m_width{}, m_height{}, m_queue_index_present{}, m_queue_index_graphics{}, m_queue_index_compute{}, m_semaphore_index{},
+	m_semaphore_index_previous{}, m_image_index{}, m_p_instance{}, m_p_device{}, m_p_physical_device{}, m_p_surface{}, m_p_swapchain{},
+	m_p_allocator{}, m_p_current_command_buffer{}, m_p_descriptor_set_layout_vertex_transform{}, m_p_descriptor_set_layout_texture{},
 	m_p_pipeline_layout{}, m_p_pipeline_with_textures{}, m_p_pipeline_without_textures{},
 	m_p_pipeline_stencil_for_region_where_geometry_will_be_drawn{}, m_p_pipeline_stencil_for_regular_geometry_that_applied_to_region_with_textures{},
 	m_p_pipeline_stencil_for_regular_geometry_that_applied_to_region_without_textures{}, m_p_descriptor_set{}, m_p_render_pass{},
@@ -365,7 +365,8 @@ void RenderInterface_VK::SetScissorRegion(int x, int y, int width, int height)
 			info_range.levelCount = 1;
 			info_range.layerCount = 1;
 
-			vkCmdClearDepthStencilImage(m_p_current_command_buffer, m_texture_depthstencil.m_p_vk_image, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, &info_clear_color, 1, &info_range);
+			vkCmdClearDepthStencilImage(m_p_current_command_buffer, m_texture_depthstencil.m_p_vk_image,
+				VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, &info_clear_color, 1, &info_range);
 
 			RenderGeometry(vertices, 4, indices, 6, 0, Rml::Vector2f(0.0f, 0.0f));
 
@@ -1693,9 +1694,12 @@ VkSurfaceFormatKHR RenderInterface_VK::ChooseSwapchainFormat() noexcept
 	RMLUI_VK_ASSERTMSG(status == VK_SUCCESS, "failed to vkGetPhysicalDeviceSurfaceFormatsKHR (filling vector of VkSurfaceFormatKHR)");
 
 	// Prefer UNORM formats
-	for(auto& format : formats) {
-		for(auto ufmt : UNORM_FORMATS) {
-			if(ufmt == format.format) return format;
+	for (auto& format : formats)
+	{
+		for (auto ufmt : UNORM_FORMATS)
+		{
+			if (ufmt == format.format)
+				return format;
 		}
 	}
 
@@ -2799,8 +2803,8 @@ VkCommandBuffer RenderInterface_VK::CommandBufferRing::GetCommandBufferForActive
 }
 
 RenderInterface_VK::MemoryPool::MemoryPool() :
-	m_memory_total_size{}, m_device_min_uniform_alignment{}, m_p_data{}, m_p_buffer{}, m_p_buffer_alloc{}, m_p_device{},
-	m_p_vk_allocator{}, m_p_block{}
+	m_memory_total_size{}, m_device_min_uniform_alignment{}, m_p_data{}, m_p_buffer{}, m_p_buffer_alloc{}, m_p_device{}, m_p_vk_allocator{},
+	m_p_block{}
 {}
 
 RenderInterface_VK::MemoryPool::~MemoryPool() {}

+ 3 - 3
Backends/RmlUi_Renderer_VK.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -66,7 +66,7 @@
 RMLUI_DISABLE_ALL_COMPILER_WARNINGS_PUSH
 
 #if defined(RMLUI_PLATFORM_UNIX)
-#define VK_USE_PLATFORM_XCB_KHR 1
+	#define VK_USE_PLATFORM_XCB_KHR 1
 #endif
 #include "RmlUi_Vulkan/vulkan.h"
 
@@ -80,7 +80,7 @@ RMLUI_DISABLE_ALL_COMPILER_WARNINGS_POP
 	#define RMLUI_VK_ASSERTMSG(statement, msg) RMLUI_ASSERTMSG(statement, msg)
 
 	// Uncomment the following line to enable additional Vulkan debugging.
-	//#define RMLUI_VK_DEBUG
+	// #define RMLUI_VK_DEBUG
 #else
 	#define RMLUI_VK_ASSERTMSG(statement, msg) static_cast<void>(statement)
 #endif

+ 2 - 0
Backends/RmlUi_Vulkan/.clang-format

@@ -0,0 +1,2 @@
+DisableFormat: true
+SortIncludes: Never

+ 1 - 1
Backends/RmlUi_Vulkan/compile_shaders.py

@@ -3,7 +3,7 @@
 # For the latest information, see http://github.com/mikke89/RmlUi
 # 
 # Copyright (c) 2008-2014 CodePoint Ltd, Shift Technology Ltd, and contributors
-# Copyright (c) 2019 The RmlUi Team, and contributors
+# Copyright (c) 2019-2023 The RmlUi Team, and contributors
 # 
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal

+ 2 - 2
CMake/BackendFileList.cmake

@@ -27,7 +27,7 @@ set(Win32_VK_HDR_FILES
 
 set(X11_GL2_SRC_FILES
 	${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_X11.cpp
-	${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp	
+	${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp
 	${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_X11_GL2.cpp
 )
 set(X11_GL2_HDR_FILES
@@ -118,4 +118,4 @@ set(GLFW_VK_SRC_FILES
 set(GLFW_VK_HDR_FILES
 	${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h
 	${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h
-)
+)

+ 0 - 0
CMake/FindLuaJIT.cmake → CMake/Modules/FindLuaJIT.cmake


+ 63 - 64
CMakeLists.txt

@@ -5,7 +5,7 @@
 cmake_minimum_required(VERSION 3.1)
 
 if(APPLE)
-	# This has to be before most other options so CMake properly handles the 
+	# This has to be before most other options so CMake properly handles the
 	# compiler variables, it MUST bebefore the project() definition
 	if(IOS_PLATFORM)
 		set(CMAKE_TOOLCHAIN_FILE CMake/Platform/iOS.cmake)
@@ -14,7 +14,7 @@ if(APPLE)
 	option(BUILD_UNIVERSAL_BINARIES "Build universal binaries for all architectures supported" ON)
 	if (NOT CMAKE_OSX_ARCHITECTURES AND BUILD_UNIVERSAL_BINARIES)
 		if(IOS)
-			# set the architecture for iOS 
+			# set the architecture for iOS
 			if (${IOS_PLATFORM} STREQUAL "OS")
 				set (IOS_ARCH armv6 armv7 armv7s arm64)
 				set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING  "Build architecture for iOS")
@@ -35,12 +35,12 @@ if(COMMAND cmake_policy)
 	cmake_policy(SET CMP0015 NEW)
 endif(COMMAND cmake_policy)
 
-# Enable the use of MACOSX_RPATH by default for CMake v3.0+; this effectively 
-# allows plug 'n' play functionality, so to speak -- the resulting shared 
-# library files can simply be copied over into the end-user's application 
+# Enable the use of MACOSX_RPATH by default for CMake v3.0+; this effectively
+# allows plug 'n' play functionality, so to speak -- the resulting shared
+# library files can simply be copied over into the end-user's application
 # bundle or framework bundle. No mucking around with install_name_tool.
 #
-# 	See also: 
+# 	See also:
 # cmake --help-policy cmp0042
 # http://www.kitware.com/blog/home/post/510
 if(POLICY CMP0042)
@@ -70,7 +70,7 @@ list(APPEND CORE_PRIVATE_DEFS RMLUI_VERSION="${RMLUI_VERSION_SHORT}")
 if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
 	option(BUILD_TESTING "" OFF)
 	include(CTest)
-	
+
 	if(BUILD_TESTING)
 		set(RMLUI_TESTS_ENABLED ON)
 		set(VISUAL_TESTS_RML_DIRECTORIES "" CACHE PATH "Specify additional directories containing *.rml test documents for VisualTests. Separate multiple directories by comma.")
@@ -248,7 +248,7 @@ if( CUSTOM_CONFIGURATION )
 	mark_as_advanced( CLEAR CUSTOM_CONFIGURATION_FILE CUSTOM_INCLUDE_DIRS CUSTOM_LINK_LIBRARIES )
 else()
 	mark_as_advanced( FORCE CUSTOM_CONFIGURATION_FILE CUSTOM_INCLUDE_DIRS CUSTOM_LINK_LIBRARIES )
-	
+
 	if( CUSTOM_CONFIGURATION_FILE OR CUSTOM_INCLUDE_DIRS OR CUSTOM_LINK_LIBRARIES )
 		message("-- CUSTOM_CONFIGURATION disabled, but custom configuration variables are set. They will have no effect.")
 	endif()
@@ -302,7 +302,7 @@ mark_as_advanced(WARNINGS_AS_ERRORS)
 macro(add_common_target_options NAME)
 	# C++ language version
 	if(CMAKE_VERSION VERSION_LESS 3.8.0)
-		set_target_properties(${NAME} PROPERTIES 
+		set_target_properties(${NAME} PROPERTIES
 			CXX_STANDARD 14
 			CXX_STANDARD_REQUIRED YES
 		)
@@ -310,18 +310,18 @@ macro(add_common_target_options NAME)
 		target_compile_features(${NAME} PUBLIC cxx_std_14)
 	endif()
 	set_target_properties(${NAME} PROPERTIES CXX_EXTENSIONS OFF)
-	
+
 	# Compiler warnings
 	if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
 		target_compile_options(${NAME} PRIVATE -Wall -pedantic -Wextra)
-		
+
 		if(WARNINGS_AS_ERRORS)
 			target_compile_options(${NAME} PRIVATE -Werror)
 		endif()
 	elseif(MSVC)
 		target_compile_options(${NAME} PRIVATE /MP /W4 /w44062 /permissive-)
 		target_compile_definitions(${NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
-		
+
 		if(WARNINGS_AS_ERRORS)
 			target_compile_options(${NAME} PRIVATE /WX)
 		endif()
@@ -352,7 +352,7 @@ if(NOT NO_FONT_INTERFACE_DEFAULT)
 		if(MSVC AND FREETYPE_VERSION_STRING STREQUAL "2.11.0")
 			message(WARNING "You are using FreeType version 2.11.0 which introduced an issue that causes a crash on startup on some of the samples. Please avoid this version specifically.")
 		endif()
-		
+
 		list(APPEND CORE_LINK_LIBS ${FREETYPE_LIBRARIES})
 		list(APPEND CORE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
 	endif()
@@ -384,14 +384,14 @@ elseif( ENABLE_LOTTIE_PLUGIN )
 	list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/rlottie/build)
 	find_package(rlottie CONFIG)
 	find_path(rlottie_INCLUDE_DIR rlottie.h HINTS ${rlottie_DIR} $ENV{rlottie_DIR} PATH_SUFFIXES inc rlottie/inc )
-	
+
 	if(rlottie_FOUND AND rlottie_INCLUDE_DIR)
 		message("-- Can Lottie plugin be added to RmlCore - yes - rlottie library found")
-		
+
 		list(APPEND CORE_LINK_LIBS rlottie::rlottie)
 		list(APPEND CORE_INCLUDE_DIRS ${rlottie_INCLUDE_DIR})
 		list(APPEND CORE_PRIVATE_DEFS RMLUI_ENABLE_LOTTIE_PLUGIN)
-		
+
 		list(APPEND Core_HDR_FILES ${Lottie_HDR_FILES})
 		list(APPEND Core_PUB_HDR_FILES ${Lottie_PUB_HDR_FILES})
 		list(APPEND Core_SRC_FILES ${Lottie_SRC_FILES})
@@ -411,15 +411,15 @@ if( ENABLE_SVG_PLUGIN )
 	if(NOT DEFINED LUNASVG_DIR)
 		set(LUNASVG_DIR $ENV{LUNASVG_DIR})
 	endif()
-	
+
 	message("-- Can SVG plugin be enabled - looking for lunasvg library")
 
 	find_package(lunasvg REQUIRED)
-	
+
 	list(APPEND CORE_LINK_LIBS ${LUNASVG_LIBRARIES})
 	list(APPEND CORE_INCLUDE_DIRS ${LUNASVG_INCLUDE_DIR})
 	list(APPEND CORE_PRIVATE_DEFS RMLUI_ENABLE_SVG_PLUGIN)
-	
+
 	list(APPEND Core_HDR_FILES ${SVG_HDR_FILES})
 	list(APPEND Core_PUB_HDR_FILES ${SVG_PUB_HDR_FILES})
 	list(APPEND Core_SRC_FILES ${SVG_SRC_FILES})
@@ -447,10 +447,10 @@ foreach(library ${LIBRARIES})
 	add_library(RmlUi::${library} ALIAS ${NAME})
 
 	set_target_properties(${NAME} PROPERTIES
-	   VERSION ${PROJECT_VERSION}
-	   SOVERSION ${PROJECT_VERSION_MAJOR}
+		VERSION ${PROJECT_VERSION}
+		SOVERSION ${PROJECT_VERSION_MAJOR}
 	)
-	
+
 	add_common_target_options(${NAME})
 
 	install(TARGETS ${NAME}
@@ -556,10 +556,10 @@ if(BUILD_LUA_BINDINGS)
 	)
 
 	set_target_properties(${NAME} PROPERTIES
-	   VERSION ${PROJECT_VERSION}
-	   SOVERSION ${PROJECT_VERSION_MAJOR}
+		VERSION ${PROJECT_VERSION}
+		SOVERSION ${PROJECT_VERSION_MAJOR}
 	)
-	
+
 	add_common_target_options(${NAME})
 
 	install(TARGETS ${NAME}
@@ -568,7 +568,7 @@ if(BUILD_LUA_BINDINGS)
 		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
 		RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
 	)
-	
+
 	set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${NAME})
 endif()
 
@@ -642,7 +642,7 @@ macro(bl_sample NAME)
 	else()
 		add_executable(${NAME} ${${NAME}_SRC_FILES} ${${NAME}_HDR_FILES} )
 	endif()
-	
+
 	add_common_target_options(${NAME})
 
 	target_link_libraries(${NAME} ${ARGN})
@@ -651,10 +651,10 @@ endmacro()
 # Build shell
 if(BUILD_SAMPLES OR BUILD_TESTING)
 	message("-- Adding shell with '${SAMPLES_BACKEND}' backend.")
-	
+
 	include(SampleFileList)
 	include(BackendFileList)
-	
+
 	if(NOT BUILD_FRAMEWORK)
 		set(sample_LIBRARIES
 			shell
@@ -672,28 +672,28 @@ if(BUILD_SAMPLES OR BUILD_TESTING)
 	if(WIN32)
 		mark_as_advanced(SAMPLES_DIR)
 	endif()
-	
+
 
 	set(BACKEND_SRC_FILES "${${SAMPLES_BACKEND}_SRC_FILES}")
 	set(BACKEND_HDR_FILES "${${SAMPLES_BACKEND}_HDR_FILES}")
-	
+
 	if("${BACKEND_SRC_FILES}" STREQUAL "" OR "${BACKEND_HDR_FILES}" STREQUAL "")
 		message(FATAL_ERROR "Unknown samples backend '${SAMPLES_BACKEND}'.")
 	endif()
-	
+
 	list(APPEND shell_SRC_FILES ${BACKEND_SRC_FILES})
 	list(APPEND shell_HDR_FILES ${BACKEND_HDR_FILES} ${BACKEND_COMMON_HDR_FILES})
-	
+
 	add_library(shell STATIC ${shell_SRC_FILES} ${shell_HDR_FILES})
-	
+
 	target_include_directories(shell PUBLIC
 		${PROJECT_SOURCE_DIR}/Backends
 		${PROJECT_SOURCE_DIR}/Samples/shell/include
 	)
-	
+
 	add_common_target_options(shell)
 	target_link_libraries(shell PUBLIC RmlCore RmlDebugger)
-	
+
 	# Add OS dependencies.
 	if (WIN32)
 		target_link_libraries(shell PRIVATE shlwapi imm32)
@@ -711,49 +711,49 @@ if(BUILD_SAMPLES OR BUILD_TESTING)
 			endif()
 		endif()
 	endif()
-	
+
 	# Add platform dependencies.
-	if(SAMPLES_BACKEND MATCHES "^X11")		
+	if(SAMPLES_BACKEND MATCHES "^X11")
 		if(NOT X11_FOUND)
 			message(FATAL_ERROR "X11 not found or not supported on this platform, select a different sample backend.")
 		endif()
 	endif()
-	
+
 	if(SAMPLES_BACKEND MATCHES "^SDL")
 		message("-- Looking for SDL2 library for samples backend.")
 		if(EMSCRIPTEN)
 			set(EMSCRIPTEN_FLAGS "${EMSCRIPTEN_FLAGS} -sUSE_SDL=2 -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS='[tga]'")
 		else()
 			find_package(SDL2 REQUIRED)
-			
+
 			if(NOT SDL2_FOUND)
 				message(FATAL_ERROR "SDL2 not found")
 			endif()
-			
+
 			if(SAMPLES_BACKEND STREQUAL "SDL_GL2")
 				find_package(GLEW REQUIRED)
 				if(NOT GLEW_FOUND)
 					message(FATAL_ERROR "GLEW not found")
 				endif()
 			endif()
-			
+
 			# Check version requirement for the SDL renderer.
 			if(SAMPLES_BACKEND STREQUAL "SDL_SDLrenderer" AND "${SDL2_VERSION}" VERSION_LESS "2.0.20")
 				message(FATAL_ERROR "SDL2 native renderer backend (${SAMPLES_BACKEND}) requires SDL 2.0.20 (found ${SDL2_VERSION}).")
 			endif()
-			
+
 			if(SAMPLES_BACKEND STREQUAL "SDL_GL2" OR SAMPLES_BACKEND STREQUAL "SDL_GL3" OR SAMPLES_BACKEND STREQUAL "SDL_SDLrenderer")
 				find_package(SDL2_image REQUIRED)
 				if(NOT SDL2_IMAGE_FOUND)
 					message(FATAL_ERROR "SDL2_image not found")
 				endif()
 			endif()
-			
+
 			target_include_directories(shell PRIVATE ${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR} ${GLEW_INCLUDE_DIR})
 			target_link_libraries(shell PRIVATE ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${GLEW_LIBRARIES})
 		endif()
 	endif()
-	
+
 	if(SAMPLES_BACKEND MATCHES "^SFML")
 		message("-- Looking for SFML 2.x library for samples backend.")
 		if (WIN32)
@@ -764,14 +764,14 @@ if(BUILD_SAMPLES OR BUILD_TESTING)
 		target_include_directories(shell PRIVATE ${SFML_INCLUDE_DIR})
 		target_link_libraries(shell PRIVATE ${SFML_LIBRARIES})
 	endif()
-	
+
 	if(SAMPLES_BACKEND MATCHES "^GLFW")
 		message("-- Looking for GLFW3 library for samples backend.")
 		find_package(glfw3 3.3 CONFIG REQUIRED)
 		target_link_libraries(shell PRIVATE glfw)
 		message("-- Found GLFW version ${glfw3_VERSION}.")
 	endif()
-	
+
 	# Add renderer dependencies.
 	if(SAMPLES_BACKEND MATCHES "GL2$")
 		message("-- Adding OpenGL 2 renderer backend.")
@@ -783,19 +783,19 @@ if(BUILD_SAMPLES OR BUILD_TESTING)
 			target_compile_definitions(shell PRIVATE GL_SILENCE_DEPRECATION)
 		endif()
 	endif()
-	
+
 	if(SAMPLES_BACKEND MATCHES "VK$")
 		message("-- Using Vulkan renderer backend.")
-		
+
 		option(RMLUI_VK_DEBUG "Enable debugging mode for Vulkan renderer." OFF)
 		mark_as_advanced(RMLUI_VK_DEBUG)
 		if(RMLUI_VK_DEBUG)
-		  target_compile_definitions(shell PRIVATE RMLUI_VK_DEBUG)
+			target_compile_definitions(shell PRIVATE RMLUI_VK_DEBUG)
 		endif()
 
 		target_link_libraries(shell PRIVATE ${CMAKE_DL_LIBS})
 	endif()
-	
+
 	if(SAMPLES_BACKEND MATCHES "GL3$")
 		message("-- Adding OpenGL 3 renderer backend.")
 		if(EMSCRIPTEN)
@@ -830,7 +830,7 @@ if(BUILD_SAMPLES)
 
 		# The samples always set this as their current working directory
 		install(DIRECTORY DESTINATION ${SAMPLES_DIR}/basic/${sample})
-		install(TARGETS ${sample} 
+		install(TARGETS ${sample}
 			RUNTIME DESTINATION ${SAMPLES_DIR}/${sample}
 			BUNDLE DESTINATION ${SAMPLES_DIR})
 	endforeach()
@@ -839,7 +839,7 @@ if(BUILD_SAMPLES)
 	foreach(tutorial ${tutorials})
 		set(tutorial_fullname tutorial_${tutorial})
 		bl_sample(${tutorial_fullname} ${sample_LIBRARIES})
-		
+
 		# The tutorials always set this as their current working directory
 		install(DIRECTORY DESTINATION ${SAMPLES_DIR}/tutorial/${tutorial})
 		install(TARGETS ${tutorial_fullname}
@@ -850,22 +850,22 @@ if(BUILD_SAMPLES)
 	# Build and install invaders sample
 	bl_sample(invaders ${sample_LIBRARIES})
 	install(DIRECTORY DESTINATION ${SAMPLES_DIR}/invaders)
-	install(TARGETS invaders 
+	install(TARGETS invaders
 		RUNTIME DESTINATION ${SAMPLES_DIR}/invaders
 		BUNDLE DESTINATION ${SAMPLES_DIR})
 
 	if(BUILD_LUA_BINDINGS)
 		bl_sample(luainvaders RmlLua ${sample_LIBRARIES} ${LUA_BINDINGS_LINK_LIBS})
 		install(DIRECTORY DESTINATION ${SAMPLES_DIR}/luainvaders)
-		install(TARGETS luainvaders 
+		install(TARGETS luainvaders
 			RUNTIME DESTINATION ${SAMPLES_DIR}/luainvaders
 			BUNDLE DESTINATION ${SAMPLES_DIR})
 	endif()
-	
+
 	# Add assets to emscripten binaries
 	if(EMSCRIPTEN)
 		message("-- Preloading emscipten sample assets")
-		
+
 		set(COMMON_ASSET_FOLDER "Samples/assets/")
 		set(EMSCRIPTEN_EXE_FLAGS "${EMSCRIPTEN_EXE_FLAGS} --preload-file ${CMAKE_CURRENT_SOURCE_DIR}/${COMMON_ASSET_FOLDER}@/${COMMON_ASSET_FOLDER}")
 
@@ -876,7 +876,7 @@ if(BUILD_SAMPLES)
 				target_link_libraries(${sample} "--preload-file ${ABS_SAMPLE_DATA_FOLDER}@/${SAMPLE_DATA_FOLDER}")
 			endif()
 		endforeach()
-		
+
 		foreach(tutorial ${tutorials})
 			set(TUTORIAL_DATA_FOLDER "Samples/tutorial/${tutorial}/data/")
 			set(ABS_TUTORIAL_DATA_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/${TUTORIAL_DATA_FOLDER}")
@@ -884,7 +884,7 @@ if(BUILD_SAMPLES)
 				target_link_libraries("tutorial_${tutorial}" "--preload-file ${ABS_TUTORIAL_DATA_FOLDER}@/${TUTORIAL_DATA_FOLDER}")
 			endif()
 		endforeach()
-		
+
 		set(INVADER_DATA_FOLDER "Samples/invaders/data/")
 		target_link_libraries(invaders "-sALLOW_MEMORY_GROWTH --preload-file ${CMAKE_CURRENT_SOURCE_DIR}/${INVADER_DATA_FOLDER}@/${INVADER_DATA_FOLDER}")
 	endif()
@@ -906,7 +906,7 @@ if(EMSCRIPTEN)
 	# Enables Asyncify which we only need since the backend doesn't control the main loop. This enables us to yield to the browser during the backend call to
 	# Backend::ProcessEvents(). Asyncify results in larger and slower code, users are instead encouraged to use 'emscripten_set_main_loop()' and family.
 	set(EMSCRIPTEN_EXE_FLAGS "${EMSCRIPTEN_EXE_FLAGS} -sASYNCIFY")
-	
+
 	message(STATUS "Compiling for Emscripten.\n\t- Flags:${EMSCRIPTEN_FLAGS}\n\t- ExeFlags:${EMSCRIPTEN_EXE_FLAGS}")
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EMSCRIPTEN_FLAGS}")
 	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EMSCRIPTEN_FLAGS}")
@@ -975,7 +975,7 @@ if(BUILD_SAMPLES)
 	install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/invaders/data
 			DESTINATION ${SAMPLES_DIR}/invaders
 	)
-	
+
 	if(TARGET lottie)
 		install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/lottie/data
 				DESTINATION ${SAMPLES_DIR}/basic/lottie
@@ -988,10 +988,10 @@ if(BUILD_SAMPLES)
 	endif()
 
 	if(BUILD_LUA_BINDINGS)
-		install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/luainvaders/data 
+		install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/luainvaders/data
 				DESTINATION ${SAMPLES_DIR}/luainvaders
 		)
-		install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/luainvaders/lua 
+		install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/luainvaders/lua
 				DESTINATION ${SAMPLES_DIR}/luainvaders
 		)
 	endif()
@@ -1046,4 +1046,3 @@ else()
 		" or write generators for RmlUiConfig.cmake by yourself.")
 endif()
 endif()
-

+ 130 - 123
Include/RmlUi/Config/Config.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -38,165 +38,172 @@
  */
 
 #ifdef RMLUI_CUSTOM_CONFIGURATION_FILE
-#include RMLUI_CUSTOM_CONFIGURATION_FILE
+	#include RMLUI_CUSTOM_CONFIGURATION_FILE
 #else
-#include <utility>
-#include <vector>
-#include <string>
-#include <stack>
-#include <list>
-#include <functional>
-#include <queue>
-#include <array>
-#include <unordered_map>
-#include <memory>
-
-#ifdef RMLUI_NO_THIRDPARTY_CONTAINERS
-#include <set>
-#include <unordered_set>
-#else
-#include "../Core/Containers/itlib/flat_map.hpp"
-#include "../Core/Containers/itlib/flat_set.hpp"
-#include "../Core/Containers/robin_hood.h"
-#endif	// RMLUI_NO_THIRDPARTY_CONTAINERS
+	#include <array>
+	#include <functional>
+	#include <list>
+	#include <memory>
+	#include <queue>
+	#include <stack>
+	#include <string>
+	#include <unordered_map>
+	#include <utility>
+	#include <vector>
+
+	#ifdef RMLUI_NO_THIRDPARTY_CONTAINERS
+		#include <set>
+		#include <unordered_set>
+	#else
+		#include "../Core/Containers/itlib/flat_map.hpp"
+		#include "../Core/Containers/itlib/flat_set.hpp"
+		#include "../Core/Containers/robin_hood.h"
+	#endif // RMLUI_NO_THIRDPARTY_CONTAINERS
 
 namespace Rml {
 
-// Default matrix type to be used. This alias may be set to ColumnMajorMatrix4f or RowMajorMatrix4f. This alias can not
-// be set here because matrix types are defined after this include in Core/Types.h.
-#ifdef RMLUI_MATRIX_ROW_MAJOR
-#define RMLUI_MATRIX4_TYPE RowMajorMatrix4f
-#else
-#define RMLUI_MATRIX4_TYPE ColumnMajorMatrix4f
-#endif
+	// Default matrix type to be used. This alias may be set to ColumnMajorMatrix4f or RowMajorMatrix4f. This alias can not
+	// be set here because matrix types are defined after this include in Core/Types.h.
+	#ifdef RMLUI_MATRIX_ROW_MAJOR
+		#define RMLUI_MATRIX4_TYPE RowMajorMatrix4f
+	#else
+		#define RMLUI_MATRIX4_TYPE ColumnMajorMatrix4f
+	#endif
 
-// A way to disable 'final' specified for Rml::Releaser class. It breaks EASTL.
-#define RMLUI_RELEASER_FINAL final
+	// A way to disable 'final' specified for Rml::Releaser class. It breaks EASTL.
+	#define RMLUI_RELEASER_FINAL final
 
 // Containers types.
-template<typename T>
+template <typename T>
 using Vector = std::vector<T>;
-template<typename T, size_t N = 1>
+template <typename T, size_t N = 1>
 using Array = std::array<T, N>;
-template<typename T>
+template <typename T>
 using Stack = std::stack<T>;
-template<typename T>
+template <typename T>
 using List = std::list<T>;
-template<typename T>
+template <typename T>
 using Queue = std::queue<T>;
-template<typename T1, typename T2>
+template <typename T1, typename T2>
 using Pair = std::pair<T1, T2>;
 template <typename Key, typename Value>
-using UnorderedMultimap = std::unordered_multimap< Key, Value >;
-#ifdef RMLUI_NO_THIRDPARTY_CONTAINERS
+using UnorderedMultimap = std::unordered_multimap<Key, Value>;
+
+	#ifdef RMLUI_NO_THIRDPARTY_CONTAINERS
 template <typename Key, typename Value>
-using UnorderedMap = std::unordered_map< Key, Value >;
+using UnorderedMap = std::unordered_map<Key, Value>;
 template <typename Key, typename Value>
-using SmallUnorderedMap = UnorderedMap< Key, Value >;
+using SmallUnorderedMap = UnorderedMap<Key, Value>;
 template <typename T>
-using UnorderedSet = std::unordered_set< T >;
+using UnorderedSet = std::unordered_set<T>;
 template <typename T>
-using SmallUnorderedSet = std::unordered_set< T >;
+using SmallUnorderedSet = std::unordered_set<T>;
 template <typename T>
-using SmallOrderedSet = std::set< T >;
-#else
-template < typename Key, typename Value>
-using UnorderedMap = robin_hood::unordered_flat_map< Key, Value >;
+using SmallOrderedSet = std::set<T>;
+	#else
 template <typename Key, typename Value>
-using SmallUnorderedMap = itlib::flat_map< Key, Value >;
+using UnorderedMap = robin_hood::unordered_flat_map<Key, Value>;
+template <typename Key, typename Value>
+using SmallUnorderedMap = itlib::flat_map<Key, Value>;
 template <typename T>
-using UnorderedSet = robin_hood::unordered_flat_set< T >;
+using UnorderedSet = robin_hood::unordered_flat_set<T>;
 template <typename T>
-using SmallUnorderedSet = itlib::flat_set< T >;
+using SmallUnorderedSet = itlib::flat_set<T>;
 template <typename T>
-using SmallOrderedSet = itlib::flat_set< T >;
-#endif	// RMLUI_NO_THIRDPARTY_CONTAINERS
-template<typename Iterator>
-inline std::move_iterator<Iterator> MakeMoveIterator(Iterator it) { return std::make_move_iterator(it); }
+using SmallOrderedSet = itlib::flat_set<T>;
+	#endif // RMLUI_NO_THIRDPARTY_CONTAINERS
 
 // Utilities.
 template <typename T>
 using Hash = std::hash<T>;
-template<typename T>
+template <typename T>
 using Function = std::function<T>;
+template <typename Iterator>
+inline std::move_iterator<Iterator> MakeMoveIterator(Iterator it)
+{
+	return std::make_move_iterator(it);
+}
 
 // Strings.
 using String = std::string;
-using StringList = Vector< String >;
+using StringList = Vector<String>;
 
 // Smart pointer types.
-template<typename T>
+template <typename T>
 using UniquePtr = std::unique_ptr<T>;
-template<typename T>
+template <typename T>
 class Releaser;
-template<typename T>
+template <typename T>
 using UniqueReleaserPtr = std::unique_ptr<T, Releaser<T>>;
-template<typename T>
+template <typename T>
 using SharedPtr = std::shared_ptr<T>;
-template<typename T>
+template <typename T>
 using WeakPtr = std::weak_ptr<T>;
-template<typename T, typename... Args>
-inline SharedPtr<T> MakeShared(Args&&... args) { return std::make_shared<T, Args...>(std::forward<Args>(args)...); }
-template<typename T, typename... Args>
-inline UniquePtr<T> MakeUnique(Args&&... args) { return std::make_unique<T, Args...>(std::forward<Args>(args)...); }
-
+template <typename T, typename... Args>
+inline SharedPtr<T> MakeShared(Args&&... args)
+{
+	return std::make_shared<T, Args...>(std::forward<Args>(args)...);
+}
+template <typename T, typename... Args>
+inline UniquePtr<T> MakeUnique(Args&&... args)
+{
+	return std::make_unique<T, Args...>(std::forward<Args>(args)...);
 }
 
-
-/***
-// The following defines should be used for inserting custom type cast operators for conversion of RmlUi types
-// to user types. RmlUi uses template math types, therefore conversion operators to non-templated types
-// should be done using SFINAE as in example below.
-
-// Extra code to be inserted into RmlUi::Color<> class body. Note: be mindful of colorspaces used by different
-// color types. RmlUi assumes that float colors are interpreted in linear colorspace while byte colors are
-// interpreted as sRGB.
-
-#define RMLUI_COLOUR_USER_EXTRA                                                                         \
-	template<typename U = ColourType, typename std::enable_if_t<std::is_same_v<U, byte>>* = nullptr>    \
-	operator MyColor() const { return MyColor(                                                          \
-		(float)red / 255.0f, (float)green / 255.0f, (float)blue / 255.0f, (float)alpha / 255.0f); }     \
-	template<typename U = ColourType, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>   \
-	operator MyColor() const { return MyColor(red, green, blue, alpha); }                               \
-
-// Extra code to be inserted into RmlUi::Vector2<> class body.
-#define RMLUI_VECTOR2_USER_EXTRA                                                                        \
-	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
-	operator typename MyIntVector2() const { return MyIntVector2(x, y); }                               \
-	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
-	operator MyVector2() const { return MyVector2(x, y); }                                              \
-	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
-	Vector2(MyIntVector2 value) : Vector2(value.x_, value.y_) { }                                       \
-	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
-	Vector2(MyVector2 value) : Vector2(value.x_, value.y_) { }                                          \
-
-// Extra code to be inserted into RmlUi::Vector3<> class body.
-#define RMLUI_VECTOR3_USER_EXTRA                                                                        \
-	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
-	operator typename MyIntVector3() const { return MyIntVector3(x, y, z); }                            \
-	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
-	operator MyVector3() const { return MyVector3(x, y, z); }                                           \
-	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
-	Vector3(MyIntVector3 value) : Vector3(value.x_, value.y_, value.z_) { }                             \
-	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
-	Vector3(MyVector3 value) : Vector3(value.x_, value.y_, value.z_) { }                                \
-
-// Extra code to be inserted into RmlUi::Vector4<> class body.
-#define RMLUI_VECTOR4_USER_EXTRA                                                                        \
-	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
-	operator typename MyIntVector4() const { return MyIntVector4(x, y, z, w); }                         \
-	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
-	operator MyVector4() const { return MyVector4(x, y, z, w); }                                        \
-	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
-	Vector4(MyIntVector4 value) : Vector4(value.x_, value.y_, value.z_, value.w_) { }                   \
-	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
-	Vector4(MyVector4 value) : Vector4(value.x_, value.y_, value.z_, value.w_) { }                      \
-
-// Extra code to be inserted into RmlUi::Matrix4<> class body.
-	#define RMLUI_MATRIX4_USER_EXTRA operator MyMatrix4() const { return MyMatrix4(data()); }
-***/
-
-
-#endif	// RMLUI_USER_CONFIG_FILE
-
-#endif  // RMLUI_CONFIG_CONFIG_H
+} // namespace Rml
+
+	/***
+	// The following defines should be used for inserting custom type cast operators for conversion of RmlUi types
+	// to user types. RmlUi uses template math types, therefore conversion operators to non-templated types
+	// should be done using SFINAE as in example below.
+
+	// Extra code to be inserted into RmlUi::Color<> class body. Note: be mindful of colorspaces used by different
+	// color types. RmlUi assumes that float colors are interpreted in linear colorspace while byte colors are
+	// interpreted as sRGB.
+	#define RMLUI_COLOUR_USER_EXTRA                                                                         \
+	    template<typename U = ColourType, typename std::enable_if_t<std::is_same_v<U, byte>>* = nullptr>    \
+	    operator MyColor() const { return MyColor(                                                          \
+	        (float)red / 255.0f, (float)green / 255.0f, (float)blue / 255.0f, (float)alpha / 255.0f); }     \
+	    template<typename U = ColourType, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>   \
+	    operator MyColor() const { return MyColor(red, green, blue, alpha); }                               \
+
+	// Extra code to be inserted into RmlUi::Vector2<> class body.
+	#define RMLUI_VECTOR2_USER_EXTRA                                                                        \
+	    template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
+	    operator typename MyIntVector2() const { return MyIntVector2(x, y); }                               \
+	    template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
+	    operator MyVector2() const { return MyVector2(x, y); }                                              \
+	    template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
+	    Vector2(MyIntVector2 value) : Vector2(value.x_, value.y_) { }                                       \
+	    template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
+	    Vector2(MyVector2 value) : Vector2(value.x_, value.y_) { }                                          \
+
+	// Extra code to be inserted into RmlUi::Vector3<> class body.
+	#define RMLUI_VECTOR3_USER_EXTRA                                                                        \
+	    template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
+	    operator typename MyIntVector3() const { return MyIntVector3(x, y, z); }                            \
+	    template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
+	    operator MyVector3() const { return MyVector3(x, y, z); }                                           \
+	    template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
+	    Vector3(MyIntVector3 value) : Vector3(value.x_, value.y_, value.z_) { }                             \
+	    template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
+	    Vector3(MyVector3 value) : Vector3(value.x_, value.y_, value.z_) { }                                \
+
+	// Extra code to be inserted into RmlUi::Vector4<> class body.
+	#define RMLUI_VECTOR4_USER_EXTRA                                                                        \
+	    template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
+	    operator typename MyIntVector4() const { return MyIntVector4(x, y, z, w); }                         \
+	    template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
+	    operator MyVector4() const { return MyVector4(x, y, z, w); }                                        \
+	    template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
+	    Vector4(MyIntVector4 value) : Vector4(value.x_, value.y_, value.z_, value.w_) { }                   \
+	    template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
+	    Vector4(MyVector4 value) : Vector4(value.x_, value.y_, value.z_, value.w_) { }                      \
+
+	// Extra code to be inserted into RmlUi::Matrix4<> class body.
+	    #define RMLUI_MATRIX4_USER_EXTRA operator MyMatrix4() const { return MyMatrix4(data()); }
+	***/
+
+#endif     // RMLUI_USER_CONFIG_FILE
+
+#endif     // RMLUI_CONFIG_CONFIG_H

+ 7 - 7
Include/RmlUi/Core.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,17 +29,13 @@
 #ifndef RMLUI_CORE_H
 #define RMLUI_CORE_H
 
-#include "Core/Core.h"
-
-#include "Core/Types.h"
-#include "Core/Math.h"
-#include "Core/Header.h"
 #include "Core/Animation.h"
 #include "Core/Box.h"
 #include "Core/ComputedValues.h"
 #include "Core/Context.h"
 #include "Core/ContextInstancer.h"
 #include "Core/ConvolutionFilter.h"
+#include "Core/Core.h"
 #include "Core/DataModelHandle.h"
 #include "Core/DataTypeRegister.h"
 #include "Core/DataTypes.h"
@@ -64,9 +60,11 @@
 #include "Core/FontGlyph.h"
 #include "Core/Geometry.h"
 #include "Core/GeometryUtilities.h"
+#include "Core/Header.h"
 #include "Core/ID.h"
 #include "Core/Input.h"
 #include "Core/Log.h"
+#include "Core/Math.h"
 #include "Core/Plugin.h"
 #include "Core/PropertiesIteratorView.h"
 #include "Core/Property.h"
@@ -88,10 +86,12 @@
 #include "Core/TransformPrimitive.h"
 #include "Core/Tween.h"
 #include "Core/TypeConverter.h"
+#include "Core/Types.h"
 #include "Core/Vertex.h"
 #include "Core/XMLNodeHandler.h"
 #include "Core/XMLParser.h"
 
+// Elements
 #include "Core/Elements/ElementForm.h"
 #include "Core/Elements/ElementFormControl.h"
 #include "Core/Elements/ElementFormControlInput.h"

+ 29 - 10
Include/RmlUi/Core/Animation.h

@@ -28,9 +28,9 @@
 #ifndef RMLUI_CORE_ANIMATION_H
 #define RMLUI_CORE_ANIMATION_H
 
-#include "Types.h"
-#include "Tween.h"
 #include "ID.h"
+#include "Tween.h"
+#include "Types.h"
 
 namespace Rml {
 
@@ -60,16 +60,35 @@ struct TransitionList {
 	Vector<Transition> transitions;
 
 	TransitionList() {}
-	TransitionList(bool none, bool all, Vector<Transition> transitions) :
-		none(none), all(all), transitions(std::move(transitions)) {}
+	TransitionList(bool none, bool all, Vector<Transition> transitions) : none(none), all(all), transitions(std::move(transitions)) {}
 };
 
-inline bool operator==(const Animation& a, const Animation& b) { return a.duration == b.duration && a.tween == b.tween && a.delay == b.delay && a.alternate == b.alternate && a.paused == b.paused && a.num_iterations == b.num_iterations && a.name == b.name; }
-inline bool operator!=(const Animation& a, const Animation& b) { return !(a == b); }
-inline bool operator==(const Transition& a, const Transition& b) { return a.id == b.id && a.tween == b.tween && a.duration == b.duration && a.delay == b.delay && a.reverse_adjustment_factor == b.reverse_adjustment_factor; }
-inline bool operator!=(const Transition& a, const Transition& b) { return !(a == b); }
-inline bool operator==(const TransitionList& a, const TransitionList& b) { return a.none == b.none && a.all == b.all && a.transitions == b.transitions; }
-inline bool operator!=(const TransitionList& a, const TransitionList& b) { return !(a == b); }
+inline bool operator==(const Animation& a, const Animation& b)
+{
+	return a.duration == b.duration && a.tween == b.tween && a.delay == b.delay && a.alternate == b.alternate && a.paused == b.paused &&
+		a.num_iterations == b.num_iterations && a.name == b.name;
+}
+inline bool operator!=(const Animation& a, const Animation& b)
+{
+	return !(a == b);
+}
+inline bool operator==(const Transition& a, const Transition& b)
+{
+	return a.id == b.id && a.tween == b.tween && a.duration == b.duration && a.delay == b.delay &&
+		a.reverse_adjustment_factor == b.reverse_adjustment_factor;
+}
+inline bool operator!=(const Transition& a, const Transition& b)
+{
+	return !(a == b);
+}
+inline bool operator==(const TransitionList& a, const TransitionList& b)
+{
+	return a.none == b.none && a.all == b.all && a.transitions == b.transitions;
+}
+inline bool operator!=(const TransitionList& a, const TransitionList& b)
+{
+	return !(a == b);
+}
 
 } // namespace Rml
 #endif

+ 91 - 92
Include/RmlUi/Core/BaseXMLParser.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,9 +29,9 @@
 #ifndef RMLUI_CORE_BASEXMLPARSER_H
 #define RMLUI_CORE_BASEXMLPARSER_H
 
+#include "Dictionary.h"
 #include "Header.h"
 #include "Types.h"
-#include "Dictionary.h"
 
 namespace Rml {
 
@@ -42,97 +42,96 @@ using XMLAttributes = Dictionary;
 enum class XMLDataType { Text, CData, InnerXML };
 
 /**
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API BaseXMLParser
-{
-	public:
-		BaseXMLParser();
-		virtual ~BaseXMLParser();
-
-		/// Registers a tag as containing general character data. This will mean the contents of the tag will be parsed
-		/// similarly to a CDATA tag (ie, no other markup will be recognised until the section's closing tag is found).
-		/// @param[in] tag The tag to register as containing generic character data.
-		void RegisterCDATATag(const String& tag);
-
-		/// When an XML attribute with the given name is encountered during parsing, then all content below the current
-		/// node is treated as data.
-		/// @note While children nodes are treated as data (text), it is assumed that the content represents valid XML.
-		///         The parsing proceeds as normal except that the Handle...() functions are not called until the
-		///         starting node is closed. Then, all its contents are submitted as Data (raw text string).
-		/// @note In particular, this behavior is useful for some data-binding views.
-		void RegisterInnerXMLAttribute(const String& attribute_name);
-
-		/// Parses the given stream as an XML file, and calls the handlers when
-		/// interesting phenomena are encountered.
-		void Parse(Stream* stream);
-
-		/// Get the line number in the stream.
-		/// @return The line currently being processed in the XML stream.
-		int GetLineNumber() const;
-		/// Get the line number of the last open tag in the stream.
-		int GetLineNumberOpenTag() const;
-
-		/// Called when the parser finds the beginning of an element tag.
-		virtual void HandleElementStart(const String& name, const XMLAttributes& attributes);
-		/// Called when the parser finds the end of an element tag.
-		virtual void HandleElementEnd(const String& name);
-		/// Called when the parser encounters data.
-		virtual void HandleData(const String& data, XMLDataType type);
-
-	protected:
-		const URL* GetSourceURLPtr() const;
-
-	private:
-		const URL* source_url = nullptr;
-		String xml_source;
-		size_t xml_index = 0;
-
-		void Next();
-		bool AtEnd() const;
-		char Look() const;
-
-		void HandleElementStartInternal(const String& name, const XMLAttributes& attributes);
-		void HandleElementEndInternal(const String& name);
-		void HandleDataInternal(const String& data, XMLDataType type);
-
-		void ReadHeader();
-		void ReadBody();
-		bool ReadOpenTag();
-
-		bool ReadCloseTag(size_t xml_index_tag);
-		bool ReadAttributes(XMLAttributes& attributes, bool& parse_raw_xml_content);
-		bool ReadCDATA(const char* tag_terminator = nullptr);
-
-		// Reads from the stream until a complete word is found.
-		// @param[out] word Word thats been found
-		// @param[in] terminators List of characters that terminate the search
-		bool FindWord(String& word, const char* terminators = nullptr);
-		// Reads from the stream until the given character set is found. All
-		// intervening characters will be returned in data.
-		bool FindString(const char* string, String& data, bool escape_brackets = false);
-		// Returns true if the next sequence of characters in the stream
-		// matches the given string. If consume is set and this returns true,
-		// the characters will be consumed.
-		bool PeekString(const char* string, bool consume = true);
-
-		int line_number = 0;
-		int line_number_open_tag = 0;
-		int open_tag_depth = 0;
-
-		// Enabled when an attribute for inner xml data is encountered (see description in Register...() above).
-		bool inner_xml_data = false;
-		int inner_xml_data_terminate_depth = 0;
-		size_t inner_xml_data_index_begin = 0;
-
-		// The element attributes being read.
-		XMLAttributes attributes;
-		// The loose data being read.
-		String data;
-
-		SmallUnorderedSet< String > cdata_tags;
-		SmallUnorderedSet< String > attributes_for_inner_xml_data;
+class RMLUICORE_API BaseXMLParser {
+public:
+	BaseXMLParser();
+	virtual ~BaseXMLParser();
+
+	/// Registers a tag as containing general character data. This will mean the contents of the tag will be parsed
+	/// similarly to a CDATA tag (ie, no other markup will be recognised until the section's closing tag is found).
+	/// @param[in] tag The tag to register as containing generic character data.
+	void RegisterCDATATag(const String& tag);
+
+	/// When an XML attribute with the given name is encountered during parsing, then all content below the current
+	/// node is treated as data.
+	/// @note While children nodes are treated as data (text), it is assumed that the content represents valid XML.
+	///         The parsing proceeds as normal except that the Handle...() functions are not called until the
+	///         starting node is closed. Then, all its contents are submitted as Data (raw text string).
+	/// @note In particular, this behavior is useful for some data-binding views.
+	void RegisterInnerXMLAttribute(const String& attribute_name);
+
+	/// Parses the given stream as an XML file, and calls the handlers when
+	/// interesting phenomena are encountered.
+	void Parse(Stream* stream);
+
+	/// Get the line number in the stream.
+	/// @return The line currently being processed in the XML stream.
+	int GetLineNumber() const;
+	/// Get the line number of the last open tag in the stream.
+	int GetLineNumberOpenTag() const;
+
+	/// Called when the parser finds the beginning of an element tag.
+	virtual void HandleElementStart(const String& name, const XMLAttributes& attributes);
+	/// Called when the parser finds the end of an element tag.
+	virtual void HandleElementEnd(const String& name);
+	/// Called when the parser encounters data.
+	virtual void HandleData(const String& data, XMLDataType type);
+
+protected:
+	const URL* GetSourceURLPtr() const;
+
+private:
+	const URL* source_url = nullptr;
+	String xml_source;
+	size_t xml_index = 0;
+
+	void Next();
+	bool AtEnd() const;
+	char Look() const;
+
+	void HandleElementStartInternal(const String& name, const XMLAttributes& attributes);
+	void HandleElementEndInternal(const String& name);
+	void HandleDataInternal(const String& data, XMLDataType type);
+
+	void ReadHeader();
+	void ReadBody();
+	bool ReadOpenTag();
+
+	bool ReadCloseTag(size_t xml_index_tag);
+	bool ReadAttributes(XMLAttributes& attributes, bool& parse_raw_xml_content);
+	bool ReadCDATA(const char* tag_terminator = nullptr);
+
+	// Reads from the stream until a complete word is found.
+	// @param[out] word Word thats been found
+	// @param[in] terminators List of characters that terminate the search
+	bool FindWord(String& word, const char* terminators = nullptr);
+	// Reads from the stream until the given character set is found. All
+	// intervening characters will be returned in data.
+	bool FindString(const char* string, String& data, bool escape_brackets = false);
+	// Returns true if the next sequence of characters in the stream
+	// matches the given string. If consume is set and this returns true,
+	// the characters will be consumed.
+	bool PeekString(const char* string, bool consume = true);
+
+	int line_number = 0;
+	int line_number_open_tag = 0;
+	int open_tag_depth = 0;
+
+	// Enabled when an attribute for inner xml data is encountered (see description in Register...() above).
+	bool inner_xml_data = false;
+	int inner_xml_data_terminate_depth = 0;
+	size_t inner_xml_data_index_begin = 0;
+
+	// The element attributes being read.
+	XMLAttributes attributes;
+	// The loose data being read.
+	String data;
+
+	SmallUnorderedSet<String> cdata_tags;
+	SmallUnorderedSet<String> attributes_for_inner_xml_data;
 };
 
 } // namespace Rml

+ 12 - 24
Include/RmlUi/Core/Box.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -34,38 +34,25 @@
 namespace Rml {
 
 /**
-	Stores a box with four sized areas; content, padding, a border and margin. See
-	http://www.w3.org/TR/REC-CSS2/box.html#box-dimensions for a diagram.
+    Stores a box with four sized areas; content, padding, a border and margin. See
+    http://www.w3.org/TR/REC-CSS2/box.html#box-dimensions for a diagram.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API Box
-{
+class RMLUICORE_API Box {
 public:
-	enum Area
-	{
+	enum Area {
 		MARGIN = 0,
 		BORDER = 1,
 		PADDING = 2,
 		CONTENT = 3,
-		NUM_AREAS = 3,		// ignores CONTENT
+		NUM_AREAS = 3, // ignores CONTENT
 	};
 
-	enum Edge
-	{
-		TOP = 0,
-		RIGHT = 1,
-		BOTTOM = 2,
-		LEFT = 3,
-		NUM_EDGES = 4
-	};
+	enum Edge { TOP = 0, RIGHT = 1, BOTTOM = 2, LEFT = 3, NUM_EDGES = 4 };
 
-	enum Direction
-	{
-		VERTICAL = 0,
-		HORIZONTAL = 1
-	};
+	enum Direction { VERTICAL = 0, HORIZONTAL = 1 };
 
 	/// Initialises a zero-sized box.
 	Box();
@@ -101,7 +88,8 @@ public:
 	/// @return The size of the requested area edge.
 	float GetEdge(Area area, Edge edge) const;
 	/// Returns the cumulative size of one edge up to one of the box's areas.
-	/// @param area[in] The area to measure up to (and including). So, MARGIN will return the width of the margin, and PADDING will be the sum of the margin, border and padding.
+	/// @param area[in] The area to measure up to (and including). So, MARGIN will return the width of the margin, and PADDING will be the sum of the
+	/// margin, border and padding.
 	/// @param edge[in] The desired edge.
 	/// @return The cumulative size of the edge.
 	float GetCumulativeEdge(Area area, Edge edge) const;

+ 9 - 12
Include/RmlUi/Core/Colour.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -33,26 +33,25 @@
 
 namespace Rml {
 
-/**	
-	Templated class for a four-component RGBA colour.
+/**
+    Templated class for a four-component RGBA colour.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-template < typename ColourType, int AlphaDefault >
-class Colour
-{
+template <typename ColourType, int AlphaDefault>
+class Colour {
 public:
 	/// Initialising constructor.
 	/// @param[in] rgb Initial red, green and blue value of the colour.
 	/// @param[in] alpha Initial alpha value of the colour.
-	inline Colour(ColourType rgb = ColourType{ 0 }, ColourType alpha = ColourType{ AlphaDefault });
+	inline Colour(ColourType rgb = ColourType{0}, ColourType alpha = ColourType{AlphaDefault});
 	/// Initialising constructor.
 	/// @param[in] red Initial red value of the colour.
 	/// @param[in] green Initial green value of the colour.
 	/// @param[in] blue Initial blue value of the colour.
 	/// @param[in] alpha Initial alpha value of the colour.
-	inline Colour(ColourType red, ColourType green, ColourType blue, ColourType alpha = ColourType{ AlphaDefault });
+	inline Colour(ColourType red, ColourType green, ColourType blue, ColourType alpha = ColourType{AlphaDefault});
 
 	/// Returns the sum of this colour and another. This does not saturate the channels.
 	/// @param[in] rhs The colour to add this to.
@@ -111,8 +110,6 @@ public:
 
 } // namespace Rml
 
-
 #include "Colour.inl"
 
-
 #endif

+ 29 - 32
Include/RmlUi/Core/Colour.inl

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,50 +29,47 @@
 namespace Rml {
 
 // Lightweight, non-initialising constructor.
-template < typename ColourType, int AlphaDefault >
-Colour< ColourType, AlphaDefault >::Colour(ColourType rgb, ColourType alpha) 
-	: red(rgb), green(rgb), blue(rgb), alpha(alpha)
-{
-}
+template <typename ColourType, int AlphaDefault>
+Colour<ColourType, AlphaDefault>::Colour(ColourType rgb, ColourType alpha) : red(rgb), green(rgb), blue(rgb), alpha(alpha)
+{}
 
 // Initialising constructor.
-template < typename ColourType, int AlphaDefault >
-Colour< ColourType, AlphaDefault >::Colour(ColourType red, ColourType green, ColourType blue, ColourType alpha)
-	: red(red), green(green), blue(blue), alpha(alpha)
-{
-}
+template <typename ColourType, int AlphaDefault>
+Colour<ColourType, AlphaDefault>::Colour(ColourType red, ColourType green, ColourType blue, ColourType alpha) :
+	red(red), green(green), blue(blue), alpha(alpha)
+{}
 
 // Returns the sum of this colour and another. This does not saturate the channels.
-template < typename ColourType, int AlphaDefault >
-Colour< ColourType, AlphaDefault > Colour< ColourType, AlphaDefault >::operator+(const Colour< ColourType, AlphaDefault > rhs) const
+template <typename ColourType, int AlphaDefault>
+Colour<ColourType, AlphaDefault> Colour<ColourType, AlphaDefault>::operator+(const Colour<ColourType, AlphaDefault> rhs) const
 {
-	return Colour< ColourType, AlphaDefault >(red + rhs.red, green + rhs.green, blue + rhs.blue, alpha + rhs.alpha);
+	return Colour<ColourType, AlphaDefault>(red + rhs.red, green + rhs.green, blue + rhs.blue, alpha + rhs.alpha);
 }
 
 // Returns the result of subtracting another colour from this colour.
-template < typename ColourType, int AlphaDefault >
-Colour< ColourType, AlphaDefault > Colour< ColourType, AlphaDefault >::operator-(const Colour< ColourType, AlphaDefault > rhs) const
+template <typename ColourType, int AlphaDefault>
+Colour<ColourType, AlphaDefault> Colour<ColourType, AlphaDefault>::operator-(const Colour<ColourType, AlphaDefault> rhs) const
 {
-	return Colour< ColourType, AlphaDefault >(red - rhs.red, green - rhs.green, blue - rhs.blue, alpha - rhs.alpha);
+	return Colour<ColourType, AlphaDefault>(red - rhs.red, green - rhs.green, blue - rhs.blue, alpha - rhs.alpha);
 }
 
 // Returns the result of multiplying this colour component-wise by a scalar.
-template < typename ColourType, int AlphaDefault >
-Colour< ColourType, AlphaDefault > Colour< ColourType, AlphaDefault >::operator*(float rhs) const
+template <typename ColourType, int AlphaDefault>
+Colour<ColourType, AlphaDefault> Colour<ColourType, AlphaDefault>::operator*(float rhs) const
 {
-	return Colour((ColourType) (red * rhs), (ColourType) (green * rhs), (ColourType) (blue * rhs), (ColourType) (alpha * rhs));
+	return Colour((ColourType)(red * rhs), (ColourType)(green * rhs), (ColourType)(blue * rhs), (ColourType)(alpha * rhs));
 }
 
 // Returns the result of dividing this colour component-wise by a scalar.
-template < typename ColourType, int AlphaDefault >
-Colour< ColourType, AlphaDefault > Colour< ColourType, AlphaDefault >::operator/(float rhs) const
+template <typename ColourType, int AlphaDefault>
+Colour<ColourType, AlphaDefault> Colour<ColourType, AlphaDefault>::operator/(float rhs) const
 {
-	return Colour((ColourType) (red / rhs), (ColourType) (green / rhs), (ColourType) (blue / rhs), (ColourType) (alpha / rhs));
+	return Colour((ColourType)(red / rhs), (ColourType)(green / rhs), (ColourType)(blue / rhs), (ColourType)(alpha / rhs));
 }
 
 // Adds another colour to this in-place. This does not saturate the channels.
-template < typename ColourType, int AlphaDefault >
-void Colour< ColourType, AlphaDefault >::operator+=(const Colour rhs)
+template <typename ColourType, int AlphaDefault>
+void Colour<ColourType, AlphaDefault>::operator+=(const Colour rhs)
 {
 	red += rhs.red;
 	green += rhs.green;
@@ -81,8 +78,8 @@ void Colour< ColourType, AlphaDefault >::operator+=(const Colour rhs)
 }
 
 // Subtracts another colour from this in-place.
-template < typename ColourType, int AlphaDefault >
-void Colour< ColourType, AlphaDefault >::operator-=(const Colour rhs)
+template <typename ColourType, int AlphaDefault>
+void Colour<ColourType, AlphaDefault>::operator-=(const Colour rhs)
 {
 	red -= rhs.red;
 	green -= rhs.green;
@@ -91,8 +88,8 @@ void Colour< ColourType, AlphaDefault >::operator-=(const Colour rhs)
 }
 
 // Scales this colour component-wise in-place.
-template < typename ColourType, int AlphaDefault >
-void Colour< ColourType, AlphaDefault >::operator*=(float rhs)
+template <typename ColourType, int AlphaDefault>
+void Colour<ColourType, AlphaDefault>::operator*=(float rhs)
 {
 	red = (ColourType)(red * rhs);
 	green = (ColourType)(green * rhs);
@@ -101,8 +98,8 @@ void Colour< ColourType, AlphaDefault >::operator*=(float rhs)
 }
 
 // Scales this colour component-wise in-place by the inverse of a value.
-template < typename ColourType, int AlphaDefault >
-void Colour< ColourType, AlphaDefault >::operator/=(float rhs)
+template <typename ColourType, int AlphaDefault>
+void Colour<ColourType, AlphaDefault>::operator/=(float rhs)
 {
 	*this *= (1.0f / rhs);
 }

+ 1 - 1
Include/RmlUi/Core/ComputedValues.h

@@ -3,7 +3,7 @@
  *
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 28 - 20
Include/RmlUi/Core/Context.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -30,11 +30,11 @@
 #define RMLUI_CORE_CONTEXT_H
 
 #include "Header.h"
-#include "Types.h"
-#include "Traits.h"
 #include "Input.h"
 #include "ScriptInterface.h"
 #include "ScrollTypes.h"
+#include "Traits.h"
+#include "Types.h"
 
 namespace Rml {
 
@@ -50,13 +50,12 @@ class ScrollController;
 enum class EventId : uint16_t;
 
 /**
-	A context for storing, rendering and processing RML documents. Multiple contexts can exist simultaneously.
+    A context for storing, rendering and processing RML documents. Multiple contexts can exist simultaneously.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API Context : public ScriptInterface
-{
+class RMLUICORE_API Context : public ScriptInterface {
 public:
 	/// Constructs a new, uninitialised context. This should not be called directly, use CreateContext()
 	/// instead.
@@ -83,7 +82,7 @@ public:
 	/// @return The current density-independent pixel ratio of the context.
 	float GetDensityIndependentPixelRatio() const;
 
-	/// Updates all elements in the context's documents. 
+	/// Updates all elements in the context's documents.
 	/// This must be called before Context::Render, but after any elements have been changed, added or removed.
 	bool Update();
 	/// Renders all visible elements in the context's documents.
@@ -180,12 +179,14 @@ public:
 
 	/// Sends a key down event into this context.
 	/// @param[in] key_identifier The key pressed.
-	/// @param[in] key_modifier_state The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together members of the Input::KeyModifier enumeration.
+	/// @param[in] key_modifier_state The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together
+	/// members of the Input::KeyModifier enumeration.
 	/// @return True if the event was not consumed (ie, was prevented from propagating by an element), false if it was.
 	bool ProcessKeyDown(Input::KeyIdentifier key_identifier, int key_modifier_state);
 	/// Sends a key up event into this context.
 	/// @param[in] key_identifier The key released.
-	/// @param[in] key_modifier_state The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together members of the Input::KeyModifier enumeration.
+	/// @param[in] key_modifier_state The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together
+	/// members of the Input::KeyModifier enumeration.
 	/// @return True if the event was not consumed (ie, was prevented from propagating by an element), false if it was.
 	bool ProcessKeyUp(Input::KeyIdentifier key_identifier, int key_modifier_state);
 
@@ -203,17 +204,20 @@ public:
 	/// Sends a mouse movement event into this context.
 	/// @param[in] x The x-coordinate of the mouse cursor, in window-coordinates (ie, 0 should be the left of the client area).
 	/// @param[in] y The y-coordinate of the mouse cursor, in window-coordinates (ie, 0 should be the top of the client area).
-	/// @param[in] key_modifier_state The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together members of the Input::KeyModifier enumeration.
+	/// @param[in] key_modifier_state The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together
+	/// members of the Input::KeyModifier enumeration.
 	/// @return True if the mouse is not interacting with any elements in the context (see 'IsMouseInteracting'), otherwise false.
 	bool ProcessMouseMove(int x, int y, int key_modifier_state);
 	/// Sends a mouse-button down event into this context.
 	/// @param[in] button_index The index of the button that was pressed; 0 for the left button, 1 for right, and 2 for middle button.
-	/// @param[in] key_modifier_state The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together members of the Input::KeyModifier enumeration.
+	/// @param[in] key_modifier_state The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together
+	/// members of the Input::KeyModifier enumeration.
 	/// @return True if the mouse is not interacting with any elements in the context (see 'IsMouseInteracting'), otherwise false.
 	bool ProcessMouseButtonDown(int button_index, int key_modifier_state);
 	/// Sends a mouse-button up event into this context.
 	/// @param[in] button_index The index of the button that was release; 0 for the left button, 1 for right, and 2 for middle button.
-	/// @param[in] key_modifier_state The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together members of the Input::KeyModifier enumeration.
+	/// @param[in] key_modifier_state The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together
+	/// members of the Input::KeyModifier enumeration.
 	/// @return True if the mouse is not interacting with any elements in the context (see 'IsMouseInteracting'), otherwise false.
 	bool ProcessMouseButtonUp(int button_index, int key_modifier_state);
 	/// Sends a mousescroll event into this context.
@@ -221,16 +225,20 @@ public:
 	bool ProcessMouseWheel(float wheel_delta, int key_modifier_state);
 	/// Sends a mousescroll event into this context, and scrolls the document unless the event was stopped from propagating.
 	/// @param[in] wheel_delta The mouse-wheel movement this frame, with positive values being directed right and down.
-	/// @param[in] key_modifier_state The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together members of the Input::KeyModifier enumeration.
+	/// @param[in] key_modifier_state The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together
+	/// members of the Input::KeyModifier enumeration.
 	/// @return True if the event was not consumed (ie, was prevented from propagating by an element), false if it was.
 	bool ProcessMouseWheel(Vector2f wheel_delta, int key_modifier_state);
-	/// Tells the context the mouse has left the window. This removes any hover state from all elements and prevents 'Update()' from setting the hover state for elements under the mouse.
+	/// Tells the context the mouse has left the window. This removes any hover state from all elements and prevents 'Update()' from setting the hover
+	/// state for elements under the mouse.
 	/// @return True if the mouse is not interacting with any elements in the context (see 'IsMouseInteracting'), otherwise false.
 	/// @note The mouse is considered activate again after the next call to 'ProcessMouseMove()'.
 	bool ProcessMouseLeave();
 
-	/// Returns a hint on whether the mouse is currently interacting with any elements in this context, based on previously submitted 'ProcessMouse...()' commands.
-	/// @note Interaction is determined irrespective of background and opacity. See the RCSS property 'pointer-events' to disable interaction for specific elements.
+	/// Returns a hint on whether the mouse is currently interacting with any elements in this context, based on previously submitted
+	/// 'ProcessMouse...()' commands.
+	/// @note Interaction is determined irrespective of background and opacity. See the RCSS property 'pointer-events' to disable interaction for
+	/// specific elements.
 	/// @return True if the mouse hovers over or has activated an element in this context, otherwise false.
 	bool IsMouseInteracting() const;
 
@@ -308,8 +316,8 @@ private:
 
 	ContextInstancer* instancer;
 
-	using ElementSet = SmallOrderedSet< Element* >;
-	using ElementList = Vector< Element* >;
+	using ElementSet = SmallOrderedSet<Element*>;
+	using ElementList = Vector<Element*>;
 	// Set of elements that are currently in hover state.
 	ElementSet hover_chain;
 	// List of elements that are currently in active state.

+ 5 - 6
Include/RmlUi/Core/ContextInstancer.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -39,13 +39,12 @@ class Context;
 class Event;
 
 /**
-	Abstract instancer interface for instancing contexts.
+    Abstract instancer interface for instancing contexts.
 
-	@author Lloyd Weehuizen
+    @author Lloyd Weehuizen
  */
 
-class RMLUICORE_API ContextInstancer : public Releasable
-{
+class RMLUICORE_API ContextInstancer : public Releasable {
 public:
 	virtual ~ContextInstancer();
 

+ 10 - 10
Include/RmlUi/Core/ConvolutionFilter.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -42,14 +42,13 @@ enum class FilterOperation {
 };
 
 /**
-	A programmable convolution filter, designed to aid in the generation of texture data by custom
-	FontEffect types.
+    A programmable convolution filter, designed to aid in the generation of texture data by custom
+    FontEffect types.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API ConvolutionFilter
-{
+class RMLUICORE_API ConvolutionFilter {
 public:
 	ConvolutionFilter();
 	~ConvolutionFilter();
@@ -58,7 +57,8 @@ public:
 	bool Initialise(int kernel_radius, FilterOperation operation);
 
 	/// Initialises the filter. A filter must be initialised and populated with values before use.
-	/// @param[in] kernel_radii The size of the filter's kernel on each side of the origin along both axes. So, for example, a filter initialised with radii (1,1) will store 9 values.
+	/// @param[in] kernel_radii The size of the filter's kernel on each side of the origin along both axes. So, for example, a filter initialised with
+	/// radii (1,1) will store 9 values.
 	/// @param[in] operation The operation the filter conducts to determine the result.
 	bool Initialise(Vector2i kernel_radii, FilterOperation operation);
 
@@ -73,7 +73,8 @@ public:
 	/// @param[in] destination The RGBA-encoded destination buffer.
 	/// @param[in] destination_dimensions The size of the destination region (in pixels).
 	/// @param[in] destination_stride The stride (in bytes) of the destination region.
-	/// @param[in] destination_color_format Determines the representation of the bytes in the destination texture, only the alpha channel will be written to.
+	/// @param[in] destination_color_format Determines the representation of the bytes in the destination texture, only the alpha channel will be
+	/// written to.
 	/// @param[in] source The opacity information for the source buffer.
 	/// @param[in] source_dimensions The size of the source region (in pixels). The stride is assumed to be equivalent to the horizontal width.
 	/// @param[in] source_offset The offset of the source region from the destination region. This is usually the same as the kernel size.
@@ -90,4 +91,3 @@ private:
 
 } // namespace Rml
 #endif
-

+ 9 - 9
Include/RmlUi/Core/Core.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,10 +29,10 @@
 #ifndef RMLUI_CORE_CORE_H
 #define RMLUI_CORE_CORE_H
 
-#include "Header.h"
-#include "Types.h"
 #include "Event.h"
+#include "Header.h"
 #include "StyleTypes.h"
+#include "Types.h"
 
 namespace Rml {
 
@@ -44,11 +44,10 @@ class RenderInterface;
 class SystemInterface;
 enum class DefaultActionPhase;
 
-
 /**
-	RmlUi library core API.
+    RmlUi library core API.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
 /// Initialises RmlUi.
@@ -91,7 +90,7 @@ RMLUICORE_API FileInterface* GetFileInterface();
 RMLUICORE_API void SetFontEngineInterface(FontEngineInterface* font_interface);
 /// Returns RmlUi's font interface.
 RMLUICORE_API FontEngineInterface* GetFontEngineInterface();
-	
+
 /// Creates a new element context.
 /// @param[in] name The new name of the context. This must be unique.
 /// @param[in] dimensions The initial dimensions of the new context.
@@ -149,7 +148,8 @@ RMLUICORE_API void UnregisterPlugin(Plugin* plugin);
 /// @param[in] bubbles Whether the event executes the bubble phase. If false, only capture and target phase is executed.
 /// @param[in] default_action_phase Defines during which phase(s) the 'Element::ProcessDefaultAction' method is called.
 /// @return The EventId of the newly created type, or existing type if 'type' is an internal type.
-RMLUICORE_API EventId RegisterEventType(const String& type, bool interruptible, bool bubbles, DefaultActionPhase default_action_phase = DefaultActionPhase::None);
+RMLUICORE_API EventId RegisterEventType(const String& type, bool interruptible, bool bubbles,
+	DefaultActionPhase default_action_phase = DefaultActionPhase::None);
 
 /// Returns a list of source URLs to textures in all loaded documents.
 RMLUICORE_API StringList GetTextureSourceList();

+ 33 - 31
Include/RmlUi/Core/DataModelHandle.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -29,18 +29,17 @@
 #ifndef RMLUI_CORE_DATAMODELHANDLE_H
 #define RMLUI_CORE_DATAMODELHANDLE_H
 
+#include "DataStructHandle.h"
+#include "DataTypeRegister.h"
+#include "DataTypes.h"
 #include "Header.h"
-#include "Types.h"
 #include "Traits.h"
-#include "DataTypes.h"
-#include "DataTypeRegister.h"
-#include "DataStructHandle.h"
+#include "Types.h"
 
 namespace Rml {
 
 class DataModel;
 
-
 class RMLUICORE_API DataModelHandle {
 public:
 	DataModelHandle(DataModel* model = nullptr);
@@ -55,11 +54,10 @@ private:
 	DataModel* model;
 };
 
-
 class RMLUICORE_API DataModelConstructor {
 public:
-	template<typename T>
-	using DataEventMemberFunc = void(T::*)(DataModelHandle, Event&, const VariantList&);
+	template <typename T>
+	using DataEventMemberFunc = void (T::*)(DataModelHandle, Event&, const VariantList&);
 
 	DataModelConstructor();
 	explicit DataModelConstructor(DataModel* model);
@@ -69,12 +67,13 @@ public:
 
 	// Bind a data variable.
 	// @note For non-builtin types, make sure they first have been registered with the appropriate 'Register...()' functions.
-	template<typename T>
-	bool Bind(const String& name, T* ptr) {
+	template <typename T>
+	bool Bind(const String& name, T* ptr)
+	{
 		RMLUI_ASSERTMSG(ptr, "Invalid pointer to data variable");
 		return BindVariable(name, DataVariable(type_register->GetDefinition<T>(), static_cast<void*>(ptr)));
 	}
-	
+
 	// Bind a get/set function pair.
 	bool BindFunc(const String& name, DataGetFunc get_func, DataSetFunc set_func = {});
 
@@ -82,8 +81,9 @@ public:
 	bool BindEventCallback(const String& name, DataEventFunc event_func);
 
 	// Convenience wrapper around BindEventCallback for member functions.
-	template<typename T>
-	bool BindEventCallback(const String& name, DataEventMemberFunc<T> member_func, T* object_pointer) {
+	template <typename T>
+	bool BindEventCallback(const String& name, DataEventMemberFunc<T> member_func, T* object_pointer)
+	{
 		return BindEventCallback(name, [member_func, object_pointer](DataModelHandle handle, Event& event, const VariantList& arguments) {
 			(object_pointer->*member_func)(handle, event, arguments);
 		});
@@ -91,37 +91,39 @@ public:
 
 	// Bind a user-declared DataVariable.
 	// For advanced use cases, for example for binding variables to a custom 'VariableDefinition'.
-	bool BindCustomDataVariable(const String& name, DataVariable data_variable) {
-		return BindVariable(name, data_variable);
-	}
+	bool BindCustomDataVariable(const String& name, DataVariable data_variable) { return BindVariable(name, data_variable); }
 
 	// Register a scalar type with associated get and set functions.
-	// @note This registers a type which can later be used as a normal data variable, while 'BindFunc' registers a named data variable with a specific getter and setter.
+	// @note This registers a type which can later be used as a normal data variable, while 'BindFunc' registers a named data variable with a specific
+	// getter and setter.
 	// @note The type applies to every data model associated with the current Context.
-	template<typename T>
+	template <typename T>
 	bool RegisterScalar(DataTypeGetFunc<T> get_func, DataTypeSetFunc<T> set_func = {});
 
 	// Register a struct type.
 	// @note The type applies to every data model associated with the current Context.
 	// @return A handle which can be used to register struct members.
-	template<typename T>
+	template <typename T>
 	StructHandle<T> RegisterStruct();
 
 	// Register a user-declared VariableDefinition to describe a custom type behaviour.
-	template<typename T>
+	template <typename T>
 	bool RegisterCustomDataVariableDefinition(UniquePtr<VariableDefinition> definition);
 
 	// Register an array type.
 	// @note The type applies to every data model associated with the current Context.
-	// @note If 'Container::value_type' represents a non-scalar type, that type must already have been registered with the appropriate 'Register...()' functions.
-	// @note Container requires the following functions to be implemented: size() and begin(). This is satisfied by several containers including std::vector and std::array.
-	template<typename Container>
+	// @note If 'Container::value_type' represents a non-scalar type, that type must already have been registered with the appropriate 'Register...()'
+	// functions.
+	// @note Container requires the following functions to be implemented: size() and begin(). This is satisfied by several containers including
+	// std::vector and std::array.
+	template <typename Container>
 	bool RegisterArray();
 
 	// Register a transform function.
 	// A transform function modifies a variant with optional arguments. It can be called in data expressions using the pipe '|' operator.
 	// @note The transform function applies to every data model associated with the current Context.
-	void RegisterTransformFunc(const String& name, DataTransformFunc transform_func) {
+	void RegisterTransformFunc(const String& name, DataTransformFunc transform_func)
+	{
 		type_register->GetTransformFuncRegister()->Register(name, std::move(transform_func));
 	}
 
@@ -138,11 +140,11 @@ private:
 	DataTypeRegister* type_register;
 };
 
-
-template<typename T>
+template <typename T>
 inline bool DataModelConstructor::RegisterScalar(DataTypeGetFunc<T> get_func, DataTypeSetFunc<T> set_func)
 {
-	static_assert(!is_builtin_data_scalar<T>::value, "Cannot register scalar data type function. Arithmetic types and String are handled internally and does not need to be registered.");
+	static_assert(!is_builtin_data_scalar<T>::value,
+		"Cannot register scalar data type function. Arithmetic types and String are handled internally and does not need to be registered.");
 	const FamilyId id = Family<T>::Id();
 
 	auto scalar_func_definition = Rml::MakeUnique<ScalarFuncDefinition<T>>(get_func, set_func);
@@ -157,7 +159,7 @@ inline bool DataModelConstructor::RegisterScalar(DataTypeGetFunc<T> get_func, Da
 	return true;
 }
 
-template<typename T>
+template <typename T>
 inline bool DataModelConstructor::RegisterCustomDataVariableDefinition(UniquePtr<VariableDefinition> definition)
 {
 	const FamilyId id = Family<T>::Id();
@@ -172,7 +174,7 @@ inline bool DataModelConstructor::RegisterCustomDataVariableDefinition(UniquePtr
 	return true;
 }
 
-template<typename T>
+template <typename T>
 inline StructHandle<T> DataModelConstructor::RegisterStruct()
 {
 	static_assert(std::is_class<T>::value, "Type must be a struct or class type.");
@@ -191,7 +193,7 @@ inline StructHandle<T> DataModelConstructor::RegisterStruct()
 	return StructHandle<T>(type_register, struct_variable_raw);
 }
 
-template<typename Container>
+template <typename Container>
 inline bool DataModelConstructor::RegisterArray()
 {
 	using value_type = typename Container::value_type;

+ 54 - 51
Include/RmlUi/Core/DataStructHandle.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -29,19 +29,21 @@
 #ifndef RMLUI_CORE_DATASTRUCTHANDLE_H
 #define RMLUI_CORE_DATASTRUCTHANDLE_H
 
-#include "Header.h"
-#include "Types.h"
-#include "Traits.h"
+#include "DataTypeRegister.h"
 #include "DataTypes.h"
 #include "DataVariable.h"
-
+#include "Header.h"
+#include "Traits.h"
+#include "Types.h"
 
 namespace Rml {
 
-template<typename Object>
+template <typename Object>
 class StructHandle {
 public:
-	StructHandle(DataTypeRegister* type_register, StructDefinition* struct_definition) : type_register(type_register), struct_definition(struct_definition) {}
+	StructHandle(DataTypeRegister* type_register, StructDefinition* struct_definition) :
+		type_register(type_register), struct_definition(struct_definition)
+	{}
 
 	/// Register a member object.
 	/// @note Underlying type must be registered before it is used as a member.
@@ -53,7 +55,7 @@ public:
 	/// 	};
 	///		struct_handle.RegisterMember("health", &Invader::health);
 	template <typename MemberType>
-	bool RegisterMember(const String& name, MemberType Object::* member_object_ptr)
+	bool RegisterMember(const String& name, MemberType Object::*member_object_ptr)
 	{
 		return CreateMemberObjectDefinition(name, member_object_ptr);
 	}
@@ -69,7 +71,7 @@ public:
 	/// 	};
 	///		struct_handle.RegisterMember("weapons", &Invader::GetWeapons);
 	template <typename ReturnType>
-	bool RegisterMember(const String& name, ReturnType(Object::* member_get_func_ptr)())
+	bool RegisterMember(const String& name, ReturnType (Object::*member_get_func_ptr)())
 	{
 		return RegisterMemberGetter(name, member_get_func_ptr);
 	}
@@ -85,80 +87,80 @@ public:
 	/// 	};
 	///		struct_handle.RegisterMember("color", &Invader::GetColor, &Invader::SetColor);
 	template <typename ReturnType, typename AssignType>
-	bool RegisterMember(const String& name, ReturnType(Object::* member_get_func_ptr)(), void(Object::* member_set_func_ptr)(AssignType))
+	bool RegisterMember(const String& name, ReturnType (Object::*member_get_func_ptr)(), void (Object::*member_set_func_ptr)(AssignType))
 	{
 		using BasicReturnType = typename std::remove_reference<ReturnType>::type;
 		using BasicAssignType = typename std::remove_const<typename std::remove_reference<AssignType>::type>::type;
 		using UnderlyingType = typename std::conditional<IsVoidMemberFunc<ReturnType>::value, BasicAssignType, BasicReturnType>::type;
 
-		static_assert(IsVoidMemberFunc<ReturnType>::value || IsVoidMemberFunc<AssignType>::value || std::is_same<BasicReturnType, BasicAssignType>::value, "Provided getter and setter functions must get and set the same type.");
+		static_assert(IsVoidMemberFunc<ReturnType>::value || IsVoidMemberFunc<AssignType>::value ||
+				std::is_same<BasicReturnType, BasicAssignType>::value,
+			"Provided getter and setter functions must get and set the same type.");
 
 		return CreateMemberScalarGetSetFuncDefinition<UnderlyingType>(name, member_get_func_ptr, member_set_func_ptr);
 	}
 
-	explicit operator bool() const {
-		return type_register && struct_definition;
-	}
+	explicit operator bool() const { return type_register && struct_definition; }
 
 private:
-
 	// Member getter with reference return type.
 	template <typename ReturnType>
-	bool RegisterMemberGetter(const String& name, ReturnType& (Object::* member_get_func_ptr)()) {
+	bool RegisterMemberGetter(const String& name, ReturnType& (Object::*member_get_func_ptr)())
+	{
 		return CreateMemberGetFuncDefinition<ReturnType>(name, member_get_func_ptr);
 	}
 
 	// Member getter with pointer return type.
 	template <typename ReturnType>
-	bool RegisterMemberGetter(const String& name, ReturnType* (Object::* member_get_func_ptr)()) {
+	bool RegisterMemberGetter(const String& name, ReturnType* (Object::*member_get_func_ptr)())
+	{
 		return CreateMemberGetFuncDefinition<ReturnType>(name, member_get_func_ptr);
 	}
 
 	// Member getter with value return type, only valid for scalar return types.
 	template <typename ReturnType>
-	bool RegisterMemberGetter(const String& name, ReturnType (Object::* member_get_func_ptr)()) {
+	bool RegisterMemberGetter(const String& name, ReturnType (Object::*member_get_func_ptr)())
+	{
 		using SetType = VoidMemberFunc Object::*;
 		return CreateMemberScalarGetSetFuncDefinition<ReturnType>(name, member_get_func_ptr, SetType{});
 	}
 
-	template<typename MemberType>
-	bool CreateMemberObjectDefinition(const String& name, MemberType Object::* member_ptr);
+	template <typename MemberType>
+	bool CreateMemberObjectDefinition(const String& name, MemberType Object::*member_ptr);
 
-	template<typename BasicReturnType, typename MemberType>
-	bool CreateMemberGetFuncDefinition(const String& name, MemberType Object::* member_get_func_ptr);
+	template <typename BasicReturnType, typename MemberType>
+	bool CreateMemberGetFuncDefinition(const String& name, MemberType Object::*member_get_func_ptr);
 
-	template<typename UnderlyingType, typename MemberGetType, typename MemberSetType>
-	bool CreateMemberScalarGetSetFuncDefinition(const String& name, MemberGetType Object::* member_get_func_ptr, MemberSetType Object::* member_set_func_ptr);
+	template <typename UnderlyingType, typename MemberGetType, typename MemberSetType>
+	bool CreateMemberScalarGetSetFuncDefinition(const String& name, MemberGetType Object::*member_get_func_ptr,
+		MemberSetType Object::*member_set_func_ptr);
 
 	DataTypeRegister* type_register;
 	StructDefinition* struct_definition;
 };
 
-
-
-template<typename Object>
-template<typename MemberType>
-bool StructHandle<Object>::CreateMemberObjectDefinition(const String& name, MemberType Object::* member_ptr)
+template <typename Object>
+template <typename MemberType>
+bool StructHandle<Object>::CreateMemberObjectDefinition(const String& name, MemberType Object::*member_ptr)
 {
 	using MemberObjectPtr = MemberType Object::*;
 
-	// If the member function signature doesn't match the getter function signature, it will end up calling this function. Emit a compile error in that case.
-	static_assert(!std::is_member_function_pointer<MemberObjectPtr>::value, "Illegal data member getter function signature. Make sure it takes no arguments and is not const qualified.");
+	// If the member function signature doesn't match the getter function signature, it will end up calling this function. Emit a compile error in
+	// that case.
+	static_assert(!std::is_member_function_pointer<MemberObjectPtr>::value,
+		"Illegal data member getter function signature. Make sure it takes no arguments and is not const qualified.");
 	static_assert(!std::is_const<MemberType>::value, "Data member objects cannot be const qualified.");
 
 	VariableDefinition* underlying_definition = type_register->GetDefinition<MemberType>();
 	if (!underlying_definition)
 		return false;
-	struct_definition->AddMember(
-		name,
-		Rml::MakeUnique<MemberObjectDefinition<Object, MemberType>>(underlying_definition, member_ptr)
-	);
+	struct_definition->AddMember(name, Rml::MakeUnique<MemberObjectDefinition<Object, MemberType>>(underlying_definition, member_ptr));
 	return true;
 }
 
-template<typename Object>
-template<typename BasicReturnType, typename MemberType>
-bool StructHandle<Object>::CreateMemberGetFuncDefinition(const String& name, MemberType Object::* member_get_func_ptr)
+template <typename Object>
+template <typename BasicReturnType, typename MemberType>
+bool StructHandle<Object>::CreateMemberGetFuncDefinition(const String& name, MemberType Object::*member_get_func_ptr)
 {
 	static_assert(!std::is_const<BasicReturnType>::value, "Returned type from data member function cannot be const qualified.");
 
@@ -166,18 +168,18 @@ bool StructHandle<Object>::CreateMemberGetFuncDefinition(const String& name, Mem
 	if (!underlying_definition)
 		return false;
 
-	struct_definition->AddMember(
-		name,
-		Rml::MakeUnique<MemberGetFuncDefinition<Object, MemberType, BasicReturnType>>(underlying_definition, member_get_func_ptr)
-	);
+	struct_definition->AddMember(name,
+		Rml::MakeUnique<MemberGetFuncDefinition<Object, MemberType, BasicReturnType>>(underlying_definition, member_get_func_ptr));
 	return true;
 }
 
-template<typename Object>
-template<typename UnderlyingType, typename MemberGetType, typename MemberSetType>
-bool StructHandle<Object>::CreateMemberScalarGetSetFuncDefinition(const String& name, MemberGetType Object::* member_get_func_ptr, MemberSetType Object::* member_set_func_ptr)
+template <typename Object>
+template <typename UnderlyingType, typename MemberGetType, typename MemberSetType>
+bool StructHandle<Object>::CreateMemberScalarGetSetFuncDefinition(const String& name, MemberGetType Object::*member_get_func_ptr,
+	MemberSetType Object::*member_set_func_ptr)
 {
-	static_assert(std::is_default_constructible<UnderlyingType>::value, "Struct member getter/setter functions must return/assign a type that is default constructible.");
+	static_assert(std::is_default_constructible<UnderlyingType>::value,
+		"Struct member getter/setter functions must return/assign a type that is default constructible.");
 	static_assert(!std::is_const<UnderlyingType>::value, "Const qualified type illegal in data member getter functions.");
 
 	if (!IsVoidMemberFunc<MemberGetType>::value)
@@ -195,14 +197,15 @@ bool StructHandle<Object>::CreateMemberScalarGetSetFuncDefinition(const String&
 
 	if (underlying_definition->Type() != DataVariableType::Scalar)
 	{
-		RMLUI_LOG_TYPE_ERROR(UnderlyingType, "Only scalar data variables are allowed here. Data member functions require scalar types when returning by value, or using getter/setter function pairs.");
+		RMLUI_LOG_TYPE_ERROR(UnderlyingType,
+			"Only scalar data variables are allowed here. Data member functions require scalar types when returning by value, or using getter/setter "
+			"function pairs.");
 		return false;
 	}
 
-	struct_definition->AddMember(
-		name,
-		Rml::MakeUnique<MemberScalarGetSetFuncDefinition<Object, MemberGetType, MemberSetType, UnderlyingType>>(underlying_definition, member_get_func_ptr, member_set_func_ptr)
-	);
+	struct_definition->AddMember(name,
+		Rml::MakeUnique<MemberScalarGetSetFuncDefinition<Object, MemberGetType, MemberSetType, UnderlyingType>>(underlying_definition,
+			member_get_func_ptr, member_set_func_ptr));
 	return true;
 }
 

+ 16 - 20
Include/RmlUi/Core/DataTypeRegister.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -29,22 +29,19 @@
 #ifndef RMLUI_CORE_DATATYPEREGISTER_H
 #define RMLUI_CORE_DATATYPEREGISTER_H
 
-#include "Header.h"
-#include "Types.h"
-#include "Traits.h"
 #include "DataTypes.h"
 #include "DataVariable.h"
-
+#include "Header.h"
+#include "Traits.h"
+#include "Types.h"
 
 namespace Rml {
 
-template<typename T>
+template <typename T>
 struct is_builtin_data_scalar {
-	static constexpr bool value = std::is_arithmetic<T>::value
-		|| std::is_same<typename std::remove_const<T>::type, String>::value;
+	static constexpr bool value = std::is_arithmetic<T>::value || std::is_same<typename std::remove_const<T>::type, String>::value;
 };
 
-
 class RMLUICORE_API TransformFuncRegister {
 public:
 	void Register(const String& name, DataTransformFunc transform_func);
@@ -54,7 +51,6 @@ private:
 	UnorderedMap<String, DataTransformFunc> transform_functions;
 };
 
-
 class RMLUICORE_API DataTypeRegister final : NonCopyMoveable {
 public:
 	DataTypeRegister();
@@ -66,20 +62,18 @@ public:
 		return inserted;
 	}
 
-	template<typename T>
+	template <typename T>
 	VariableDefinition* GetDefinition()
 	{
 		return GetDefinitionDetail<T>();
 	}
 
-	inline TransformFuncRegister* GetTransformFuncRegister() {
-		return &transform_register;
-	}
+	inline TransformFuncRegister* GetTransformFuncRegister() { return &transform_register; }
 
 private:
 	// Get definition for scalar types that can be assigned to and from Rml::Variant.
 	// We automatically register these when needed, so users don't have to register trivial types manually.
-	template<typename T, typename std::enable_if<!PointerTraits<T>::is_pointer::value && is_builtin_data_scalar<T>::value, int>::type = 0>
+	template <typename T, typename std::enable_if<!PointerTraits<T>::is_pointer::value && is_builtin_data_scalar<T>::value, int>::type = 0>
 	VariableDefinition* GetDefinitionDetail()
 	{
 		static_assert(!std::is_const<T>::value, "Data binding variables cannot point to constant variables.");
@@ -97,14 +91,16 @@ private:
 
 	// Get definition for types that are not a built-in scalar.
 	// These must already have been registered by the user.
-	template<typename T, typename std::enable_if<!PointerTraits<T>::is_pointer::value && !is_builtin_data_scalar<T>::value, int>::type = 0>
+	template <typename T, typename std::enable_if<!PointerTraits<T>::is_pointer::value && !is_builtin_data_scalar<T>::value, int>::type = 0>
 	VariableDefinition* GetDefinitionDetail()
 	{
 		FamilyId id = Family<T>::Id();
 		auto it = type_register.find(id);
 		if (it == type_register.end())
 		{
-			RMLUI_LOG_TYPE_ERROR(T, "Desired data type T not registered with the type register, please use the 'Register...()' functions before binding values, adding members, or registering arrays of non-scalar types.");
+			RMLUI_LOG_TYPE_ERROR(T,
+				"Desired data type T not registered with the type register, please use the 'Register...()' functions before binding values, adding "
+				"members, or registering arrays of non-scalar types.");
 			return nullptr;
 		}
 
@@ -113,13 +109,14 @@ private:
 
 	// Get definition for pointer types, or create one as needed.
 	// This will create a wrapper definition that forwards the call to the definition of the underlying type.
-	template<typename T, typename std::enable_if<PointerTraits<T>::is_pointer::value, int>::type = 0>
+	template <typename T, typename std::enable_if<PointerTraits<T>::is_pointer::value, int>::type = 0>
 	VariableDefinition* GetDefinitionDetail()
 	{
 		static_assert(PointerTraits<T>::is_pointer::value, "Invalid pointer type provided.");
 
 		using UnderlyingType = typename PointerTraits<T>::element_type;
-		static_assert(!PointerTraits<UnderlyingType>::is_pointer::value, "Recursive pointer types (pointer to pointer) to data variables are disallowed.");
+		static_assert(!PointerTraits<UnderlyingType>::is_pointer::value,
+			"Recursive pointer types (pointer to pointer) to data variables are disallowed.");
 		static_assert(!std::is_const<UnderlyingType>::value, "Pointer to a const data variable is not supported.");
 
 		// Get the underlying definition.
@@ -147,6 +144,5 @@ private:
 	TransformFuncRegister transform_register;
 };
 
-
 } // namespace Rml
 #endif

+ 25 - 28
Include/RmlUi/Core/DataTypes.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -46,65 +46,62 @@ using DataSetFunc = Function<void(const Variant&)>;
 using DataTransformFunc = Function<Variant(const VariantList&)>;
 using DataEventFunc = Function<void(DataModelHandle, Event&, const VariantList&)>;
 
-template<typename T> using MemberGetFunc = void(T::*)(Variant&);
-template<typename T> using MemberSetFunc = void(T::*)(const Variant&);
+template <typename T>
+using MemberGetFunc = void (T::*)(Variant&);
+template <typename T>
+using MemberSetFunc = void (T::*)(const Variant&);
 
-template<typename T> using DataTypeGetFunc = void(*)(const T&, Variant&);
-template<typename T> using DataTypeSetFunc = void(*)(T&, const Variant&);
+template <typename T>
+using DataTypeGetFunc = void (*)(const T&, Variant&);
+template <typename T>
+using DataTypeSetFunc = void (*)(T&, const Variant&);
 
-template<typename Object, typename ReturnType> using MemberGetterFunc = ReturnType(Object::*)();
-template<typename Object, typename AssignType> using MemberSetterFunc = void(Object::*)(AssignType);
+template <typename Object, typename ReturnType>
+using MemberGetterFunc = ReturnType (Object::*)();
+template <typename Object, typename AssignType>
+using MemberSetterFunc = void (Object::*)(AssignType);
 
 using DirtyVariables = SmallUnorderedSet<String>;
 
 struct DataAddressEntry {
-	DataAddressEntry(String name) : name(std::move(name)), index(-1) { }
-	DataAddressEntry(int index) : index(index) { }
+	DataAddressEntry(String name) : name(std::move(name)), index(-1) {}
+	DataAddressEntry(int index) : index(index) {}
 	String name;
 	int index;
 };
 using DataAddress = Vector<DataAddressEntry>;
 
-template<class T>
+template <class T>
 struct PointerTraits {
 	using is_pointer = std::false_type;
 	using element_type = T;
-	static void* Dereference(void* ptr) {
-		return ptr;
-	}
+	static void* Dereference(void* ptr) { return ptr; }
 };
-template<class T>
+template <class T>
 struct PointerTraits<T*> {
 	using is_pointer = std::true_type;
 	using element_type = T;
-	static void* Dereference(void* ptr) {
-		return static_cast<void*>(*static_cast<T**>(ptr));
-	}
+	static void* Dereference(void* ptr) { return static_cast<void*>(*static_cast<T**>(ptr)); }
 };
-template<class T>
+template <class T>
 struct PointerTraits<UniquePtr<T>> {
 	using is_pointer = std::true_type;
 	using element_type = T;
-	static void* Dereference(void* ptr) {
-		return static_cast<void*>(static_cast<UniquePtr<T>*>(ptr)->get());
-	}
+	static void* Dereference(void* ptr) { return static_cast<void*>(static_cast<UniquePtr<T>*>(ptr)->get()); }
 };
-template<class T>
+template <class T>
 struct PointerTraits<SharedPtr<T>> {
 	using is_pointer = std::true_type;
 	using element_type = T;
-	static void* Dereference(void* ptr) {
-		return static_cast<void*>(static_cast<SharedPtr<T>*>(ptr)->get());
-	}
+	static void* Dereference(void* ptr) { return static_cast<void*>(static_cast<SharedPtr<T>*>(ptr)->get()); }
 };
 
 struct VoidMemberFunc {};
-template<typename T> using IsVoidMemberFunc = std::is_same<T, VoidMemberFunc>;
-
+template <typename T>
+using IsVoidMemberFunc = std::is_same<T, VoidMemberFunc>;
 
 #define RMLUI_LOG_TYPE_ERROR(T, msg) RMLUI_ERRORMSG((String(msg) + String("\nT: ") + String(rmlui_type_name<T>())).c_str())
 #define RMLUI_LOG_TYPE_ERROR_ASSERT(T, val, msg) RMLUI_ASSERTMSG((val), (String(msg) + String("\nT: ") + String(rmlui_type_name<T>())).c_str())
 
-
 } // namespace Rml
 #endif

+ 48 - 70
Include/RmlUi/Core/DataVariable.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -29,23 +29,22 @@
 #ifndef RMLUI_CORE_DATAVARIABLE_H
 #define RMLUI_CORE_DATAVARIABLE_H
 
+#include "DataTypes.h"
 #include "Header.h"
-#include "Types.h"
 #include "Traits.h"
+#include "Types.h"
 #include "Variant.h"
-#include "DataTypes.h"
 #include <iterator>
 
 namespace Rml {
 
 enum class DataVariableType { Scalar, Array, Struct };
 
-
 /*
-*   A 'DataVariable' wraps a user handle (pointer) and a VariableDefinition.
-*
-*   Together they can be used to get and set variables between the user side and data model side.
-*/
+ *   A 'DataVariable' wraps a user handle (pointer) and a VariableDefinition.
+ *
+ *   Together they can be used to get and set variables between the user side and data model side.
+ */
 
 class RMLUICORE_API DataVariable {
 public:
@@ -65,12 +64,11 @@ private:
 	void* ptr = nullptr;
 };
 
-
 /*
-*   A 'VariableDefinition' specifies how a user handle (pointer) is translated to and from a value in the data model.
-* 
-*   Generally, Scalar types can set and get values, while Array and Struct types can retrieve children based on data addresses.
-*/
+ *   A 'VariableDefinition' specifies how a user handle (pointer) is translated to and from a value in the data model.
+ *
+ *   Generally, Scalar types can set and get values, while Array and Struct types can retrieve children based on data addresses.
+ */
 
 class RMLUICORE_API VariableDefinition : public NonCopyMoveable {
 public:
@@ -93,8 +91,7 @@ private:
 // Literal data variable constructor
 RMLUICORE_API DataVariable MakeLiteralIntVariable(int value);
 
-
-template<typename T>
+template <typename T>
 class ScalarDefinition final : public VariableDefinition {
 public:
 	ScalarDefinition() : VariableDefinition(DataVariableType::Scalar) {}
@@ -104,13 +101,9 @@ public:
 		variant = *static_cast<const T*>(ptr);
 		return true;
 	}
-	bool Set(void* ptr, const Variant& variant) override
-	{
-		return variant.GetInto<T>(*static_cast<T*>(ptr));
-	}
+	bool Set(void* ptr, const Variant& variant) override { return variant.GetInto<T>(*static_cast<T*>(ptr)); }
 };
 
-
 class RMLUICORE_API FuncDefinition final : public VariableDefinition {
 public:
 	FuncDefinition(DataGetFunc get, DataSetFunc set);
@@ -123,8 +116,7 @@ private:
 	DataSetFunc set;
 };
 
-
-template<typename T>
+template <typename T>
 class ScalarFuncDefinition final : public VariableDefinition {
 public:
 	ScalarFuncDefinition(DataTypeGetFunc<T> get, DataTypeSetFunc<T> set) : VariableDefinition(DataVariableType::Scalar), get(get), set(set) {}
@@ -149,7 +141,6 @@ private:
 	DataTypeSetFunc<T> set;
 };
 
-
 class RMLUICORE_API StructDefinition final : public VariableDefinition {
 public:
 	StructDefinition();
@@ -162,15 +153,14 @@ private:
 	SmallUnorderedMap<String, UniquePtr<VariableDefinition>> members;
 };
 
-
-template<typename Container>
+template <typename Container>
 class ArrayDefinition final : public VariableDefinition {
 public:
-	ArrayDefinition(VariableDefinition* underlying_definition) : VariableDefinition(DataVariableType::Array) , underlying_definition(underlying_definition) {}
+	ArrayDefinition(VariableDefinition* underlying_definition) :
+		VariableDefinition(DataVariableType::Array), underlying_definition(underlying_definition)
+	{}
 
-	int Size(void* ptr) override {
-		return int(static_cast<Container*>(ptr)->size());
-	}
+	int Size(void* ptr) override { return int(static_cast<Container*>(ptr)->size()); }
 
 protected:
 	DataVariable Child(void* void_ptr, const DataAddressEntry& address) override
@@ -199,7 +189,6 @@ private:
 	VariableDefinition* underlying_definition;
 };
 
-
 class RMLUICORE_API BasePointerDefinition : public VariableDefinition {
 public:
 	BasePointerDefinition(VariableDefinition* underlying_definition);
@@ -216,79 +205,69 @@ private:
 	VariableDefinition* underlying_definition;
 };
 
-template<typename T>
+template <typename T>
 class PointerDefinition final : public BasePointerDefinition {
 public:
 	PointerDefinition(VariableDefinition* underlying_definition) : BasePointerDefinition(underlying_definition) {}
 
 protected:
-	void* DereferencePointer(void* ptr) override {
-		return PointerTraits<T>::Dereference(ptr);
-	}
+	void* DereferencePointer(void* ptr) override { return PointerTraits<T>::Dereference(ptr); }
 };
 
-template<typename Object, typename MemberType>
+template <typename Object, typename MemberType>
 class MemberObjectDefinition final : public BasePointerDefinition {
 public:
-	MemberObjectDefinition(VariableDefinition* underlying_definition, MemberType Object::* member_ptr) : BasePointerDefinition(underlying_definition), member_ptr(member_ptr) {}
+	MemberObjectDefinition(VariableDefinition* underlying_definition, MemberType Object::*member_ptr) :
+		BasePointerDefinition(underlying_definition), member_ptr(member_ptr)
+	{}
 
 protected:
-	void* DereferencePointer(void* base_ptr) override {
-		return &(static_cast<Object*>(base_ptr)->*member_ptr);
-	}
+	void* DereferencePointer(void* base_ptr) override { return &(static_cast<Object*>(base_ptr)->*member_ptr); }
 
 private:
-	MemberType Object::* member_ptr;
+	MemberType Object::*member_ptr;
 };
 
-
-template<typename Object, typename MemberType, typename BasicReturnType>
+template <typename Object, typename MemberType, typename BasicReturnType>
 class MemberGetFuncDefinition final : public BasePointerDefinition {
 public:
-
-	MemberGetFuncDefinition(VariableDefinition* underlying_definition, MemberType Object::* member_get_func_ptr)
-		: BasePointerDefinition(underlying_definition), member_get_func_ptr(member_get_func_ptr)
+	MemberGetFuncDefinition(VariableDefinition* underlying_definition, MemberType Object::*member_get_func_ptr) :
+		BasePointerDefinition(underlying_definition), member_get_func_ptr(member_get_func_ptr)
 	{}
 
 protected:
-	void* DereferencePointer(void* base_ptr) override {
+	void* DereferencePointer(void* base_ptr) override
+	{
 		return static_cast<void*>(Extract((static_cast<Object*>(base_ptr)->*member_get_func_ptr)()));
 	}
 
 private:
-	BasicReturnType* Extract(BasicReturnType* value) {
-		return value;
-	}
-	BasicReturnType* Extract(BasicReturnType& value) {
-		return &value;
-	}
+	BasicReturnType* Extract(BasicReturnType* value) { return value; }
+	BasicReturnType* Extract(BasicReturnType& value) { return &value; }
 
-	MemberType Object::* member_get_func_ptr;
+	MemberType Object::*member_get_func_ptr;
 };
 
-
-template<typename Object, typename MemberGetType, typename MemberSetType, typename UnderlyingType>
+template <typename Object, typename MemberGetType, typename MemberSetType, typename UnderlyingType>
 class MemberScalarGetSetFuncDefinition final : public VariableDefinition {
 public:
-	MemberScalarGetSetFuncDefinition(VariableDefinition* underlying_definition, MemberGetType Object::* member_get_func_ptr, MemberSetType Object::* member_set_func_ptr)
-		: VariableDefinition(underlying_definition->Type()), underlying_definition(underlying_definition), member_get_func_ptr(member_get_func_ptr), member_set_func_ptr(member_set_func_ptr)
+	MemberScalarGetSetFuncDefinition(VariableDefinition* underlying_definition, MemberGetType Object::*member_get_func_ptr,
+		MemberSetType Object::*member_set_func_ptr) :
+		VariableDefinition(underlying_definition->Type()),
+		underlying_definition(underlying_definition), member_get_func_ptr(member_get_func_ptr), member_set_func_ptr(member_set_func_ptr)
 	{}
 
-	bool Get(void* ptr, Variant& variant) override {
-		return GetDetail(ptr, variant);
-	}
-	bool Set(void* ptr, const Variant& variant) override {
-		return SetDetail(ptr, variant);
-	}
+	bool Get(void* ptr, Variant& variant) override { return GetDetail(ptr, variant); }
+	bool Set(void* ptr, const Variant& variant) override { return SetDetail(ptr, variant); }
 
 private:
-	template<typename T = MemberGetType, typename std::enable_if<IsVoidMemberFunc<T>::value, int>::type = 0>
+	template <typename T = MemberGetType, typename std::enable_if<IsVoidMemberFunc<T>::value, int>::type = 0>
 	bool GetDetail(void* /*ptr*/, Variant& /*variant*/)
 	{
 		return false;
 	}
 
-	template<typename T = MemberGetType, typename std::enable_if<!IsVoidMemberFunc<T>::value, int>::type = 0>
+	template <typename T = MemberGetType, typename std::enable_if<!IsVoidMemberFunc<T>::value, int>::type = 0>
 	bool GetDetail(void* ptr, Variant& variant)
 	{
 		RMLUI_ASSERT(member_get_func_ptr);
@@ -298,13 +277,13 @@ private:
 		return result;
 	}
 
-	template<typename T = MemberSetType, typename std::enable_if<IsVoidMemberFunc<T>::value, int>::type = 0>
+	template <typename T = MemberSetType, typename std::enable_if<IsVoidMemberFunc<T>::value, int>::type = 0>
 	bool SetDetail(void* /*ptr*/, const Variant& /*variant*/)
 	{
 		return false;
 	}
 
-	template<typename T = MemberSetType, typename std::enable_if<!IsVoidMemberFunc<T>::value, int>::type = 0>
+	template <typename T = MemberSetType, typename std::enable_if<!IsVoidMemberFunc<T>::value, int>::type = 0>
 	bool SetDetail(void* ptr, const Variant& variant)
 	{
 		RMLUI_ASSERT(member_set_func_ptr);
@@ -319,10 +298,9 @@ private:
 	}
 
 	VariableDefinition* underlying_definition;
-	MemberGetType Object::* member_get_func_ptr;
-	MemberSetType Object::* member_set_func_ptr;
+	MemberGetType Object::*member_get_func_ptr;
+	MemberSetType Object::*member_set_func_ptr;
 };
 
-
 } // namespace Rml
 #endif

+ 64 - 54
Include/RmlUi/Core/Debug.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -32,27 +32,38 @@
 #include "Header.h"
 
 // Define for breakpointing.
-#if defined (RMLUI_PLATFORM_WIN32)
-	#if defined (__MINGW32__)
-		#define RMLUI_BREAK {asm("int $0x03");}
-	#elif defined (_MSC_VER)
-		#define RMLUI_BREAK {__debugbreak();}
+#if defined(RMLUI_PLATFORM_WIN32)
+	#if defined(__MINGW32__)
+		#define RMLUI_BREAK       \
+			{                     \
+				asm("int $0x03"); \
+			}
+	#elif defined(_MSC_VER)
+		#define RMLUI_BREAK     \
+			{                   \
+				__debugbreak(); \
+			}
 	#else
 		#define RMLUI_BREAK
 	#endif
-#elif defined (RMLUI_PLATFORM_LINUX)
+#elif defined(RMLUI_PLATFORM_LINUX)
 	#if defined __GNUC__
-		#define RMLUI_BREAK {__builtin_trap();}
+		#define RMLUI_BREAK       \
+			{                     \
+				__builtin_trap(); \
+			}
 	#else
 		#define RMLUI_BREAK
 	#endif
-#elif defined (RMLUI_PLATFORM_MACOSX)
-	#define RMLUI_BREAK {__builtin_trap();}
+#elif defined(RMLUI_PLATFORM_MACOSX)
+	#define RMLUI_BREAK       \
+		{                     \
+			__builtin_trap(); \
+		}
 #else
 	#define RMLUI_BREAK
 #endif
 
-
 namespace Rml {
 
 bool RMLUICORE_API Assert(const char* message, const char* file, int line);
@@ -62,58 +73,57 @@ bool RMLUICORE_API Assert(const char* message, const char* file, int line);
 // Define the RmlUi assertion macros.
 #if !defined RMLUI_DEBUG
 
-#define RMLUI_ASSERT(x)
-#define RMLUI_ASSERTMSG(x, m)
-#define RMLUI_ERROR
-#define RMLUI_ERRORMSG(m)
-#define RMLUI_VERIFY(x) x
-#define RMLUI_ASSERT_NONRECURSIVE
+	#define RMLUI_ASSERT(x)
+	#define RMLUI_ASSERTMSG(x, m)
+	#define RMLUI_ERROR
+	#define RMLUI_ERRORMSG(m)
+	#define RMLUI_VERIFY(x) x
+	#define RMLUI_ASSERT_NONRECURSIVE
 
 #else
 
-#define RMLUI_ASSERT(x) \
-if (!(x)) \
-{ \
-	if (!(::Rml::Assert("RMLUI_ASSERT("#x")", __FILE__, __LINE__ ))) \
-	{ \
-		RMLUI_BREAK; \
-	} \
-}
-#define RMLUI_ASSERTMSG(x, m)	\
-if (!(x)) \
-{ \
-	if (!(::Rml::Assert(m, __FILE__, __LINE__ ))) \
-	{ \
-		RMLUI_BREAK; \
-	} \
-}
-#define RMLUI_ERROR \
-if (!(::Rml::Assert("RMLUI_ERROR", __FILE__, __LINE__))) \
-{ \
-	RMLUI_BREAK; \
-}
-#define RMLUI_ERRORMSG(m) \
-if (!(::Rml::Assert(m, __FILE__, __LINE__))) \
-{ \
-	RMLUI_BREAK; \
-}
-#define RMLUI_VERIFY(x) RMLUI_ASSERT(x)
+	#define RMLUI_ASSERT(x)                                                   \
+		if (!(x))                                                             \
+		{                                                                     \
+			if (!(::Rml::Assert("RMLUI_ASSERT(" #x ")", __FILE__, __LINE__))) \
+			{                                                                 \
+				RMLUI_BREAK;                                                  \
+			}                                                                 \
+		}
+	#define RMLUI_ASSERTMSG(x, m)                        \
+		if (!(x))                                        \
+		{                                                \
+			if (!(::Rml::Assert(m, __FILE__, __LINE__))) \
+			{                                            \
+				RMLUI_BREAK;                             \
+			}                                            \
+		}
+	#define RMLUI_ERROR                                          \
+		if (!(::Rml::Assert("RMLUI_ERROR", __FILE__, __LINE__))) \
+		{                                                        \
+			RMLUI_BREAK;                                         \
+		}
+	#define RMLUI_ERRORMSG(m)                        \
+		if (!(::Rml::Assert(m, __FILE__, __LINE__))) \
+		{                                            \
+			RMLUI_BREAK;                             \
+		}
+	#define RMLUI_VERIFY(x) RMLUI_ASSERT(x)
 
 struct RmlUiAssertNonrecursive {
 	bool& entered;
-	RmlUiAssertNonrecursive(bool& entered) : entered(entered) {
+	RmlUiAssertNonrecursive(bool& entered) : entered(entered)
+	{
 		RMLUI_ASSERTMSG(!entered, "A method defined as non-recursive was entered twice!");
 		entered = true;
 	}
-	~RmlUiAssertNonrecursive() {
-		entered = false;
-	}
+	~RmlUiAssertNonrecursive() { entered = false; }
 };
 
-#define RMLUI_ASSERT_NONRECURSIVE \
-static bool rmlui_nonrecursive_entered = false; \
-RmlUiAssertNonrecursive rmlui_nonrecursive(rmlui_nonrecursive_entered)
+	#define RMLUI_ASSERT_NONRECURSIVE                   \
+		static bool rmlui_nonrecursive_entered = false; \
+		RmlUiAssertNonrecursive rmlui_nonrecursive(rmlui_nonrecursive_entered)
 
-#endif  // RMLUI_DEBUG
+#endif // RMLUI_DEBUG
 
-#endif  // RMLUI_CORE_DEBUG_H
+#endif // RMLUI_CORE_DEBUG_H

+ 6 - 7
Include/RmlUi/Core/Decorator.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -42,13 +42,12 @@ class Property;
 struct Texture;
 
 /**
-	The abstract base class for any visual object that can be attached to any element.
+    The abstract base class for any visual object that can be attached to any element.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API Decorator
-{
+class RMLUICORE_API Decorator {
 public:
 	Decorator();
 	virtual ~Decorator();
@@ -85,7 +84,7 @@ private:
 	// Stores a list of textures in use by this decorator.
 	// Optimized for the common case of a single texture.
 	Texture first_texture;
-	Vector< Texture > additional_textures;
+	Vector<Texture> additional_textures;
 };
 
 } // namespace Rml

+ 14 - 12
Include/RmlUi/Core/DecoratorInstancer.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -43,16 +43,15 @@ class DecoratorInstancerInterface;
 class PropertyDefinition;
 
 /**
-	An element instancer provides a method for allocating and deallocating decorators.
+    An element instancer provides a method for allocating and deallocating decorators.
 
-	It is important at the same instancer that allocated a decorator releases it. This ensures there are no issues with
-	memory from different DLLs getting mixed up.
+    It is important at the same instancer that allocated a decorator releases it. This ensures there are no issues with
+    memory from different DLLs getting mixed up.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API DecoratorInstancer
-{
+class RMLUICORE_API DecoratorInstancer {
 public:
 	DecoratorInstancer();
 	virtual ~DecoratorInstancer();
@@ -62,7 +61,8 @@ public:
 	/// @param[in] properties All RCSS properties associated with the decorator.
 	/// @param[in] instancer_interface An interface for querying the active style sheet.
 	/// @return A shared_ptr to the decorator if it was instanced successfully.
-	virtual SharedPtr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const DecoratorInstancerInterface& instancer_interface) = 0;
+	virtual SharedPtr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties,
+		const DecoratorInstancerInterface& instancer_interface) = 0;
 
 	/// Returns the property specification associated with the instancer.
 	const PropertySpecification& GetPropertySpecification() const;
@@ -75,7 +75,8 @@ protected:
 	PropertyDefinition& RegisterProperty(const String& property_name, const String& default_value);
 	/// Registers a shorthand property definition. Specify a shorthand name of 'decorator' to parse anonymous decorators.
 	/// @param[in] shorthand_name The name to register the new shorthand property under.
-	/// @param[in] properties A comma-separated list of the properties this definition is shorthand for. The order in which they are specified here is the order in which the values will be processed.
+	/// @param[in] properties A comma-separated list of the properties this definition is shorthand for. The order in which they are specified here is
+	/// the order in which the values will be processed.
 	/// @param[in] type The type of shorthand to declare.
 	/// @param True if all the property names exist, false otherwise.
 	ShorthandId RegisterShorthand(const String& shorthand_name, const String& property_names, ShorthandType type);
@@ -84,10 +85,11 @@ private:
 	PropertySpecification properties;
 };
 
-
 class RMLUICORE_API DecoratorInstancerInterface {
 public:
-	DecoratorInstancerInterface(const StyleSheet& style_sheet, const PropertySource* property_source) : style_sheet(style_sheet), property_source(property_source) {}
+	DecoratorInstancerInterface(const StyleSheet& style_sheet, const PropertySource* property_source) :
+		style_sheet(style_sheet), property_source(property_source)
+	{}
 
 	/// Get a sprite from any @spritesheet in the style sheet the decorator is being instanced on.
 	const Sprite* GetSprite(const String& name) const;

+ 3 - 3
Include/RmlUi/Core/Dictionary.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -48,7 +48,7 @@ inline const Variant* GetIf(const Dictionary& dictionary, const String& key)
 		return &(it->second);
 	return nullptr;
 }
-template<typename T>
+template <typename T>
 inline T Get(const Dictionary& dictionary, const String& key, const T& default_value)
 {
 	T result = default_value;

+ 31 - 29
Include/RmlUi/Core/Element.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -68,13 +68,12 @@ struct ElementMeta;
 struct StackingContextChild;
 
 /**
-	A generic element in the DOM tree.
+    A generic element in the DOM tree.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API Element : public ScriptInterface, public EnableObserverPtr<Element>
-{
+class RMLUICORE_API Element : public ScriptInterface, public EnableObserverPtr<Element> {
 public:
 	RMLUI_RTTI_DefineWithParent(Element, ScriptInterface)
 
@@ -207,16 +206,16 @@ public:
 	/// @param[in] name The name of the local property definition to remove.
 	void RemoveProperty(const String& name);
 	void RemoveProperty(PropertyId id);
-	/// Returns one of this element's properties. If the property is not defined for this element and not inherited 
+	/// Returns one of this element's properties. If the property is not defined for this element and not inherited
 	/// from an ancestor, the default value will be returned.
 	/// @param[in] name The name of the property to fetch the value for.
 	/// @return The value of this property for this element, or nullptr if no property exists with the given name.
-	const Property* GetProperty(const String& name);		
-	const Property* GetProperty(PropertyId id);		
-	/// Returns the values of one of this element's properties.		
+	const Property* GetProperty(const String& name);
+	const Property* GetProperty(PropertyId id);
+	/// Returns the values of one of this element's properties.
 	/// @param[in] name The name of the property to get.
 	/// @return The value of this property.
-	template < typename T >
+	template <typename T>
 	T GetProperty(const String& name);
 	/// Returns one of this element's properties. If this element is not defined this property, nullptr will be
 	/// returned.
@@ -233,7 +232,7 @@ public:
 	/// @param[in] property The property to resolve the value for.
 	/// @param[in] base_value The value that is scaled by the number or percentage value, if applicable.
 	/// @return The resolved value in their canonical unit, or zero if it could not be resolved.
-	float ResolveNumericProperty(const Property *property, float base_value);
+	float ResolveNumericProperty(const Property* property, float base_value);
 	/// Resolves a property with units of number, percentage, length, or angle to their canonical unit (unit-less, 'px', or 'rad').
 	/// Numbers and percentages are scaled according to the relative target of the property definition.
 	/// @param[in] name The property to resolve the value for.
@@ -260,13 +259,14 @@ public:
 	/// If an animation of the same property name exists, it will be replaced.
 	/// If start_value is null, the current property value on this element is used.
 	/// @return True if a new animation was added.
-	bool Animate(const String& property_name, const Property& target_value, float duration, Tween tween = Tween{}, int num_iterations = 1, bool alternate_direction = true, float delay = 0.0f, const Property* start_value = nullptr);
+	bool Animate(const String& property_name, const Property& target_value, float duration, Tween tween = Tween{}, int num_iterations = 1,
+		bool alternate_direction = true, float delay = 0.0f, const Property* start_value = nullptr);
 
 	/// Add a key to an animation, extending its duration.
 	/// If no animation exists for the given property name, the call will be ignored.
 	/// @return True if a new animation key was added.
 	bool AddAnimationKey(const String& property_name, const Property& target_value, float duration, Tween tween = Tween{});
-	
+
 	/// Iterator for the local (non-inherited) properties defined on this element.
 	/// @warning Modifying the element's properties or classes invalidates the iterator.
 	/// @return Iterator to the first property defined on this element.
@@ -299,7 +299,7 @@ public:
 	/// Sets an attribute on the element.
 	/// @param[in] name Name of the attribute.
 	/// @param[in] value Value of the attribute.
-	template< typename T >
+	template <typename T>
 	void SetAttribute(const String& name, const T& value);
 	/// Gets the specified attribute.
 	/// @param[in] name Name of the attribute to retrieve.
@@ -310,7 +310,7 @@ public:
 	/// Gets the specified attribute, with default value.
 	/// @param[in] name Name of the attribute to retrieve.
 	/// @param[in] default_value Value to return if the attribute doesn't exist.
-	template< typename T >
+	template <typename T>
 	T GetAttribute(const String& name, const T& default_value) const;
 	/// Checks if the element has a certain attribute.
 	/// @param[in] name The name of the attribute to check for.
@@ -447,7 +447,8 @@ public:
 	/// @return The child element at the given index.
 	Element* GetChild(int index) const;
 	/// Get the current number of children in this element
-	/// @param[in] include_non_dom_elements True if the caller wants to include the non DOM children. Only set this to true if you know what you're doing!
+	/// @param[in] include_non_dom_elements True if the caller wants to include the non DOM children. Only set this to true if you know what you're
+	/// doing!
 	/// @return The number of children.
 	int GetNumChildren(bool include_non_dom_elements = false) const;
 
@@ -507,7 +508,8 @@ public:
 	/// @param[in] options Scroll parameters that control desired element alignment relative to the parent.
 	void ScrollIntoView(ScrollIntoViewOptions options);
 	/// Scrolls the parent element's contents so that this element is visible.
-	/// @param[in] align_with_top If true, the element will align itself to the top of the parent element's window. If false, the element will be aligned to the bottom of the parent element's window.
+	/// @param[in] align_with_top If true, the element will align itself to the top of the parent element's window. If false, the element will be
+	/// aligned to the bottom of the parent element's window.
 	void ScrollIntoView(bool align_with_top = true);
 	/// Sets the scroll offset of this element to the given coordinates.
 	/// @param[in] position The scroll destination coordinates.
@@ -560,11 +562,10 @@ public:
 	/// @performance Prefer GetElementById/TagName/ClassName whenever possible.
 	void QuerySelectorAll(ElementList& elements, const String& selectors);
 
-
 	//@}
 
 	/**
-		@name Internal Functions
+	    @name Internal Functions
 	 */
 	//@{
 	/// Access the event dispatcher for this element.
@@ -582,7 +583,7 @@ public:
 	/// Returns the data model of this element.
 	DataModel* GetDataModel() const;
 	//@}
-	
+
 	/// Gets the render interface owned by this element's context.
 	/// @return The element's context's render interface.
 	RenderInterface* GetRenderInterface();
@@ -667,7 +668,7 @@ protected:
 
 private:
 	void SetParent(Element* parent);
-	
+
 	void SetDataModel(DataModel* new_data_model);
 
 	void DirtyAbsoluteOffset();
@@ -689,10 +690,11 @@ private:
 	void DirtyFontFaceRecursive();
 
 	/// Start an animation, replacing any existing animations of the same property name. If start_value is null, the element's current value is used.
-	ElementAnimationList::iterator StartAnimation(PropertyId property_id, const Property * start_value, int num_iterations, bool alternate_direction, float delay, bool initiated_by_animation_property);
+	ElementAnimationList::iterator StartAnimation(PropertyId property_id, const Property* start_value, int num_iterations, bool alternate_direction,
+		float delay, bool initiated_by_animation_property);
 
 	/// Add a key to an animation, extending its duration. If target_value is null, the element's current value is used.
-	bool AddAnimationKeyTime(PropertyId property_id, const Property * target_value, float time, Tween tween);
+	bool AddAnimationKeyTime(PropertyId property_id, const Property* target_value, float time, Tween tween);
 
 	/// Start a transition of the given property on this element.
 	/// If an animation exists for the property, the call will be ignored. If a transition exists for this property, it will be replaced.
@@ -756,8 +758,8 @@ private:
 
 	// The offset of the element, and the element it is offset from.
 	Element* offset_parent;
-	Vector2f relative_offset_base;		// the base offset from the parent
-	Vector2f relative_offset_position;	// the offset of a relatively positioned element
+	Vector2f relative_offset_base;     // the base offset from the parent
+	Vector2f relative_offset_position; // the offset of a relatively positioned element
 
 	Vector2f absolute_offset;
 
@@ -769,7 +771,7 @@ private:
 		Box box;
 		Vector2f offset;
 	};
-	using PositionedBoxList = Vector< PositionedBox >;
+	using PositionedBoxList = Vector<PositionedBox>;
 	Box main_box;
 	PositionedBoxList additional_boxes;
 
@@ -780,8 +782,8 @@ private:
 	float z_index;
 
 	ElementList stacking_context;
-	
-	UniquePtr< TransformState > transform_state;
+
+	UniquePtr<TransformState> transform_state;
 
 	ElementAnimationList animations;
 

+ 8 - 8
Include/RmlUi/Core/Element.inl

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,7 +29,7 @@
 namespace Rml {
 
 // Returns the values of one of this element's properties.
-template < typename T >
+template <typename T>
 T Element::GetProperty(const String& name)
 {
 	const Property* property = GetProperty(name);
@@ -38,22 +38,22 @@ T Element::GetProperty(const String& name)
 		Log::Message(Log::LT_WARNING, "Invalid property name %s.", name.c_str());
 		return T{};
 	}
-	return property->Get< T >();
+	return property->Get<T>();
 }
 
 // Sets an attribute on the element.
-template< typename T >
+template <typename T>
 void Element::SetAttribute(const String& name, const T& value)
 {
 	Variant variant(value);
 	attributes[name] = variant;
-    ElementAttributes changed_attributes;
-    changed_attributes.emplace(name, std::move(variant));
+	ElementAttributes changed_attributes;
+	changed_attributes.emplace(name, std::move(variant));
 	OnAttributeChange(changed_attributes);
 }
 
 // Gets the specified attribute, with default value.
-template< typename T >
+template <typename T>
 T Element::GetAttribute(const String& name, const T& default_value) const
 {
 	return Get(attributes, name, default_value);

+ 17 - 20
Include/RmlUi/Core/ElementDocument.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -41,29 +41,27 @@ class StyleSheet;
 class StyleSheetContainer;
 
 /**
-	 ModalFlag used for controlling the modal state of the document.
-		None:  Remove modal state.
-		Modal: Set modal state, other documents cannot receive focus.
-		Keep:  Modal state unchanged.
-
-	FocusFlag used for displaying the document.
-		None:     No focus.
-		Document: Focus the document.
-		Keep:     Focus the element in the document which last had focus.
-		Auto:     Focus the first tab element with the 'autofocus' attribute or else the document.
+     ModalFlag used for controlling the modal state of the document.
+        None:  Remove modal state.
+        Modal: Set modal state, other documents cannot receive focus.
+        Keep:  Modal state unchanged.
+
+    FocusFlag used for displaying the document.
+        None:     No focus.
+        Document: Focus the document.
+        Keep:     Focus the element in the document which last had focus.
+        Auto:     Focus the first tab element with the 'autofocus' attribute or else the document.
 */
 enum class ModalFlag { None, Modal, Keep };
 enum class FocusFlag { None, Document, Keep, Auto };
 
-
 /**
-	Represents a document in the dom tree.
+    Represents a document in the dom tree.
 
-	@author Lloyd Weehuizen
+    @author Lloyd Weehuizen
  */
 
-class RMLUICORE_API ElementDocument : public Element
-{
+class RMLUICORE_API ElementDocument : public Element {
 public:
 	RMLUI_RTTI_DefineWithParent(ElementDocument, Element)
 
@@ -135,11 +133,11 @@ public:
 	/// @param[in] source_path The script file path.
 	virtual void LoadExternalScript(const String& source_path);
 
-	/// Updates the document, including its layout. Users must call this manually before requesting information such as 
+	/// Updates the document, including its layout. Users must call this manually before requesting information such as
 	/// size or position of an element if any element in the document was recently changed, unless Context::Update has
 	/// already been called after the change. This has a perfomance penalty, only call when necessary.
 	void UpdateDocument();
-	
+
 protected:
 	/// Repositions the document if necessary.
 	void OnPropertyChange(const PropertyIdSet& changed_properties) override;
@@ -196,7 +194,6 @@ private:
 
 	friend class Rml::Context;
 	friend class Rml::Factory;
-
 };
 
 } // namespace Rml

+ 28 - 37
Include/RmlUi/Core/ElementInstancer.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,33 +29,32 @@
 #ifndef RMLUI_CORE_ELEMENTINSTANCER_H
 #define RMLUI_CORE_ELEMENTINSTANCER_H
 
-#include "Traits.h"
-#include "Types.h"
-#include "Header.h"
 #include "Element.h"
+#include "Header.h"
 #include "Profiling.h"
+#include "Traits.h"
+#include "Types.h"
 
 namespace Rml {
 
 class Element;
 
 /**
-	An element instancer provides a method for allocating
-	and deallocating elements.
+    An element instancer provides a method for allocating
+    and deallocating elements.
 
-	It is important at the same instancer that allocated
-	the element releases it. This ensures there are no
-	issues with memory from different DLLs getting mixed up.
+    It is important at the same instancer that allocated
+    the element releases it. This ensures there are no
+    issues with memory from different DLLs getting mixed up.
 
-	The returned element is a unique pointer. When this is
-	destroyed, it will call	ReleaseElement on the instancer 
-	in which it was instanced.
+    The returned element is a unique pointer. When this is
+    destroyed, it will call	ReleaseElement on the instancer
+    in which it was instanced.
 
-	@author Lloyd Weehuizen
- */ 
+    @author Lloyd Weehuizen
+ */
 
-class RMLUICORE_API ElementInstancer : public NonCopyMoveable
-{
+class RMLUICORE_API ElementInstancer : public NonCopyMoveable {
 public:
 	virtual ~ElementInstancer();
 
@@ -70,16 +69,13 @@ public:
 	virtual void ReleaseElement(Element* element) = 0;
 };
 
-
-
 /**
-	The element instancer constructs a plain Element, and is used for most elements.
-	This is a slightly faster version of the generic instancer, making use of a memory
-	pool for allocations.
+    The element instancer constructs a plain Element, and is used for most elements.
+    This is a slightly faster version of the generic instancer, making use of a memory
+    pool for allocations.
  */
 
-class RMLUICORE_API ElementInstancerElement : public ElementInstancer
-{
+class RMLUICORE_API ElementInstancerElement : public ElementInstancer {
 public:
 	ElementPtr InstanceElement(Element* parent, const String& tag, const XMLAttributes& attributes) override;
 	void ReleaseElement(Element* element) override;
@@ -87,34 +83,29 @@ public:
 };
 
 /**
-	The element text instancer constructs ElementText.
-	This is a slightly faster version of the generic instancer, making use of a memory
-	pool for allocations.
+    The element text instancer constructs ElementText.
+    This is a slightly faster version of the generic instancer, making use of a memory
+    pool for allocations.
  */
 
-class RMLUICORE_API ElementInstancerText : public ElementInstancer
-{
+class RMLUICORE_API ElementInstancerText : public ElementInstancer {
 public:
 	ElementPtr InstanceElement(Element* parent, const String& tag, const XMLAttributes& attributes) override;
 	void ReleaseElement(Element* element) override;
 };
 
-
 /**
-	Generic Instancer that creates the provided element type using new and delete. This instancer
-	is typically used for specialized element types.
+    Generic Instancer that creates the provided element type using new and delete. This instancer
+    is typically used for specialized element types.
  */
 
 template <typename T>
-class ElementInstancerGeneric : public ElementInstancer
-{
+class ElementInstancerGeneric : public ElementInstancer {
 public:
 	virtual ~ElementInstancerGeneric() {}
 
-	ElementPtr InstanceElement(Element* RMLUI_UNUSED_PARAMETER(parent), const String& tag, const XMLAttributes& RMLUI_UNUSED_PARAMETER(attributes)) override
+	ElementPtr InstanceElement(Element* /*parent*/, const String& tag, const XMLAttributes& /*attributes*/) override
 	{
-		RMLUI_UNUSED(parent);
-		RMLUI_UNUSED(attributes);
 		RMLUI_ZoneScopedN("ElementGenericInstance");
 		return ElementPtr(new T(tag));
 	}

+ 7 - 13
Include/RmlUi/Core/ElementScroll.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -38,19 +38,14 @@ class Element;
 class WidgetScroll;
 
 /**
-	Manages an element's scrollbars and scrolling state.
+    Manages an element's scrollbars and scrolling state.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API ElementScroll
-{
+class RMLUICORE_API ElementScroll {
 public:
-	enum Orientation
-	{
-		VERTICAL = 0,
-		HORIZONTAL = 1
-	};
+	enum Orientation { VERTICAL = 0, HORIZONTAL = 1 };
 
 	ElementScroll(Element* element);
 	~ElementScroll();
@@ -83,8 +78,7 @@ public:
 	void FormatScrollbars();
 
 private:
-	struct Scrollbar
-	{
+	struct Scrollbar {
 		Scrollbar();
 		~Scrollbar();
 

+ 14 - 13
Include/RmlUi/Core/ElementText.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,18 +29,17 @@
 #ifndef RMLUI_CORE_ELEMENTTEXT_H
 #define RMLUI_CORE_ELEMENTTEXT_H
 
-#include "Header.h"
 #include "Element.h"
 #include "Geometry.h"
+#include "Header.h"
 
 namespace Rml {
 
 /**
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API ElementText final : public Element
-{
+class RMLUICORE_API ElementText final : public Element {
 public:
 	RMLUI_RTTI_DefineWithParent(ElementText, Element)
 
@@ -54,12 +53,15 @@ public:
 
 	/// Generates a line of text rendered from this element.
 	/// @param[out] line The characters making up the line, with white-space characters collapsed and endlines processed appropriately.
-	/// @param[out] line_length The number of characters from the source string consumed making up this string; this may very well be different from line.size()!
+	/// @param[out] line_length The number of characters from the source string consumed making up this string; this may very well be different from
+	/// line.size()!
 	/// @param[out] line_width The width (in pixels) of the generated line.
 	/// @param[in] line_begin The index of the first character to be rendered in the line.
 	/// @param[in] maximum_line_width The width (in pixels) of space allowed for the line, or -1 for unlimited space.
-	/// @param[in] right_spacing_width The width (in pixels) of the spacing (consisting of margins, padding, etc) that must be remaining on the right of the line if the last of the text is rendered onto this line.
-	/// @param[in] trim_whitespace_prefix If we're collapsing whitespace, whether or not to remove all prefixing whitespace or collapse it down to a single space.
+	/// @param[in] right_spacing_width The width (in pixels) of the spacing (consisting of margins, padding, etc) that must be remaining on the right
+	/// of the line if the last of the text is rendered onto this line.
+	/// @param[in] trim_whitespace_prefix If we're collapsing whitespace, whether or not to remove all prefixing whitespace or collapse it down to a
+	/// single space.
 	/// @param[in] decode_escape_characters Decode escaped characters such as &amp; into &.
 	/// @param[in] allow_empty Allow no tokens to be consumed from the line.
 	/// @return True if the line reached the end of the element's text, false if not.
@@ -88,8 +90,7 @@ private:
 	bool UpdateFontEffects();
 
 	// Used to store the position and length of each line we have geometry for.
-	struct Line
-	{
+	struct Line {
 		Line(String text, Vector2f position) : text(std::move(text)), position(position), width(0) {}
 		String text;
 		Vector2f position;
@@ -105,7 +106,7 @@ private:
 
 	String text;
 
-	using LineList = Vector< Line >;
+	using LineList = Vector<Line>;
 	LineList lines;
 
 	GeometryList geometry;
@@ -121,7 +122,7 @@ private:
 	bool geometry_dirty : 1;
 
 	bool dirty_layout_on_change : 1;
-	
+
 	// What the decoration type is that we have generated.
 	Style::TextDecoration generated_decoration;
 	// What the element's actual text-decoration property is; this may be different from the generated decoration

+ 9 - 9
Include/RmlUi/Core/ElementUtilities.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -37,19 +37,19 @@ namespace Rml {
 class Box;
 class Context;
 class RenderInterface;
-namespace Style { class ComputedValues; }
+namespace Style {
+	class ComputedValues;
+}
 
 /**
-	Utility functions for dealing with elements.
+    Utility functions for dealing with elements.
 
-	@author Lloyd Weehuizen
+    @author Lloyd Weehuizen
  */
 
-class RMLUICORE_API ElementUtilities
-{
+class RMLUICORE_API ElementUtilities {
 public:
-	enum PositionAnchor
-	{
+	enum PositionAnchor {
 		TOP = 1 << 0,
 		BOTTOM = 1 << 1,
 		LEFT = 1 << 2,

+ 5 - 6
Include/RmlUi/Core/Elements/ElementForm.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -35,13 +35,12 @@
 namespace Rml {
 
 /**
-	A specialisation of the generic Element representing a form element.
+    A specialisation of the generic Element representing a form element.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API ElementForm : public Element
-{
+class RMLUICORE_API ElementForm : public Element {
 public:
 	RMLUI_RTTI_DefineWithParent(ElementForm, Element)
 

+ 5 - 6
Include/RmlUi/Core/Elements/ElementFormControl.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -35,13 +35,12 @@
 namespace Rml {
 
 /**
-	A generic specialisation of the generic Element for all input controls.
+    A generic specialisation of the generic Element for all input controls.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API ElementFormControl : public Element
-{
+class RMLUICORE_API ElementFormControl : public Element {
 public:
 	RMLUI_RTTI_DefineWithParent(ElementFormControl, Element)
 

+ 5 - 6
Include/RmlUi/Core/Elements/ElementFormControlInput.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -37,13 +37,12 @@ namespace Rml {
 class InputType;
 
 /**
-	A form control for the generic input element. All functionality is handled through an input type interface.
+    A form control for the generic input element. All functionality is handled through an input type interface.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API ElementFormControlInput : public ElementFormControl
-{
+class RMLUICORE_API ElementFormControlInput : public ElementFormControl {
 public:
 	RMLUI_RTTI_DefineWithParent(ElementFormControlInput, ElementFormControl)
 

+ 10 - 9
Include/RmlUi/Core/Elements/ElementFormControlSelect.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -37,13 +37,12 @@ namespace Rml {
 class WidgetDropDown;
 
 /**
-	A drop-down select form control.
+    A drop-down select form control.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API ElementFormControlSelect : public ElementFormControl
-{
+class RMLUICORE_API ElementFormControlSelect : public ElementFormControl {
 public:
 	RMLUI_RTTI_DefineWithParent(ElementFormControlSelect, ElementFormControl)
 
@@ -78,7 +77,8 @@ public:
 	/// Adds a new option to the select control.
 	/// @param[in] rml The RML content used to represent the option. This is usually a simple string, but can include RML tags.
 	/// @param[in] value The value of the option. This is used to identify the option, but does not necessarily need to be unique.
-	/// @param[in] before The index of the element to insert the new option before. If out of bounds of the control's option list (the default) the new option will be added at the end of the list.
+	/// @param[in] before The index of the element to insert the new option before. If out of bounds of the control's option list (the default) the
+	/// new option will be added at the end of the list.
 	/// @param[in] selectable If true this option can be selected. If false, this option is not selectable.
 	/// @return The index of the new option.
 	int Add(const String& rml, const String& value, int before = -1, bool selectable = true);
@@ -104,11 +104,12 @@ protected:
 	void OnLayout() override;
 
 	void OnChildAdd(Element* child) override;
-	
+
 	void OnChildRemove(Element* child) override;
 
 	/// Returns true to mark this element as replaced.
-	/// @param[out] intrinsic_dimensions Set to the arbitrary dimensions of 128 x 16 just to give this element a size. Resize with the 'width' and 'height' properties.
+	/// @param[out] intrinsic_dimensions Set to the arbitrary dimensions of 128 x 16 just to give this element a size. Resize with the 'width' and
+	/// 'height' properties.
 	/// @param[out] intrinsic_ratio Ignored.
 	/// @return True.
 	bool GetIntrinsicDimensions(Vector2f& intrinsic_dimensions, float& intrinsic_ratio) override;

+ 5 - 6
Include/RmlUi/Core/Elements/ElementFormControlTextArea.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -37,13 +37,12 @@ namespace Rml {
 class WidgetTextInputMultiLine;
 
 /**
-	Default RmlUi implemention of a text area.
+    Default RmlUi implemention of a text area.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API ElementFormControlTextArea : public ElementFormControl
-{
+class RMLUICORE_API ElementFormControlTextArea : public ElementFormControl {
 public:
 	RMLUI_RTTI_DefineWithParent(ElementFormControlTextArea, ElementFormControl)
 

+ 17 - 18
Include/RmlUi/Core/Elements/ElementProgress.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,36 +29,35 @@
 #ifndef RMLUI_CORE_ELEMENTS_ELEMENTPROGRESS_H
 #define RMLUI_CORE_ELEMENTS_ELEMENTPROGRESS_H
 
-#include "../Header.h"
 #include "../Element.h"
 #include "../Geometry.h"
-#include "../Texture.h"
+#include "../Header.h"
 #include "../Spritesheet.h"
+#include "../Texture.h"
 
 namespace Rml {
 
 /**
-	The 'progress' element.
+    The 'progress' element.
 
-	The 'value' attribute should be a number [0, 1] where 1 means completely filled.
+    The 'value' attribute should be a number [0, 1] where 1 means completely filled.
 
-	The 'direction' attribute should be one of:
-		top | right (default) | bottom | left | clockwise | counter-clockwise
+    The 'direction' attribute should be one of:
+        top | right (default) | bottom | left | clockwise | counter-clockwise
 
-	The 'start-edge' attribute should be one of:
-		top (default) | right | bottom | left
-	Only applies to 'clockwise' or 'counter-clockwise' directions. Defines which edge the
-	circle should start expanding from.
+    The 'start-edge' attribute should be one of:
+        top (default) | right | bottom | left
+    Only applies to 'clockwise' or 'counter-clockwise' directions. Defines which edge the
+    circle should start expanding from.
 
-	The progress element generates a non-dom 'fill' element beneath it which can be used to 
-	style the filled part of the bar. The 'fill' element can use the 'fill-image'-property
-	to set an image which will be clipped according to the progress value. This property is
-	the only way to style a 'clockwise' or 'counter-clockwise' progress element.
+    The progress element generates a non-dom 'fill' element beneath it which can be used to
+    style the filled part of the bar. The 'fill' element can use the 'fill-image'-property
+    to set an image which will be clipped according to the progress value. This property is
+    the only way to style a 'clockwise' or 'counter-clockwise' progress element.
 
  */
 
-class RMLUICORE_API ElementProgress : public Element
-{
+class RMLUICORE_API ElementProgress : public Element {
 public:
 	RMLUI_RTTI_DefineWithParent(ElementProgress, Element)
 

+ 5 - 6
Include/RmlUi/Core/Elements/ElementTabSet.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -35,13 +35,12 @@
 namespace Rml {
 
 /**
-	A tabulated set of panels.
+    A tabulated set of panels.
 
-	@author Lloyd Weehuizen
+    @author Lloyd Weehuizen
  */
 
-class RMLUICORE_API ElementTabSet : public Element
-{
+class RMLUICORE_API ElementTabSet : public Element {
 public:
 	RMLUI_RTTI_DefineWithParent(ElementTabSet, Element)
 

+ 10 - 12
Include/RmlUi/Core/Event.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,10 +29,10 @@
 #ifndef RMLUI_CORE_EVENT_H
 #define RMLUI_CORE_EVENT_H
 
-#include "Header.h"
 #include "Dictionary.h"
-#include "ScriptInterface.h"
+#include "Header.h"
 #include "ID.h"
+#include "ScriptInterface.h"
 
 namespace Rml {
 
@@ -45,14 +45,13 @@ enum class EventPhase { None, Capture = 1, Target = 2, Bubble = 4 };
 enum class DefaultActionPhase { None, Target = (int)EventPhase::Target, TargetAndBubble = ((int)Target | (int)EventPhase::Bubble) };
 
 /**
-	An event that propogates through the element hierarchy. Events follow the DOM3 event specification. See
-	http://www.w3.org/TR/DOM-Level-3-Events/events.html.
+    An event that propogates through the element hierarchy. Events follow the DOM3 event specification. See
+    http://www.w3.org/TR/DOM-Level-3-Events/events.html.
 
-	@author Lloyd Weehuizen
+    @author Lloyd Weehuizen
  */
 
-class RMLUICORE_API Event : public ScriptInterface
-{
+class RMLUICORE_API Event : public ScriptInterface {
 public:
 	/// Constructor
 	Event();
@@ -104,7 +103,7 @@ public:
 	/// Returns the value of one of the event's parameters.
 	/// @param key[in] The name of the desired parameter.
 	/// @return The value of the requested parameter.
-	template < typename T >
+	template <typename T>
 	T GetParameter(const String& key, const T& default_value) const
 	{
 		return Get(parameters, key, default_value);
@@ -134,7 +133,7 @@ private:
 	String type;
 	EventId id = EventId::Invalid;
 	bool interruptible = false;
-	
+
 	bool interrupted = false;
 	bool interrupted_immediate = false;
 
@@ -148,6 +147,5 @@ private:
 	friend class Rml::Factory;
 };
 
-
 } // namespace Rml
 #endif

+ 6 - 7
Include/RmlUi/Core/EventInstancer.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,8 +29,8 @@
 #ifndef RMLUI_CORE_EVENTINSTANCER_H
 #define RMLUI_CORE_EVENTINSTANCER_H
 
-#include "Traits.h"
 #include "Header.h"
+#include "Traits.h"
 #include "Types.h"
 
 namespace Rml {
@@ -39,13 +39,12 @@ class Element;
 class Event;
 
 /**
-	Abstract instancer interface for instancing events. This is required to be overridden for scripting systems.
+    Abstract instancer interface for instancing events. This is required to be overridden for scripting systems.
 
-	@author Lloyd Weehuizen
+    @author Lloyd Weehuizen
  */
 
-class RMLUICORE_API EventInstancer : public Releasable
-{
+class RMLUICORE_API EventInstancer : public Releasable {
 public:
 	virtual ~EventInstancer();
 

+ 8 - 15
Include/RmlUi/Core/EventListener.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,8 +29,8 @@
 #ifndef RMLUI_CORE_EVENTLISTENER_H
 #define RMLUI_CORE_EVENTLISTENER_H
 
-#include "Header.h"
 #include "Event.h"
+#include "Header.h"
 #include "ObserverPtr.h"
 
 namespace Rml {
@@ -39,13 +39,12 @@ class Event;
 class Element;
 
 /**
-	Abstract interface class for handling events.
+    Abstract interface class for handling events.
 
-	@author Lloyd Weehuizen
+    @author Lloyd Weehuizen
  */
 
-class RMLUICORE_API EventListener : public EnableObserverPtr<EventListener>
-{
+class RMLUICORE_API EventListener : public EnableObserverPtr<EventListener> {
 public:
 	virtual ~EventListener() {}
 
@@ -53,16 +52,10 @@ public:
 	virtual void ProcessEvent(Event& event) = 0;
 
 	/// Called when the listener has been attached to a new Element
-	virtual void OnAttach(Element* RMLUI_UNUSED_PARAMETER(element))
-	{
-		RMLUI_UNUSED(element);
-	}
+	virtual void OnAttach(Element* /*element*/) {}
 
 	/// Called when the listener has been detached from an Element
-	virtual void OnDetach(Element* RMLUI_UNUSED_PARAMETER(element))
-	{
-		RMLUI_UNUSED(element);
-	}
+	virtual void OnDetach(Element* /*element*/) {}
 };
 
 } // namespace Rml

+ 8 - 9
Include/RmlUi/Core/EventListenerInstancer.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,24 +29,23 @@
 #ifndef RMLUI_CORE_EVENTLISTENERINSTANCER_H
 #define RMLUI_CORE_EVENTLISTENERINSTANCER_H
 
+#include "Element.h"
+#include "Header.h"
 #include "Traits.h"
 #include "Types.h"
-#include "Header.h"
-#include "Element.h"
 
 namespace Rml {
 
 class EventListener;
 
 /**
-	Abstract instancer interface for instancing event listeners. This is required to be overridden for scripting
-	systems.
+    Abstract instancer interface for instancing event listeners. This is required to be overridden for scripting
+    systems.
 
-	@author Lloyd Weehuizen
+    @author Lloyd Weehuizen
  */
 
-class RMLUICORE_API EventListenerInstancer
-{
+class RMLUICORE_API EventListenerInstancer {
 public:
 	virtual ~EventListenerInstancer();
 

+ 8 - 9
Include/RmlUi/Core/Factory.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,8 +29,8 @@
 #ifndef RMLUI_CORE_FACTORY_H
 #define RMLUI_CORE_FACTORY_H
 
-#include "XMLParser.h"
 #include "Header.h"
+#include "XMLParser.h"
 
 namespace Rml {
 
@@ -56,16 +56,15 @@ class DecoratorInstancerInterface;
 enum class EventId : uint16_t;
 
 /**
-	The Factory contains a registry of instancers for different types.
+    The Factory contains a registry of instancers for different types.
 
-	All instantiation of these rmlui types should go through the factory
-	so that scripting API's can bind in new types.
+    All instantiation of these rmlui types should go through the factory
+    so that scripting API's can bind in new types.
 
-	@author Lloyd Weehuizen
+    @author Lloyd Weehuizen
  */
 
-class RMLUICORE_API Factory
-{
+class RMLUICORE_API Factory {
 public:
 	/// Initialise the element factory
 	static bool Initialise();

+ 11 - 11
Include/RmlUi/Core/FileInterface.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -30,23 +30,22 @@
 #define RMLUI_CORE_FILEINTERFACE_H
 
 #include "Header.h"
-#include "Types.h"
 #include "Traits.h"
+#include "Types.h"
 
 namespace Rml {
 
 /**
-	The abstract base class for application-specific file I/O.
+    The abstract base class for application-specific file I/O.
 
-	By default, RmlUi will use a file interface implementing the standard C file functions. If this is not sufficient,
-	or your application wants more control over file I/O, this class should be derived, instanced, and installed
-	through Rml::SetFileInterface() before you initialise RmlUi.
+    By default, RmlUi will use a file interface implementing the standard C file functions. If this is not sufficient,
+    or your application wants more control over file I/O, this class should be derived, instanced, and installed
+    through Rml::SetFileInterface() before you initialise RmlUi.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API FileInterface : public NonCopyMoveable
-{
+class RMLUICORE_API FileInterface : public NonCopyMoveable {
 public:
 	FileInterface();
 	virtual ~FileInterface();
@@ -68,7 +67,8 @@ public:
 	/// Seeks to a point in a previously opened file.
 	/// @param file The handle of the file to seek.
 	/// @param offset The number of bytes to seek.
-	/// @param origin One of either SEEK_SET (seek from the beginning of the file), SEEK_END (seek from the end of the file) or SEEK_CUR (seek from the current file position).
+	/// @param origin One of either SEEK_SET (seek from the beginning of the file), SEEK_END (seek from the end of the file) or SEEK_CUR (seek from
+	/// the current file position).
 	/// @return True if the operation completed successfully, false otherwise.
 	virtual bool Seek(FileHandle file, long offset, int origin) = 0;
 	/// Returns the current position of the file pointer.

+ 8 - 7
Include/RmlUi/Core/FontEffect.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -34,11 +34,10 @@
 namespace Rml {
 
 /**
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API FontEffect
-{
+class RMLUICORE_API FontEffect {
 public:
 	// Behind or in front of the main text.
 	enum class Layer { Back, Front };
@@ -53,13 +52,15 @@ public:
 
 	/// Requests the effect for a size and position of a single glyph's bitmap.
 	/// @param[out] origin The desired origin of the effect's glyph bitmap, as a pixel offset from its original origin. This defaults to (0, 0).
-	/// @param[out] dimensions The desired dimensions of the effect's glyph bitmap, in pixels. This defaults to the dimensions of the glyph's original bitmap. If the font effect is not generating a unique texture, this will be ignored.
+	/// @param[out] dimensions The desired dimensions of the effect's glyph bitmap, in pixels. This defaults to the dimensions of the glyph's original
+	/// bitmap. If the font effect is not generating a unique texture, this will be ignored.
 	/// @param[in] glyph The glyph the effect is being asked to size.
 	/// @return False if the effect is not providing support for the glyph, true otherwise.
 	virtual bool GetGlyphMetrics(Vector2i& origin, Vector2i& dimensions, const FontGlyph& glyph) const;
 
 	/// Requests the effect to generate the texture data for a single glyph's bitmap. The default implementation does nothing.
-	/// @param[out] destination_data The top-left corner of the glyph's 32-bit, RGBA-ordered, destination texture. Note that the glyph shares its texture with other glyphs.
+	/// @param[out] destination_data The top-left corner of the glyph's 32-bit, RGBA-ordered, destination texture. Note that the glyph shares its
+	/// texture with other glyphs.
 	/// @param[in] destination_dimensions The dimensions of the glyph's area on its texture.
 	/// @param[in] destination_stride The stride of the glyph's texture.
 	/// @param[in] glyph The glyph the effect is being asked to generate an effect texture for.

+ 11 - 11
Include/RmlUi/Core/FontEffectInstancer.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,10 +29,10 @@
 #ifndef RMLUI_CORE_FONTEFFECTINSTANCER_H
 #define RMLUI_CORE_FONTEFFECTINSTANCER_H
 
-#include "Traits.h"
 #include "Header.h"
 #include "PropertyDictionary.h"
 #include "PropertySpecification.h"
+#include "Traits.h"
 
 namespace Rml {
 
@@ -40,16 +40,15 @@ class Factory;
 class FontEffect;
 
 /**
-	A font effect instancer provides a method for allocating and deallocating font effects.
+    A font effect instancer provides a method for allocating and deallocating font effects.
 
-	It is important that the same instancer that allocated a font effect releases it. This ensures there are no issues
-	with memory from different DLLs getting mixed up.
+    It is important that the same instancer that allocated a font effect releases it. This ensures there are no issues
+    with memory from different DLLs getting mixed up.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API FontEffectInstancer
-{
+class RMLUICORE_API FontEffectInstancer {
 public:
 	FontEffectInstancer();
 	virtual ~FontEffectInstancer();
@@ -73,7 +72,8 @@ protected:
 	PropertyDefinition& RegisterProperty(const String& property_name, const String& default_value, bool affects_generation = true);
 	/// Registers a shorthand property definition.
 	/// @param[in] shorthand_name The name to register the new shorthand property under.
-	/// @param[in] properties A comma-separated list of the properties this definition is shorthand for. The order in which they are specified here is the order in which the values will be processed.
+	/// @param[in] properties A comma-separated list of the properties this definition is shorthand for. The order in which they are specified here is
+	/// the order in which the values will be processed.
 	/// @param[in] type The type of shorthand to declare.
 	/// @param True if all the property names exist, false otherwise.
 	ShorthandId RegisterShorthand(const String& shorthand_name, const String& property_names, ShorthandType type);
@@ -82,7 +82,7 @@ private:
 	PropertySpecification properties;
 
 	// Properties that define the geometry.
-	SmallUnorderedSet< PropertyId > volatile_properties;
+	SmallUnorderedSet<PropertyId> volatile_properties;
 
 	friend class Rml::Factory;
 };

+ 12 - 12
Include/RmlUi/Core/FontEngineInterface.h

@@ -14,7 +14,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -37,15 +37,13 @@
 namespace Rml {
 
 /**
-	The abstract base class for an application-specific font engine implementation.
-	
-	By default, RmlUi will use its own font engine with characters rendered through FreeType. To use your own engine,
-	provide a concrete implementation of this class and install it through Rml::SetFontEngineInterface().
- */
+    The abstract base class for an application-specific font engine implementation.
 
+    By default, RmlUi will use its own font engine with characters rendered through FreeType. To use your own engine,
+    provide a concrete implementation of this class and install it through Rml::SetFontEngineInterface().
+ */
 
-class RMLUICORE_API FontEngineInterface
-{
+class RMLUICORE_API FontEngineInterface {
 public:
 	FontEngineInterface();
 	virtual ~FontEngineInterface();
@@ -66,9 +64,10 @@ public:
 	/// @param[in] fallback_face True to use this font face for unknown characters in other font faces.
 	/// @return True if the face was loaded successfully, false otherwise.
 	/// Note: The debugger plugin will load its embedded font faces through this method using the family name 'rmlui-debugger-font'.
-	virtual bool LoadFontFace(const byte* data, int data_size, const String& family, Style::FontStyle style, Style::FontWeight weight, bool fallback_face);
+	virtual bool LoadFontFace(const byte* data, int data_size, const String& family, Style::FontStyle style, Style::FontWeight weight,
+		bool fallback_face);
 
-	/// Called by RmlUi when a font configuration is resolved for an element. Should return a handle that 
+	/// Called by RmlUi when a font configuration is resolved for an element. Should return a handle that
 	/// can later be used to resolve properties of the face, and generate string geometry to be rendered.
 	/// @param[in] family The family of the desired font handle.
 	/// @param[in] style The style of the desired font handle.
@@ -81,7 +80,7 @@ public:
 	/// @param[in] handle The font handle.
 	/// @param[in] font_effects The list of font effects to generate the configuration for.
 	/// @return A handle to the prepared font effects which will be used when generating geometry for a string.
-	virtual FontEffectsHandle PrepareFontEffects(FontFaceHandle handle, const FontEffectList &font_effects);
+	virtual FontEffectsHandle PrepareFontEffects(FontFaceHandle handle, const FontEffectList& font_effects);
 
 	/// Should return the font metrics of the given font face.
 	/// @param[in] handle The font handle.
@@ -92,7 +91,8 @@ public:
 	/// @param[in] handle The font handle.
 	/// @param[in] string The string to measure.
 	/// @param[in] letter_spacing The letter spacing size in pixels.
-	/// @param[in] prior_character The optionally-specified character that immediately precedes the string. This may have an impact on the string width due to kerning.
+	/// @param[in] prior_character The optionally-specified character that immediately precedes the string. This may have an impact on the string
+	/// width due to kerning.
 	/// @return The width, in pixels, this string will occupy if rendered with this handle.
 	virtual int GetStringWidth(FontFaceHandle handle, const String& string, float letter_spacing, Character prior_character = Character::Null);
 

+ 5 - 5
Include/RmlUi/Core/FontGlyph.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -34,9 +34,9 @@
 namespace Rml {
 
 /**
-	Metrics and bitmap data for a single glyph within a font face.
+    Metrics and bitmap data for a single glyph within a font face.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
 class RMLUICORE_API FontGlyph {
@@ -62,7 +62,7 @@ public:
 	UniquePtr<byte[]> bitmap_owned_data;
 
 	// Create a copy with its bitmap data owned by another glyph.
-	FontGlyph WeakCopy() const 
+	FontGlyph WeakCopy() const
 	{
 		FontGlyph glyph;
 		glyph.dimensions = dimensions;

+ 5 - 5
Include/RmlUi/Core/FontMetrics.h

@@ -33,13 +33,13 @@
 namespace Rml {
 
 struct FontMetrics {
-	int size; // Specified font size [px].
+	int size;                  // Specified font size [px].
 
-	float ascent;       // Distance above the baseline to the upper grid coordinate [px, positive above baseline].
-	float descent;      // Distance below the baseline to the lower grid coordinate [px, positive below baseline].
-	float line_spacing; // Font-specified distance between two consecutive baselines [px].
+	float ascent;              // Distance above the baseline to the upper grid coordinate [px, positive above baseline].
+	float descent;             // Distance below the baseline to the lower grid coordinate [px, positive below baseline].
+	float line_spacing;        // Font-specified distance between two consecutive baselines [px].
 
-	float x_height; // Height of the lowercase 'x' character [px].
+	float x_height;            // Height of the lowercase 'x' character [px].
 
 	float underline_position;  // Position of the underline relative to the baseline [px, positive below baseline].
 	float underline_thickness; // Width of underline [px].

+ 10 - 11
Include/RmlUi/Core/Geometry.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -42,13 +42,12 @@ struct Texture;
 using GeometryDatabaseHandle = uint32_t;
 
 /**
-	A helper object for holding an array of vertices and indices, and compiling it as necessary when rendered.
+    A helper object for holding an array of vertices and indices, and compiling it as necessary when rendered.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API Geometry
-{
+class RMLUICORE_API Geometry {
 public:
 	Geometry(Element* host_element = nullptr);
 	Geometry(Context* host_context);
@@ -71,10 +70,10 @@ public:
 
 	/// Returns the geometry's vertices. If these are written to, Release() should be called to force a recompile.
 	/// @return The geometry's vertex array.
-	Vector< Vertex >& GetVertices();
+	Vector<Vertex>& GetVertices();
 	/// Returns the geometry's indices. If these are written to, Release() should be called to force a recompile.
 	/// @return The geometry's index array.
-	Vector< int >& GetIndices();
+	Vector<int>& GetIndices();
 
 	/// Gets the geometry's texture.
 	/// @return The geometry's texture.
@@ -99,8 +98,8 @@ private:
 	Context* host_context = nullptr;
 	Element* host_element = nullptr;
 
-	Vector< Vertex > vertices;
-	Vector< int > indices;
+	Vector<Vertex> vertices;
+	Vector<int> indices;
 	const Texture* texture = nullptr;
 
 	CompiledGeometryHandle compiled_geometry = 0;
@@ -109,7 +108,7 @@ private:
 	GeometryDatabaseHandle database_handle;
 };
 
-using GeometryList = Vector< Geometry >;
+using GeometryList = Vector<Geometry>;
 
 } // namespace Rml
 #endif

+ 10 - 9
Include/RmlUi/Core/GeometryUtilities.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -30,9 +30,9 @@
 #define RMLUI_CORE_GEOMETRYUTILITIES_H
 
 #include "Header.h"
+#include "StyleTypes.h"
 #include "Types.h"
 #include "Vertex.h"
-#include "StyleTypes.h"
 
 namespace Rml {
 
@@ -40,13 +40,12 @@ class Box;
 class Geometry;
 
 /**
-	A class containing helper functions for rendering geometry.
+    A class containing helper functions for rendering geometry.
 
-	@author Robert Curry
+    @author Robert Curry
  */
 
-class RMLUICORE_API GeometryUtilities
-{
+class RMLUICORE_API GeometryUtilities {
 public:
 	/// Generates a quad from a position, size and colour.
 	/// @param[out] vertices An array of at least four vertices that the generated vertex data will be written into.
@@ -65,7 +64,8 @@ public:
 	/// @param[in] top_left_texcoord The texture coordinates at the top-left of the quad.
 	/// @param[in] bottom_right_texcoord The texture coordinates at the bottom-right of the quad.
 	/// @param[in] index_offset The offset to be added to the generated indices; this should be the number of vertices already in the array.
-	static void GenerateQuad(Vertex* vertices, int* indices, Vector2f origin, Vector2f dimensions, Colourb colour, Vector2f top_left_texcoord, Vector2f bottom_right_texcoord, int index_offset = 0);
+	static void GenerateQuad(Vertex* vertices, int* indices, Vector2f origin, Vector2f dimensions, Colourb colour, Vector2f top_left_texcoord,
+		Vector2f bottom_right_texcoord, int index_offset = 0);
 
 	/// Generates the geometry required to render a line.
 	/// @param[out] geometry The geometry to append the newly created geometry into.
@@ -82,7 +82,8 @@ public:
 	/// @param[in] border_radius The border radius in pixel units in the following order: top-left, top-right, bottom-right, bottom-left.
 	/// @param[in] background_colour The colour applied to the background, set alpha to zero to not generate the background.
 	/// @param[in] border_colours Pointer to a four-element array of border colors in top-right-bottom-left order, or nullptr to not generate borders.
-	static void GenerateBackgroundBorder(Geometry* geometry, const Box& box, Vector2f offset, Vector4f border_radius, Colourb background_colour, const Colourb* border_colours = nullptr);
+	static void GenerateBackgroundBorder(Geometry* geometry, const Box& box, Vector2f offset, Vector4f border_radius, Colourb background_colour,
+		const Colourb* border_colours = nullptr);
 
 private:
 	GeometryUtilities();

+ 3 - 3
Include/RmlUi/Core/Header.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -40,7 +40,7 @@
 			#define RMLUICORE_API __declspec(dllexport)
 			// Note: Changing a RMLUICORE_API_INLINE method
 			// breaks ABI compatibility!!
-			
+
 			// This results in an exported method from the DLL
 			// that may be inlined in DLL clients, or if not
 			// possible the client may choose to import the copy

+ 7 - 13
Include/RmlUi/Core/ID.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -26,7 +26,6 @@
  *
  */
 
- 
 #ifndef RMLUI_CORE_ID_H
 #define RMLUI_CORE_ID_H
 
@@ -34,8 +33,7 @@
 
 namespace Rml {
 
-enum class ShorthandId : uint8_t
-{
+enum class ShorthandId : uint8_t {
 	Invalid,
 
 	/*
@@ -69,9 +67,7 @@ enum class ShorthandId : uint8_t
 	MaxNumIds = 0xff
 };
 
-
-enum class PropertyId : uint8_t
-{
+enum class PropertyId : uint8_t {
 	Invalid,
 
 	/*
@@ -180,9 +176,8 @@ enum class PropertyId : uint8_t
 	MaxNumIds = 128
 };
 
-enum class MediaQueryId : uint8_t
-{
-	Invalid, 
+enum class MediaQueryId : uint8_t {
+	Invalid,
 
 	Width,
 	MinWidth,
@@ -202,8 +197,7 @@ enum class MediaQueryId : uint8_t
 	NumDefinedIds
 };
 
-enum class EventId : uint16_t 
-{
+enum class EventId : uint16_t {
 	Invalid,
 
 	// Core events

+ 66 - 69
Include/RmlUi/Core/Input.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -32,15 +32,13 @@
 namespace Rml {
 
 /*
-	Enumerants for sending input events into RmlUi.
+    Enumerants for sending input events into RmlUi.
 
-	@author Peter Curry
+    @author Peter Curry
  */
 
-namespace Input
-{
-	enum KeyIdentifier : unsigned char
-	{
+namespace Input {
+	enum KeyIdentifier : unsigned char {
 		KI_UNKNOWN = 0,
 
 		KI_SPACE = 1,
@@ -83,21 +81,21 @@ namespace Input
 		KI_Y = 36,
 		KI_Z = 37,
 
-		KI_OEM_1 = 38,				// US standard keyboard; the ';:' key.
-		KI_OEM_PLUS = 39,			// Any region; the '=+' key.
-		KI_OEM_COMMA = 40,			// Any region; the ',<' key.
-		KI_OEM_MINUS = 41,			// Any region; the '-_' key.
-		KI_OEM_PERIOD = 42,			// Any region; the '.>' key.
-		KI_OEM_2 = 43,				// Any region; the '/?' key.
-		KI_OEM_3 = 44,				// Any region; the '`~' key.
-
-		KI_OEM_4 = 45,				// US standard keyboard; the '[{' key.
-		KI_OEM_5 = 46,				// US standard keyboard; the '\|' key.
-		KI_OEM_6 = 47,				// US standard keyboard; the ']}' key.
-		KI_OEM_7 = 48,				// US standard keyboard; the ''"' key.
+		KI_OEM_1 = 38,      // US standard keyboard; the ';:' key.
+		KI_OEM_PLUS = 39,   // Any region; the '=+' key.
+		KI_OEM_COMMA = 40,  // Any region; the ',<' key.
+		KI_OEM_MINUS = 41,  // Any region; the '-_' key.
+		KI_OEM_PERIOD = 42, // Any region; the '.>' key.
+		KI_OEM_2 = 43,      // Any region; the '/?' key.
+		KI_OEM_3 = 44,      // Any region; the '`~' key.
+
+		KI_OEM_4 = 45,      // US standard keyboard; the '[{' key.
+		KI_OEM_5 = 46,      // US standard keyboard; the '\|' key.
+		KI_OEM_6 = 47,      // US standard keyboard; the ']}' key.
+		KI_OEM_7 = 48,      // US standard keyboard; the ''"' key.
 		KI_OEM_8 = 49,
 
-		KI_OEM_102 = 50,			// RT 102-key keyboard; the '<>' or '\|' key.
+		KI_OEM_102 = 50, // RT 102-key keyboard; the '<>' or '\|' key.
 
 		KI_NUMPAD0 = 51,
 		KI_NUMPAD1 = 52,
@@ -110,60 +108,60 @@ namespace Input
 		KI_NUMPAD8 = 59,
 		KI_NUMPAD9 = 60,
 		KI_NUMPADENTER = 61,
-		KI_MULTIPLY = 62,			// Asterisk on the numeric keypad.
-		KI_ADD = 63,				// Plus on the numeric keypad.
+		KI_MULTIPLY = 62, // Asterisk on the numeric keypad.
+		KI_ADD = 63,      // Plus on the numeric keypad.
 		KI_SEPARATOR = 64,
-		KI_SUBTRACT = 65,			// Minus on the numeric keypad.
-		KI_DECIMAL = 66,			// Period on the numeric keypad.
-		KI_DIVIDE = 67,				// Forward Slash on the numeric keypad.
+		KI_SUBTRACT = 65, // Minus on the numeric keypad.
+		KI_DECIMAL = 66,  // Period on the numeric keypad.
+		KI_DIVIDE = 67,   // Forward Slash on the numeric keypad.
 
 		/*
 		 * NEC PC-9800 kbd definitions
 		 */
-		KI_OEM_NEC_EQUAL = 68,		// Equals key on the numeric keypad.
+		KI_OEM_NEC_EQUAL = 68, // Equals key on the numeric keypad.
 
-		KI_BACK = 69,				// Backspace key.
-		KI_TAB = 70,				// Tab key.
+		KI_BACK = 69,          // Backspace key.
+		KI_TAB = 70,           // Tab key.
 
 		KI_CLEAR = 71,
 		KI_RETURN = 72,
 
 		KI_PAUSE = 73,
-		KI_CAPITAL = 74,			// Capslock key.
+		KI_CAPITAL = 74,    // Capslock key.
 
-		KI_KANA = 75,				// IME Kana mode.
-		KI_HANGUL = 76,				// IME Hangul mode.
-		KI_JUNJA = 77,				// IME Junja mode.
-		KI_FINAL = 78,				// IME final mode.
-		KI_HANJA = 79,				// IME Hanja mode.
-		KI_KANJI = 80,				// IME Kanji mode.
+		KI_KANA = 75,       // IME Kana mode.
+		KI_HANGUL = 76,     // IME Hangul mode.
+		KI_JUNJA = 77,      // IME Junja mode.
+		KI_FINAL = 78,      // IME final mode.
+		KI_HANJA = 79,      // IME Hanja mode.
+		KI_KANJI = 80,      // IME Kanji mode.
 
-		KI_ESCAPE = 81,				// Escape key.
+		KI_ESCAPE = 81,     // Escape key.
 
-		KI_CONVERT = 82,			// IME convert.
-		KI_NONCONVERT = 83,			// IME nonconvert.
-		KI_ACCEPT = 84,				// IME accept.
-		KI_MODECHANGE = 85,			// IME mode change request.
+		KI_CONVERT = 82,    // IME convert.
+		KI_NONCONVERT = 83, // IME nonconvert.
+		KI_ACCEPT = 84,     // IME accept.
+		KI_MODECHANGE = 85, // IME mode change request.
 
-		KI_PRIOR = 86,				// Page Up key.
-		KI_NEXT = 87,				// Page Down key.
+		KI_PRIOR = 86,      // Page Up key.
+		KI_NEXT = 87,       // Page Down key.
 		KI_END = 88,
 		KI_HOME = 89,
-		KI_LEFT = 90,				// Left Arrow key.
-		KI_UP = 91,					// Up Arrow key.
-		KI_RIGHT = 92,				// Right Arrow key.
-		KI_DOWN = 93,				// Down Arrow key.
+		KI_LEFT = 90,  // Left Arrow key.
+		KI_UP = 91,    // Up Arrow key.
+		KI_RIGHT = 92, // Right Arrow key.
+		KI_DOWN = 93,  // Down Arrow key.
 		KI_SELECT = 94,
 		KI_PRINT = 95,
 		KI_EXECUTE = 96,
-		KI_SNAPSHOT = 97,			// Print Screen key.
+		KI_SNAPSHOT = 97, // Print Screen key.
 		KI_INSERT = 98,
 		KI_DELETE = 99,
 		KI_HELP = 100,
 
-		KI_LWIN = 101,				// Left Windows key.
-		KI_RWIN = 102,				// Right Windows key.
-		KI_APPS = 103,				// Applications key.
+		KI_LWIN = 101, // Left Windows key.
+		KI_RWIN = 102, // Right Windows key.
+		KI_APPS = 103, // Applications key.
 
 		KI_POWER = 104,
 		KI_SLEEP = 105,
@@ -194,17 +192,17 @@ namespace Input
 		KI_F23 = 129,
 		KI_F24 = 130,
 
-		KI_NUMLOCK = 131,			// Numlock key.
-		KI_SCROLL = 132,			// Scroll Lock key.
+		KI_NUMLOCK = 131, // Numlock key.
+		KI_SCROLL = 132,  // Scroll Lock key.
 
 		/*
 		 * Fujitsu/OASYS kbd definitions
 		 */
-		KI_OEM_FJ_JISHO = 133,		// 'Dictionary' key.
-		KI_OEM_FJ_MASSHOU = 134,	// 'Unregister word' key.
-		KI_OEM_FJ_TOUROKU = 135,	// 'Register word' key.
-		KI_OEM_FJ_LOYA = 136,		// 'Left OYAYUBI' key.
-		KI_OEM_FJ_ROYA = 137,		// 'Right OYAYUBI' key.
+		KI_OEM_FJ_JISHO = 133,   // 'Dictionary' key.
+		KI_OEM_FJ_MASSHOU = 134, // 'Unregister word' key.
+		KI_OEM_FJ_TOUROKU = 135, // 'Register word' key.
+		KI_OEM_FJ_LOYA = 136,    // 'Left OYAYUBI' key.
+		KI_OEM_FJ_ROYA = 137,    // 'Right OYAYUBI' key.
 
 		KI_LSHIFT = 138,
 		KI_RSHIFT = 139,
@@ -240,7 +238,7 @@ namespace Input
 		KI_ICO_HELP = 163,
 		KI_ICO_00 = 164,
 
-		KI_PROCESSKEY = 165,		// IME Process key.
+		KI_PROCESSKEY = 165, // IME Process key.
 
 		KI_ICO_CLEAR = 166,
 
@@ -257,17 +255,16 @@ namespace Input
 		KI_RMETA = 176
 	};
 
-	enum KeyModifier : unsigned char
-	{
-		KM_CTRL = 1 << 0,		// Set if at least one Ctrl key is depressed.
-		KM_SHIFT = 1 << 1,		// Set if at least one Shift key is depressed.
-		KM_ALT = 1 << 2,		// Set if at least one Alt key is depressed.
-		KM_META = 1 << 3,		// Set if at least one Meta key (the command key) is depressed.
-		KM_CAPSLOCK = 1 << 4,	// Set if caps lock is enabled.
-		KM_NUMLOCK = 1 << 5,	// Set if num lock is enabled.
-		KM_SCROLLLOCK = 1 << 6	// Set if scroll lock is enabled.
+	enum KeyModifier : unsigned char {
+		KM_CTRL = 1 << 0,      // Set if at least one Ctrl key is depressed.
+		KM_SHIFT = 1 << 1,     // Set if at least one Shift key is depressed.
+		KM_ALT = 1 << 2,       // Set if at least one Alt key is depressed.
+		KM_META = 1 << 3,      // Set if at least one Meta key (the command key) is depressed.
+		KM_CAPSLOCK = 1 << 4,  // Set if caps lock is enabled.
+		KM_NUMLOCK = 1 << 5,   // Set if num lock is enabled.
+		KM_SCROLLLOCK = 1 << 6 // Set if scroll lock is enabled.
 	};
-}
+} // namespace Input
 
 } // namespace Rml
 #endif

+ 8 - 10
Include/RmlUi/Core/Log.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -35,25 +35,23 @@
 namespace Rml {
 
 /**
-	RmlUi logging API.
+    RmlUi logging API.
 
-	@author Lloyd Weehuizen
+    @author Lloyd Weehuizen
  */
 
-class RMLUICORE_API Log
-{
+class RMLUICORE_API Log {
 public:
-	enum Type
-	{
+	enum Type {
 		LT_ALWAYS = 0,
 		LT_ERROR,
 		LT_ASSERT,
 		LT_WARNING,
 		LT_INFO,
 		LT_DEBUG,
-		LT_MAX
+		LT_MAX,
 	};
-	
+
 public:
 	/// Initialises the logging interface.
 	/// @return True if the logging interface was successful, false if not.

+ 198 - 197
Include/RmlUi/Core/Math.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -35,223 +35,224 @@
 namespace Rml {
 
 using byte = unsigned char;
-template <typename ColourType, int AlphaDefault> class Colour;
-using Colourb = Colour< byte, 255 >;
-template <typename Type> class Vector2;
-using Vector2f = Vector2< float >;
-using Vector2i = Vector2< int >;
+template <typename ColourType, int AlphaDefault>
+class Colour;
+using Colourb = Colour<byte, 255>;
+template <typename Type>
+class Vector2;
+using Vector2f = Vector2<float>;
+using Vector2i = Vector2<int>;
 
 namespace Math {
 
-constexpr float RMLUI_PI = 3.141592653f;
-
-template < typename Type >
-Type Max(Type a, Type b)
-{
-	return (a > b) ? a : b;
-}
+	constexpr float RMLUI_PI = 3.141592653f;
 
-template< typename Type >
-Type Min(Type a, Type b)
-{
-	return (a < b) ? a : b;
-}
+	template <typename Type>
+	Type Max(Type a, Type b)
+	{
+		return (a > b) ? a : b;
+	}
 
-template < typename Type >
-Type ClampLower(Type value, Type min)
-{
-	return (value < min) ? min : value;
-}
+	template <typename Type>
+	Type Min(Type a, Type b)
+	{
+		return (a < b) ? a : b;
+	}
 
-template < typename Type >
-Type ClampUpper(Type value, Type max)
-{
-	return (value > max) ? max: value;
-}
+	template <typename Type>
+	Type ClampLower(Type value, Type min)
+	{
+		return (value < min) ? min : value;
+	}
 
-template< typename Type >
-Type Clamp(Type value, Type min, Type max)
-{
-	return (value < min) ? min : (value > max) ? max : value;
-}
+	template <typename Type>
+	Type ClampUpper(Type value, Type max)
+	{
+		return (value > max) ? max : value;
+	}
 
-template< typename Type >
-Type Lerp(float t, Type v0, Type v1)
-{
-	static_assert(!std::is_same<Type, Colourb>::value, "Lerp currently cannot be used with Colourb. Use RoundedLerp instead.");
-	return v0 * (1.0f - t) + v1 * t;
-}
+	template <typename Type>
+	Type Clamp(Type value, Type min, Type max)
+	{
+		return (value < min) ? min : (value > max) ? max : value;
+	}
 
-/// Element-wise maximum.
-template <>
-RMLUICORE_API Vector2f Max<Vector2f>(Vector2f a, Vector2f b);
-template <>
-RMLUICORE_API Vector2i Max<Vector2i>(Vector2i a, Vector2i b);
-/// Element-wise minimum.
-template <>
-RMLUICORE_API Vector2f Min<Vector2f>(Vector2f a, Vector2f b);
-template <>
-RMLUICORE_API Vector2i Min<Vector2i>(Vector2i a, Vector2i b);
-/// Element-wise clamp.
-template <>
-RMLUICORE_API Vector2f Clamp<Vector2f>(Vector2f value, Vector2f min, Vector2f max);
-template <>
-RMLUICORE_API Vector2i Clamp<Vector2i>(Vector2i value, Vector2i min, Vector2i max);
+	template <typename Type>
+	Type Lerp(float t, Type v0, Type v1)
+	{
+		static_assert(!std::is_same<Type, Colourb>::value, "Lerp currently cannot be used with Colourb. Use RoundedLerp instead.");
+		return v0 * (1.0f - t) + v1 * t;
+	}
 
+	/// Element-wise maximum.
+	template <>
+	RMLUICORE_API Vector2f Max<Vector2f>(Vector2f a, Vector2f b);
+	template <>
+	RMLUICORE_API Vector2i Max<Vector2i>(Vector2i a, Vector2i b);
+	/// Element-wise minimum.
+	template <>
+	RMLUICORE_API Vector2f Min<Vector2f>(Vector2f a, Vector2f b);
+	template <>
+	RMLUICORE_API Vector2i Min<Vector2i>(Vector2i a, Vector2i b);
+	/// Element-wise clamp.
+	template <>
+	RMLUICORE_API Vector2f Clamp<Vector2f>(Vector2f value, Vector2f min, Vector2f max);
+	template <>
+	RMLUICORE_API Vector2i Clamp<Vector2i>(Vector2i value, Vector2i min, Vector2i max);
 
-/// Color interpolation.
-RMLUICORE_API Colourb RoundedLerp(float t, Colourb c0, Colourb c1);
+	/// Color interpolation.
+	RMLUICORE_API Colourb RoundedLerp(float t, Colourb c0, Colourb c1);
 
-/// Evaluates if a number is, or close to, zero.
-/// @param[in] value The number to compare to zero.
-/// @return True if the number if zero or close to it, false otherwise.
-RMLUICORE_API bool IsZero(float value);
-/// Evaluates if two floating-point numbers are equal, or so similar that they could be considered
-/// so.
-/// @param[in] value_0 The first number to compare.
-/// @param[in] value_1 The second number to compare.
-/// @return True if the numbers are similar or equal.
-RMLUICORE_API bool AreEqual(float value_0, float value_1);
+	/// Evaluates if a number is, or close to, zero.
+	/// @param[in] value The number to compare to zero.
+	/// @return True if the number if zero or close to it, false otherwise.
+	RMLUICORE_API bool IsZero(float value);
+	/// Evaluates if two floating-point numbers are equal, or so similar that they could be considered
+	/// so.
+	/// @param[in] value_0 The first number to compare.
+	/// @param[in] value_1 The second number to compare.
+	/// @return True if the numbers are similar or equal.
+	RMLUICORE_API bool AreEqual(float value_0, float value_1);
 
-/// Calculates the absolute value of a number.
-/// @param[in] value The number of get the absolute value of.
-/// @return The absolute value of the number.
-RMLUICORE_API float AbsoluteValue(float value);
-/// Calculates the absolute value of a number.
-/// @param[in] value The number of get the absolute value of.
-/// @return The absolute value of the number.
-RMLUICORE_API int AbsoluteValue(int value);
-/// Calculates the component-wise absolute value of a vector.
-/// @param[in] value The vector of get the absolute value of.
-/// @return The absolute value of the vector.
-RMLUICORE_API Vector2f AbsoluteValue(Vector2f value);
+	/// Calculates the absolute value of a number.
+	/// @param[in] value The number of get the absolute value of.
+	/// @return The absolute value of the number.
+	RMLUICORE_API float AbsoluteValue(float value);
+	/// Calculates the absolute value of a number.
+	/// @param[in] value The number of get the absolute value of.
+	/// @return The absolute value of the number.
+	RMLUICORE_API int AbsoluteValue(int value);
+	/// Calculates the component-wise absolute value of a vector.
+	/// @param[in] value The vector of get the absolute value of.
+	/// @return The absolute value of the vector.
+	RMLUICORE_API Vector2f AbsoluteValue(Vector2f value);
 
-/// Calculates the cosine of an angle.
-/// @param[in] angle The angle to calculate the cosine of, in radians.
-/// @return The cosine of the angle.
-RMLUICORE_API float Cos(float angle);
-/// Calculates the arc-cosine of an value.
-/// @param[in] angle The value to calculate the arc-cosine of.
-/// @return The angle, in radians.
-RMLUICORE_API float ACos(float value);
-/// Calculates the sine of an angle.
-/// @param[in] angle The angle to calculate the sine of, in radians.
-/// @return The sine of the angle.
-RMLUICORE_API float Sin(float angle);
-/// Calculates the arc-sine of an value.
-/// @param[in] angle The value to calculate the arc-sine of.
-/// @return The angle, in radians.
-RMLUICORE_API float ASin(float angle);
-/// Calculates the tangent of an angle.
-/// @param[in] angle The angle to calculate the tangent of, in radians.
-/// @return The tanget of the angle.
-RMLUICORE_API float Tan(float angle);
-/// Calculates the angle of a two-dimensional line.
-/// @param[in] y The y-component of the line.
-/// @param[in] x The x-component of the line.
-/// @return The angle of the line in radians.
-RMLUICORE_API float ATan2(float y, float x);
-/// Evaluates the natural exponential function on a value.
-/// @param[in] value The value
-/// @return e^(value)
-RMLUICORE_API float Exp(float value);
-/// Evaluates the base-2 logarithm of an integer.
-/// @param[in] value The value
-/// @return log2(value)
-RMLUICORE_API int Log2(int value);
+	/// Calculates the cosine of an angle.
+	/// @param[in] angle The angle to calculate the cosine of, in radians.
+	/// @return The cosine of the angle.
+	RMLUICORE_API float Cos(float angle);
+	/// Calculates the arc-cosine of an value.
+	/// @param[in] angle The value to calculate the arc-cosine of.
+	/// @return The angle, in radians.
+	RMLUICORE_API float ACos(float value);
+	/// Calculates the sine of an angle.
+	/// @param[in] angle The angle to calculate the sine of, in radians.
+	/// @return The sine of the angle.
+	RMLUICORE_API float Sin(float angle);
+	/// Calculates the arc-sine of an value.
+	/// @param[in] angle The value to calculate the arc-sine of.
+	/// @return The angle, in radians.
+	RMLUICORE_API float ASin(float angle);
+	/// Calculates the tangent of an angle.
+	/// @param[in] angle The angle to calculate the tangent of, in radians.
+	/// @return The tanget of the angle.
+	RMLUICORE_API float Tan(float angle);
+	/// Calculates the angle of a two-dimensional line.
+	/// @param[in] y The y-component of the line.
+	/// @param[in] x The x-component of the line.
+	/// @return The angle of the line in radians.
+	RMLUICORE_API float ATan2(float y, float x);
+	/// Evaluates the natural exponential function on a value.
+	/// @param[in] value The value
+	/// @return e^(value)
+	RMLUICORE_API float Exp(float value);
+	/// Evaluates the base-2 logarithm of an integer.
+	/// @param[in] value The value
+	/// @return log2(value)
+	RMLUICORE_API int Log2(int value);
 
-/// Converts an angle from radians to degrees.
-/// @param[in] The angle, in radians.
-/// @return The angle converted to degrees.
-RMLUICORE_API float RadiansToDegrees(float angle);
-/// Converts an angle from degrees to radians.
-/// @param[in] The angle, in degrees.
-/// @return The angle converted to radians.
-RMLUICORE_API float DegreesToRadians(float angle);
-/// Normalises and angle in radians
-/// @param[in] The angle, in randians
-/// @return The normalised angle
-RMLUICORE_API float NormaliseAngle(float angle);
+	/// Converts an angle from radians to degrees.
+	/// @param[in] The angle, in radians.
+	/// @return The angle converted to degrees.
+	RMLUICORE_API float RadiansToDegrees(float angle);
+	/// Converts an angle from degrees to radians.
+	/// @param[in] The angle, in degrees.
+	/// @return The angle converted to radians.
+	RMLUICORE_API float DegreesToRadians(float angle);
+	/// Normalises and angle in radians
+	/// @param[in] The angle, in randians
+	/// @return The normalised angle
+	RMLUICORE_API float NormaliseAngle(float angle);
 
-/// Calculates the square root of a value.
-/// @param[in] value The value to calculate the square root of. This must be above zero.
-/// @return The square root of the value.
-RMLUICORE_API float SquareRoot(float value);
+	/// Calculates the square root of a value.
+	/// @param[in] value The value to calculate the square root of. This must be above zero.
+	/// @return The square root of the value.
+	RMLUICORE_API float SquareRoot(float value);
 
-/// Rounds a floating-point value to the nearest integer.
-/// @param[in] value The value to round.
-/// @return The rounded integer as float.
-RMLUICORE_API float RoundFloat(float value);
-/// Rounds a floating-point value to the nearest integer.
-/// @param[in] value The value to round.
-/// @return The rounded integer as double.
-RMLUICORE_API double RoundFloat(double value);
-/// Rounds a floating-point value up to the nearest integer.
-/// @param[in] value The value to round.
-/// @return The rounded integer as float.
-RMLUICORE_API float RoundUpFloat(float value);
-/// Rounds a floating-point value down to the nearest integer.
-/// @param[in] value The value to round.
-/// @return The rounded integer as float.
-RMLUICORE_API float RoundDownFloat(float value);
-/// Rounds a floating-point value to the nearest integer.
-/// @param[in] value The value to round.
-/// @return The rounded integer.
-RMLUICORE_API int RoundToInteger(float value);
-/// Rounds a floating-point value up to the nearest integer.
-/// @param[in] value The value to round.
-/// @return The rounded integer.
-RMLUICORE_API int RoundUpToInteger(float value);
-/// Rounds a floating-point value down to the nearest integer.
-/// @param[in] value The value to round.
-/// @return The rounded integer.
-RMLUICORE_API int RoundDownToInteger(float value);
+	/// Rounds a floating-point value to the nearest integer.
+	/// @param[in] value The value to round.
+	/// @return The rounded integer as float.
+	RMLUICORE_API float RoundFloat(float value);
+	/// Rounds a floating-point value to the nearest integer.
+	/// @param[in] value The value to round.
+	/// @return The rounded integer as double.
+	RMLUICORE_API double RoundFloat(double value);
+	/// Rounds a floating-point value up to the nearest integer.
+	/// @param[in] value The value to round.
+	/// @return The rounded integer as float.
+	RMLUICORE_API float RoundUpFloat(float value);
+	/// Rounds a floating-point value down to the nearest integer.
+	/// @param[in] value The value to round.
+	/// @return The rounded integer as float.
+	RMLUICORE_API float RoundDownFloat(float value);
+	/// Rounds a floating-point value to the nearest integer.
+	/// @param[in] value The value to round.
+	/// @return The rounded integer.
+	RMLUICORE_API int RoundToInteger(float value);
+	/// Rounds a floating-point value up to the nearest integer.
+	/// @param[in] value The value to round.
+	/// @return The rounded integer.
+	RMLUICORE_API int RoundUpToInteger(float value);
+	/// Rounds a floating-point value down to the nearest integer.
+	/// @param[in] value The value to round.
+	/// @return The rounded integer.
+	RMLUICORE_API int RoundDownToInteger(float value);
 
-/// Decompose floating-point value to its fractional and integral parts.
-/// @param[in] value The value to decompose.
-/// @param[out] integral The integral part of the value.
-/// @return The fractional part of the value.
-RMLUICORE_API float DecomposeFractionalIntegral(float value, float* integral);
-/// Efficiently truncates a floating-point value into an integer.
-/// @param[in] value The value to truncate.
-/// @return The truncated value as a signed integer.
-RMLUICORE_API int RealToInteger(float value);
+	/// Decompose floating-point value to its fractional and integral parts.
+	/// @param[in] value The value to decompose.
+	/// @param[out] integral The integral part of the value.
+	/// @return The fractional part of the value.
+	RMLUICORE_API float DecomposeFractionalIntegral(float value, float* integral);
+	/// Efficiently truncates a floating-point value into an integer.
+	/// @param[in] value The value to truncate.
+	/// @return The truncated value as a signed integer.
+	RMLUICORE_API int RealToInteger(float value);
 
-/// Round the position and width of a line segment to the pixel grid while minimizing movement of the edges.
-/// @param[inout] x The position, which will use normal rounding.
-/// @param[inout] width The width, which is rounded such that movement of the right edge is minimized.
-RMLUICORE_API void SnapToPixelGrid(float& x, float& width);
-/// Round the position and size of a rectangle to the pixel grid while minimizing movement of the edges.
-/// @param[inout] position The position, which will use normal rounding.
-/// @param[inout] size The size, which is rounded such that movement of the right and bottom edges is minimized.
-RMLUICORE_API void SnapToPixelGrid(Vector2f& position, Vector2f& size);
-/// Round the position and size of a rectangle to the pixel grid such that it fully covers the original rectangle.
-/// @param[inout] position The position, which will be rounded down.
-/// @param[inout] size The size, which is rounded such that the right and bottom edges are rounded up.
-RMLUICORE_API void ExpandToPixelGrid(Vector2f& position, Vector2f& size);
+	/// Round the position and width of a line segment to the pixel grid while minimizing movement of the edges.
+	/// @param[inout] x The position, which will use normal rounding.
+	/// @param[inout] width The width, which is rounded such that movement of the right edge is minimized.
+	RMLUICORE_API void SnapToPixelGrid(float& x, float& width);
+	/// Round the position and size of a rectangle to the pixel grid while minimizing movement of the edges.
+	/// @param[inout] position The position, which will use normal rounding.
+	/// @param[inout] size The size, which is rounded such that movement of the right and bottom edges is minimized.
+	RMLUICORE_API void SnapToPixelGrid(Vector2f& position, Vector2f& size);
+	/// Round the position and size of a rectangle to the pixel grid such that it fully covers the original rectangle.
+	/// @param[inout] position The position, which will be rounded down.
+	/// @param[inout] size The size, which is rounded such that the right and bottom edges are rounded up.
+	RMLUICORE_API void ExpandToPixelGrid(Vector2f& position, Vector2f& size);
 
-/// Converts a number to the nearest power of two, rounding up if necessary.
-/// @param[in] value The value to convert to a power-of-two.
-/// @return The smallest power of two that is as least as big as the input value.
-RMLUICORE_API int ToPowerOfTwo(int value);
+	/// Converts a number to the nearest power of two, rounding up if necessary.
+	/// @param[in] value The value to convert to a power-of-two.
+	/// @return The smallest power of two that is as least as big as the input value.
+	RMLUICORE_API int ToPowerOfTwo(int value);
 
-/// Converts from the ASCII-representation of a hexadecimal digit to decimal.
-/// @param[in] hex_digit The hexadecimal digit to convert to decimal.
-/// @return The digit in decimal.
-RMLUICORE_API int HexToDecimal(char hex_digit);
+	/// Converts from the ASCII-representation of a hexadecimal digit to decimal.
+	/// @param[in] hex_digit The hexadecimal digit to convert to decimal.
+	/// @return The digit in decimal.
+	RMLUICORE_API int HexToDecimal(char hex_digit);
 
-/// Generates a random floating-point value between 0 and a user-specified value.
-/// @param[in] max_value The limit to random value. The generated value will be guaranteed to be below this limit.
-/// @return The random value.
-RMLUICORE_API float RandomReal(float max_value);
-/// Generates a random integer value between 0 and a user-specified value.
-/// @param[in] max_value The limit to random value. The generated value will be guaranteed to be below this limit.
-/// @return The random value.
-RMLUICORE_API int RandomInteger(int max_value);
-/// Generates a random boolean value, with equal chance of true or false.
-/// @return The random value.
-RMLUICORE_API bool RandomBool();
+	/// Generates a random floating-point value between 0 and a user-specified value.
+	/// @param[in] max_value The limit to random value. The generated value will be guaranteed to be below this limit.
+	/// @return The random value.
+	RMLUICORE_API float RandomReal(float max_value);
+	/// Generates a random integer value between 0 and a user-specified value.
+	/// @param[in] max_value The limit to random value. The generated value will be guaranteed to be below this limit.
+	/// @return The random value.
+	RMLUICORE_API int RandomInteger(int max_value);
+	/// Generates a random boolean value, with equal chance of true or false.
+	/// @return The random value.
+	RMLUICORE_API bool RandomBool();
 
-}
+} // namespace Math
 } // namespace Rml
 #endif

+ 432 - 443
Include/RmlUi/Core/Matrix4.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2014 Markus Schöngart
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -36,468 +36,457 @@
 namespace Rml {
 
 /**
-	Templated class that acts as base strategy for vectors access patterns of matrices.
-	@author Markus Schöngart
+    Templated class that acts as base strategy for vectors access patterns of matrices.
+    @author Markus Schöngart
  */
-template< typename Component >
-struct MatrixStorageBase
-{
-		typedef Component ComponentType;
-		typedef Vector4< ComponentType > VectorType;
-		typedef VectorType VectorsType[4];
-
-		class StrideVector
-		{
-				VectorsType& vectors;
-				int idx;
-
-			public:
-				inline StrideVector(VectorsType& vectors, int idx) noexcept
-					: vectors(vectors), idx(idx) { }
-				inline ComponentType& operator[](int i) noexcept
-					{ return vectors[i][idx]; }
-				inline StrideVector& operator=(const VectorType& vec) noexcept
-					{
-						(*this)[0] = vec[0];
-						(*this)[1] = vec[1];
-						(*this)[2] = vec[2];
-						(*this)[3] = vec[3];
-						return *this;
-					}
-				operator const VectorType() const noexcept
-					{
-						return VectorType(
-							(*this)[0],
-							(*this)[1],
-							(*this)[2],
-							(*this)[3]
-						);
-					}
-		};
-		class StrideAccess
-		{
-				VectorsType& vectors;
-			public:
-				inline StrideAccess(VectorsType& vectors) noexcept
-					: vectors(vectors) { }
-				inline StrideVector operator[](int i) noexcept
-					{ return StrideVector(vectors, i); }
-		};
-		class ConstStrideVector
-		{
-				const VectorsType& vectors;
-				int idx;
-			public:
-				inline ConstStrideVector(const VectorsType& vectors, int idx) noexcept
-					: vectors(vectors), idx(idx) { }
-				inline const ComponentType& operator[](int i) const noexcept
-					{ return vectors[i][idx]; }
-				inline operator const VectorType() const noexcept
-					{
-						return VectorType(
-							(*this)[0],
-							(*this)[1],
-							(*this)[2],
-							(*this)[3]
-						);
-					}
-		};
-		class ConstStrideAccess
-		{
-				const VectorsType& vectors;
-			public:
-				inline ConstStrideAccess(const VectorsType& vectors) noexcept
-					: vectors(vectors) { }
-				inline ConstStrideVector operator[](int i) noexcept
-					{ return ConstStrideVector(vectors, i); }
-		};
-
-		class PackedVector
+template <typename Component>
+struct MatrixStorageBase {
+	typedef Component ComponentType;
+	typedef Vector4<ComponentType> VectorType;
+	typedef VectorType VectorsType[4];
+
+	class StrideVector {
+		VectorsType& vectors;
+		int idx;
+
+	public:
+		inline StrideVector(VectorsType& vectors, int idx) noexcept : vectors(vectors), idx(idx) {}
+		inline ComponentType& operator[](int i) noexcept { return vectors[i][idx]; }
+		inline StrideVector& operator=(const VectorType& vec) noexcept
 		{
-				VectorType& vector;
-			public:
-				inline PackedVector(VectorType& vector) noexcept
-					: vector(vector) { }
-				inline ComponentType& operator[](int i) noexcept
-					{ return vector[i]; }
-				inline PackedVector& operator=(const VectorType& vec) noexcept
-					{
-						vector = vec;
-						return *this;
-					}
-				inline PackedVector& operator=(StrideVector& vec) noexcept
-					{
-						vector[0] = vec[0];
-						vector[1] = vec[1];
-						vector[2] = vec[2];
-						vector[3] = vec[3];
-						return *this;
-					}
-				inline PackedVector& operator=(ConstStrideVector& vec) noexcept
-					{
-						vector[0] = vec[0];
-						vector[1] = vec[1];
-						vector[2] = vec[2];
-						vector[3] = vec[3];
-						return *this;
-					}
-				inline operator VectorType&() noexcept { return vector; }
-		};
-		class PackedAccess
+			(*this)[0] = vec[0];
+			(*this)[1] = vec[1];
+			(*this)[2] = vec[2];
+			(*this)[3] = vec[3];
+			return *this;
+		}
+		operator const VectorType() const noexcept { return VectorType((*this)[0], (*this)[1], (*this)[2], (*this)[3]); }
+	};
+	class StrideAccess {
+		VectorsType& vectors;
+
+	public:
+		inline StrideAccess(VectorsType& vectors) noexcept : vectors(vectors) {}
+		inline StrideVector operator[](int i) noexcept { return StrideVector(vectors, i); }
+	};
+	class ConstStrideVector {
+		const VectorsType& vectors;
+		int idx;
+
+	public:
+		inline ConstStrideVector(const VectorsType& vectors, int idx) noexcept : vectors(vectors), idx(idx) {}
+		inline const ComponentType& operator[](int i) const noexcept { return vectors[i][idx]; }
+		inline operator const VectorType() const noexcept { return VectorType((*this)[0], (*this)[1], (*this)[2], (*this)[3]); }
+	};
+	class ConstStrideAccess {
+		const VectorsType& vectors;
+
+	public:
+		inline ConstStrideAccess(const VectorsType& vectors) noexcept : vectors(vectors) {}
+		inline ConstStrideVector operator[](int i) noexcept { return ConstStrideVector(vectors, i); }
+	};
+
+	class PackedVector {
+		VectorType& vector;
+
+	public:
+		inline PackedVector(VectorType& vector) noexcept : vector(vector) {}
+		inline ComponentType& operator[](int i) noexcept { return vector[i]; }
+		inline PackedVector& operator=(const VectorType& vec) noexcept
 		{
-				VectorsType& vectors;
-			public:
-				inline PackedAccess(VectorsType& vectors) noexcept
-					: vectors(vectors) { }
-				inline PackedVector operator[](int i) noexcept
-					{ return PackedVector(vectors[i]); }
-		};
-		#if 0
-		class ConstPackedVector
+			vector = vec;
+			return *this;
+		}
+		inline PackedVector& operator=(StrideVector& vec) noexcept
 		{
-				const VectorType& vectors;
-			public:
-				inline ConstPackedVector(const VectorType& vectors) noexcept
-					: vectors(vectors) { }
-				inline const ComponentType& operator[](int i) const noexcept
-					{ return vectors[i]; }
-				inline operator const VectorType&() noexcept { return vectors; }
-		};
-		#endif
-		class ConstPackedAccess
+			vector[0] = vec[0];
+			vector[1] = vec[1];
+			vector[2] = vec[2];
+			vector[3] = vec[3];
+			return *this;
+		}
+		inline PackedVector& operator=(ConstStrideVector& vec) noexcept
 		{
-				const VectorsType& vectors;
-			public:
-				inline ConstPackedAccess(const VectorsType& vectors) noexcept
-					: vectors(vectors) { }
-				inline const VectorType& operator[](int i) noexcept
-					{ return vectors[i]; }
-		};
+			vector[0] = vec[0];
+			vector[1] = vec[1];
+			vector[2] = vec[2];
+			vector[3] = vec[3];
+			return *this;
+		}
+		inline operator VectorType&() noexcept { return vector; }
+	};
+	class PackedAccess {
+		VectorsType& vectors;
+
+	public:
+		inline PackedAccess(VectorsType& vectors) noexcept : vectors(vectors) {}
+		inline PackedVector operator[](int i) noexcept { return PackedVector(vectors[i]); }
+	};
+
+	class ConstPackedAccess {
+		const VectorsType& vectors;
+
+	public:
+		inline ConstPackedAccess(const VectorsType& vectors) noexcept : vectors(vectors) {}
+		inline const VectorType& operator[](int i) noexcept { return vectors[i]; }
+	};
 };
 
-template< typename Component >
+template <typename Component>
 struct RowMajorStorage;
-template< typename Component >
+template <typename Component>
 struct ColumnMajorStorage;
 
 /**
-	Templated class that defines the vectors access pattern for row-major matrices.
-	@author Markus Schöngart
+    Templated class that defines the vectors access pattern for row-major matrices.
+    @author Markus Schöngart
  */
-template< typename Component >
-struct RowMajorStorage : public MatrixStorageBase< Component >
-{
-		typedef Component ComponentType;
-		typedef Vector4< ComponentType > VectorType;
-		typedef RowMajorStorage< ComponentType > ThisType;
-		typedef ColumnMajorStorage< ComponentType > TransposeType;
-
-		typedef typename MatrixStorageBase< Component >::PackedVector Row;
-		typedef typename MatrixStorageBase< Component >::PackedAccess Rows;
-		typedef const typename MatrixStorageBase< Component >::VectorType& ConstRow;
-		typedef typename MatrixStorageBase< Component >::ConstPackedAccess ConstRows;
-		typedef typename MatrixStorageBase< Component >::StrideVector Column;
-		typedef typename MatrixStorageBase< Component >::StrideAccess Columns;
-		typedef typename MatrixStorageBase< Component >::ConstStrideVector ConstColumn;
-		typedef typename MatrixStorageBase< Component >::ConstStrideAccess ConstColumns;
+template <typename Component>
+struct RowMajorStorage : public MatrixStorageBase<Component> {
+	typedef Component ComponentType;
+	typedef Vector4<ComponentType> VectorType;
+	typedef RowMajorStorage<ComponentType> ThisType;
+	typedef ColumnMajorStorage<ComponentType> TransposeType;
+
+	typedef typename MatrixStorageBase<Component>::PackedVector Row;
+	typedef typename MatrixStorageBase<Component>::PackedAccess Rows;
+	typedef const typename MatrixStorageBase<Component>::VectorType& ConstRow;
+	typedef typename MatrixStorageBase<Component>::ConstPackedAccess ConstRows;
+	typedef typename MatrixStorageBase<Component>::StrideVector Column;
+	typedef typename MatrixStorageBase<Component>::StrideAccess Columns;
+	typedef typename MatrixStorageBase<Component>::ConstStrideVector ConstColumn;
+	typedef typename MatrixStorageBase<Component>::ConstStrideAccess ConstColumns;
 };
 
 /**
-	Templated class that defines the vectors access pattern for column-major matrices.
-	@author Markus Schöngart
+    Templated class that defines the vectors access pattern for column-major matrices.
+    @author Markus Schöngart
  */
-template< typename Component >
-struct ColumnMajorStorage
-{
-		typedef Component ComponentType;
-		typedef Vector4< ComponentType > VectorType;
-		typedef ColumnMajorStorage< ComponentType > ThisType;
-		typedef RowMajorStorage< ComponentType > TransposeType;
-
-		typedef typename MatrixStorageBase< Component >::PackedVector Column;
-		typedef typename MatrixStorageBase< Component >::PackedAccess Columns;
-		typedef const typename MatrixStorageBase< Component >::VectorType& ConstColumn;
-		typedef typename MatrixStorageBase< Component >::ConstPackedAccess ConstColumns;
-		typedef typename MatrixStorageBase< Component >::StrideVector Row;
-		typedef typename MatrixStorageBase< Component >::StrideAccess Rows;
-		typedef typename MatrixStorageBase< Component >::ConstStrideVector ConstRow;
-		typedef typename MatrixStorageBase< Component >::ConstStrideAccess ConstRows;
+template <typename Component>
+struct ColumnMajorStorage {
+	typedef Component ComponentType;
+	typedef Vector4<ComponentType> VectorType;
+	typedef ColumnMajorStorage<ComponentType> ThisType;
+	typedef RowMajorStorage<ComponentType> TransposeType;
+
+	typedef typename MatrixStorageBase<Component>::PackedVector Column;
+	typedef typename MatrixStorageBase<Component>::PackedAccess Columns;
+	typedef const typename MatrixStorageBase<Component>::VectorType& ConstColumn;
+	typedef typename MatrixStorageBase<Component>::ConstPackedAccess ConstColumns;
+	typedef typename MatrixStorageBase<Component>::StrideVector Row;
+	typedef typename MatrixStorageBase<Component>::StrideAccess Rows;
+	typedef typename MatrixStorageBase<Component>::ConstStrideVector ConstRow;
+	typedef typename MatrixStorageBase<Component>::ConstStrideAccess ConstRows;
 };
 
 /**
-	Templated class for a generic 4x4 matrix.
-	@author Markus Schöngart
+    Templated class for a generic 4x4 matrix.
+    @author Markus Schöngart
  */
 
-template< typename Component, class Storage = ColumnMajorStorage< Component > >
-class Matrix4
-{
-	public:
-		typedef Component ComponentType;
-		typedef Vector4< ComponentType > VectorType;
-		typedef Matrix4< ComponentType, Storage > ThisType;
-
-		typedef Storage StorageType;
-		typedef typename StorageType::Row Row;
-		typedef typename StorageType::Rows Rows;
-		typedef typename StorageType::ConstRow ConstRow;
-		typedef typename StorageType::ConstRows ConstRows;
-		typedef typename StorageType::Column Column;
-		typedef typename StorageType::Columns Columns;
-		typedef typename StorageType::ConstColumn ConstColumn;
-		typedef typename StorageType::ConstColumns ConstColumns;
-
-		typedef typename StorageType::TransposeType TransposeStorageType;
-		typedef Matrix4< ComponentType, TransposeStorageType > TransposeType;
-		friend class Rml::Matrix4< ComponentType, TransposeStorageType >;
-
-	private:
-		// The components of the matrix.
-		VectorType vectors[4];
-
-		/// Initialising constructor.
-		Matrix4(const VectorType& vec0, const VectorType& vec1, const VectorType& vec2, const VectorType& vec3) noexcept;
-
-		template< typename _Component, class _StorageA >
-		struct VectorMultiplier
-		{
-			typedef _Component ComponentType;
-			typedef _StorageA StorageAType;
-			typedef Matrix4< ComponentType, StorageAType > MatrixAType;
-			typedef Vector4< ComponentType > VectorType;
-
-			static const VectorType Multiply(
-				const MatrixAType& lhs,
-				const VectorType& rhs
-			) noexcept;
-		};
-
-		template< typename _Component, class _StorageA, class _StorageB >
-		struct MatrixMultiplier
-		{
-			typedef _Component ComponentType;
-			typedef _StorageA StorageAType;
-			typedef _StorageB StorageBType;
-			typedef Matrix4< ComponentType, StorageAType > MatrixAType;
-			typedef Matrix4< ComponentType, StorageBType > MatrixBType;
-
-			static const VectorType Multiply(
-				const MatrixAType& lhs,
-				const VectorType& rhs
-			);
-
-			static const MatrixAType Multiply(
-				const MatrixAType& lhs,
-				const MatrixBType& rhs
-			) noexcept;
-		};
-
-	public:
-		/// Zero-initialising default constructor.
-		inline Matrix4() noexcept;
-
-		/// Copy constructor.
-		inline Matrix4(const ThisType& other) noexcept;
-		Matrix4(const TransposeType& other) noexcept;
-
-		/// Assignment operator
-		const ThisType& operator=(const ThisType& other) noexcept;
-		const ThisType& operator=(const TransposeType& other) noexcept;
-
-		/// Construct from row vectors.
-		static const ThisType FromRows(const VectorType& vec0, const VectorType& vec1, const VectorType& vec2, const VectorType& vec3) noexcept;
-
-		/// Construct from column vectors.
-		static const ThisType FromColumns(const VectorType& vec0, const VectorType& vec1, const VectorType& vec2, const VectorType& vec3) noexcept;
-
-		/// Construct from components.
-		static const ThisType FromRowMajor(const ComponentType* components) noexcept;
-		static const ThisType FromColumnMajor(const ComponentType* components) noexcept;
-
-		// Convert to raw values; keep the storage mode in mind.
-		inline Component* data() noexcept
-			{ return &vectors[0][0]; }
-		inline const Component* data() const noexcept
-			{ return &vectors[0][0]; }
-
-		/// Get the i-th row
-		inline Row GetRow(int i) noexcept
-			{ Rows rows(vectors); return rows[i]; }
-		/// Get the i-th row
-		inline ConstRow GetRow(int i) const noexcept
-			{ ConstRows rows(vectors); return rows[i]; }
-		/// Set the i-th row
-		inline void SetRow(int i, const VectorType& vec) noexcept
-			{ Rows rows(vectors); rows[i] = vec; }
-		/// Set all rows
-		void SetRows(const VectorType& vec0, const VectorType& vec1, const VectorType& vec2, const VectorType& vec3) noexcept;
-
-		/// Get the i-th column
-		inline Column GetColumn(int i) noexcept
-			{ Columns columns(vectors); return columns[i]; }
-		/// Get the i-th column
-		inline ConstColumn GetColumn(int i) const noexcept
-			{ ConstColumns columns(vectors); return columns[i]; }
-		/// Set the i-th column
-		inline void SetColumn(int i, const VectorType& vec) noexcept
-			{ Columns columns(vectors); columns[i] = vec; }
-		/// Set all columns
-		void SetColumns(const VectorType& vec0, const VectorType& vec1, const VectorType& vec2, const VectorType& vec3) noexcept;
-
-		/// Returns the transpose of this matrix.
-		/// @return The transpose matrix.
-		inline const TransposeType& Transpose() const noexcept
-			{ return reinterpret_cast<const TransposeType&>(*this); }
-
-		/// Inverts this matrix in place, if possible.
-		/// @return true, if the inversion succeeded.
-		bool Invert() noexcept;
-
-		/// Inverts this matrix in place, if possible.
-		/// @return true, if the inversion succeeded.
-		float Determinant() const noexcept;
-
-		/// Returns the negation of this matrix.
-		/// @return The negation of this matrix.
-		ThisType operator-() const noexcept;
-
-		/// Adds another matrix to this in-place.
-		/// @param[in] other The matrix to add.
-		/// @return This matrix, post-operation.
-		const ThisType& operator+=(const ThisType& other) noexcept;
-		const ThisType& operator+=(const TransposeType& other) noexcept;
-		/// Subtracts another matrix from this in-place.
-		/// @param[in] other The matrix to subtract.
-		/// @return This matrix, post-operation.
-		const ThisType& operator-=(const ThisType& other) noexcept;
-		const ThisType& operator-=(const TransposeType& other) noexcept;
-		/// Scales this matrix in-place.
-		/// @param[in] other The value to scale this matrix's components by.
-		/// @return This matrix, post-operation.
-		const ThisType& operator*=(Component other) noexcept;
-		/// Scales this matrix in-place by the inverse of a value.
-		/// @param[in] other The value to divide this matrix's components by.
-		/// @return This matrix, post-operation.
-		const ThisType& operator/=(Component other) noexcept;
-
-		inline const VectorType& operator[](size_t i) const noexcept { return vectors[i]; }
-		inline VectorType& operator[](size_t i) noexcept { return vectors[i]; }
-
-		/// Returns the sum of this matrix and another.
-		/// @param[in] other The matrix to add this to.
-		/// @return The sum of the two matrices.
-		inline const ThisType operator+(const ThisType& other) const noexcept
-			{ ThisType result(*this); result += other; return result; }
-		inline const ThisType operator+(const TransposeType& other) const noexcept
-			{ ThisType result(*this); result += other; return result; }
-		/// Returns the result of subtracting another matrix from this matrix.
-		/// @param[in] other The matrix to subtract from this matrix.
-		/// @return The result of the subtraction.
-		inline const ThisType operator-(const ThisType& other) const noexcept
-			{ ThisType result(*this); result -= other; return result; }
-		inline const ThisType operator-(const TransposeType& other) const noexcept
-			{ ThisType result(*this); result -= other; return result; }
-		/// Returns the result of multiplying this matrix by a scalar.
-		/// @param[in] other The scalar value to multiply by.
-		/// @return The result of the scale.
-		inline const ThisType operator*(Component other) const noexcept
-			{ ThisType result(*this); result *= other; return result; }
-		/// Returns the result of dividing this matrix by a scalar.
-		/// @param[in] other The scalar value to divide by.
-		/// @return The result of the scale.
-		inline const ThisType operator/(Component other) const noexcept
-			{ ThisType result(*this); result *= other; return result; }
-
-		/// Returns the result of multiplying this matrix by a vector.
-		/// @param[in] other The scalar value to multiply by.
-		/// @return The result of the scale.
-		const VectorType operator*(const VectorType& other) const noexcept
-			{ return VectorMultiplier< Component, Storage >::Multiply(*this, other); }
-
-		/// Returns the result of multiplying this matrix by another matrix.
-		/// @param[in] other The matrix value to multiply by.
-		/// @return The result of the multiplication.
-		template< class Storage2 >
-		const ThisType operator*(const Matrix4< Component, Storage2 >& other) const noexcept
-			{ return MatrixMultiplier< Component, Storage, Storage2 >::Multiply(*this, other); }
-
-		/// Multiplies this matrix by another matrix in place.
-		/// @return The result of the multiplication.
-		inline const ThisType& operator*=(const ThisType& other) noexcept
-			{ *this = *this * other; return *this; }
-		inline const ThisType& operator*=(const TransposeType& other) noexcept
-			{ *this = *this * other; return *this; }
-
-		/// Equality operator.
-		/// @param[in] other The matrix to compare this against.
-		/// @return True if the two matrices are equal, false otherwise.
-		bool operator==(const ThisType& other) const noexcept;
-		bool operator==(const TransposeType& other) const noexcept;
-		/// Inequality operator.
-		/// @param[in] other The matrix to compare this against.
-		/// @return True if the two matrices are not equal, false otherwise.
-		bool operator!=(const ThisType& other) const noexcept;
-		bool operator!=(const TransposeType& other) const noexcept;
-
-		/// Return the identity matrix.
-		/// @return The identity matrix.
-		inline static const ThisType& Identity() noexcept;
-		/// Return a diagonal matrix.
-		/// @return A diagonal matrix.
-		static ThisType Diag(Component a, Component b, Component c, Component d = 1) noexcept;
-
-		/// Create an orthographic projection matrix
-		/// @param l The horizontal coordinate of the left clipping plane
-		/// @param r The horizontal coordinate of the right clipping plane
-		/// @param b The vertical coordinate of the bottom clipping plane
-		/// @param t The vertical coordinate of the top clipping plane
-		/// @param n The depth coordinate of the near clipping plane
-		/// @param f The depth coordinate of the far clipping plane
-		/// @return The specified orthographic projection matrix.
-		static ThisType ProjectOrtho(Component l, Component r, Component b, Component t, Component n, Component f) noexcept;
-		/// Create a perspective projection matrix
-		/// @param l The horizontal coordinate of the left clipping plane
-		/// @param r The horizontal coordinate of the right clipping plane
-		/// @param b The vertical coordinate of the bottom clipping plane
-		/// @param t The vertical coordinate of the top clipping plane
-		/// @param n The depth coordinate of the near clipping plane
-		/// @param f The depth coordinate of the far clipping plane
-		/// @return The specified perspective projection matrix.
-		static ThisType ProjectPerspective(Component l, Component r, Component b, Component t, Component n, Component f) noexcept;
-		/// Create a perspective projection matrix
-		/// @param d The distance to the z-plane
-		static ThisType Perspective(Component d) noexcept;
-
-		/// Return a translation matrix.
-		/// @return A translation matrix.
-		static ThisType Translate (const Vector3< Component >& v) noexcept;
-		static ThisType Translate (Component x, Component y, Component z) noexcept;
-		static ThisType TranslateX (Component x) noexcept;
-		static ThisType TranslateY (Component y) noexcept;
-		static ThisType TranslateZ (Component z) noexcept;
-
-		/// Return a scaling matrix.
-		/// @return A scaling matrix.
-		static ThisType Scale (Component x, Component y, Component z) noexcept;
-		static ThisType ScaleX (Component x) noexcept;
-		static ThisType ScaleY (Component y) noexcept;
-		static ThisType ScaleZ (Component z) noexcept;
-
-		/// Return a rotation matrix.
-		/// @return A rotation matrix.
-		static ThisType Rotate (const Vector3< Component >& v, Component angle) noexcept;
-		static ThisType RotateX (Component angle) noexcept;
-		static ThisType RotateY (Component angle) noexcept;
-		static ThisType RotateZ (Component angle) noexcept;
-
-		/// Return a skew/shearing matrix.
-		/// @return A skew matrix.
-		static ThisType Skew (Component angle_x, Component angle_y) noexcept;
-		static ThisType SkewX (Component angle) noexcept;
-		static ThisType SkewY (Component angle) noexcept;
-
-		static ThisType Compose(const Vector3< Component >& translation, const Vector3< Component >& scale,
-			const Vector3< Component >& skew, const Vector4< Component >& perspective, const Vector4< Component >& quaternion) noexcept;
+template <typename Component, class Storage = ColumnMajorStorage<Component>>
+class Matrix4 {
+public:
+	typedef Component ComponentType;
+	typedef Vector4<ComponentType> VectorType;
+	typedef Matrix4<ComponentType, Storage> ThisType;
+
+	typedef Storage StorageType;
+	typedef typename StorageType::Row Row;
+	typedef typename StorageType::Rows Rows;
+	typedef typename StorageType::ConstRow ConstRow;
+	typedef typename StorageType::ConstRows ConstRows;
+	typedef typename StorageType::Column Column;
+	typedef typename StorageType::Columns Columns;
+	typedef typename StorageType::ConstColumn ConstColumn;
+	typedef typename StorageType::ConstColumns ConstColumns;
+
+	typedef typename StorageType::TransposeType TransposeStorageType;
+	typedef Matrix4<ComponentType, TransposeStorageType> TransposeType;
+	friend class Rml::Matrix4<ComponentType, TransposeStorageType>;
+
+private:
+	// The components of the matrix.
+	VectorType vectors[4];
+
+	/// Initialising constructor.
+	Matrix4(const VectorType& vec0, const VectorType& vec1, const VectorType& vec2, const VectorType& vec3) noexcept;
+
+	template <typename _Component, class _StorageA>
+	struct VectorMultiplier {
+		typedef _Component ComponentType;
+		typedef _StorageA StorageAType;
+		typedef Matrix4<ComponentType, StorageAType> MatrixAType;
+		typedef Vector4<ComponentType> VectorType;
+
+		static const VectorType Multiply(const MatrixAType& lhs, const VectorType& rhs) noexcept;
+	};
+
+	template <typename _Component, class _StorageA, class _StorageB>
+	struct MatrixMultiplier {
+		typedef _Component ComponentType;
+		typedef _StorageA StorageAType;
+		typedef _StorageB StorageBType;
+		typedef Matrix4<ComponentType, StorageAType> MatrixAType;
+		typedef Matrix4<ComponentType, StorageBType> MatrixBType;
+
+		static const VectorType Multiply(const MatrixAType& lhs, const VectorType& rhs);
+
+		static const MatrixAType Multiply(const MatrixAType& lhs, const MatrixBType& rhs) noexcept;
+	};
+
+public:
+	/// Zero-initialising default constructor.
+	inline Matrix4() noexcept;
+
+	/// Copy constructor.
+	inline Matrix4(const ThisType& other) noexcept;
+	Matrix4(const TransposeType& other) noexcept;
+
+	/// Assignment operator
+	const ThisType& operator=(const ThisType& other) noexcept;
+	const ThisType& operator=(const TransposeType& other) noexcept;
+
+	/// Construct from row vectors.
+	static const ThisType FromRows(const VectorType& vec0, const VectorType& vec1, const VectorType& vec2, const VectorType& vec3) noexcept;
+
+	/// Construct from column vectors.
+	static const ThisType FromColumns(const VectorType& vec0, const VectorType& vec1, const VectorType& vec2, const VectorType& vec3) noexcept;
+
+	/// Construct from components.
+	static const ThisType FromRowMajor(const ComponentType* components) noexcept;
+	static const ThisType FromColumnMajor(const ComponentType* components) noexcept;
+
+	// Convert to raw values; keep the storage mode in mind.
+	inline Component* data() noexcept { return &vectors[0][0]; }
+	inline const Component* data() const noexcept { return &vectors[0][0]; }
+
+	/// Get the i-th row
+	inline Row GetRow(int i) noexcept
+	{
+		Rows rows(vectors);
+		return rows[i];
+	}
+	/// Get the i-th row
+	inline ConstRow GetRow(int i) const noexcept
+	{
+		ConstRows rows(vectors);
+		return rows[i];
+	}
+	/// Set the i-th row
+	inline void SetRow(int i, const VectorType& vec) noexcept
+	{
+		Rows rows(vectors);
+		rows[i] = vec;
+	}
+	/// Set all rows
+	void SetRows(const VectorType& vec0, const VectorType& vec1, const VectorType& vec2, const VectorType& vec3) noexcept;
+
+	/// Get the i-th column
+	inline Column GetColumn(int i) noexcept
+	{
+		Columns columns(vectors);
+		return columns[i];
+	}
+	/// Get the i-th column
+	inline ConstColumn GetColumn(int i) const noexcept
+	{
+		ConstColumns columns(vectors);
+		return columns[i];
+	}
+	/// Set the i-th column
+	inline void SetColumn(int i, const VectorType& vec) noexcept
+	{
+		Columns columns(vectors);
+		columns[i] = vec;
+	}
+	/// Set all columns
+	void SetColumns(const VectorType& vec0, const VectorType& vec1, const VectorType& vec2, const VectorType& vec3) noexcept;
+
+	/// Returns the transpose of this matrix.
+	/// @return The transpose matrix.
+	inline const TransposeType& Transpose() const noexcept { return reinterpret_cast<const TransposeType&>(*this); }
+
+	/// Inverts this matrix in place, if possible.
+	/// @return true, if the inversion succeeded.
+	bool Invert() noexcept;
+
+	/// Inverts this matrix in place, if possible.
+	/// @return true, if the inversion succeeded.
+	float Determinant() const noexcept;
+
+	/// Returns the negation of this matrix.
+	/// @return The negation of this matrix.
+	ThisType operator-() const noexcept;
+
+	/// Adds another matrix to this in-place.
+	/// @param[in] other The matrix to add.
+	/// @return This matrix, post-operation.
+	const ThisType& operator+=(const ThisType& other) noexcept;
+	const ThisType& operator+=(const TransposeType& other) noexcept;
+	/// Subtracts another matrix from this in-place.
+	/// @param[in] other The matrix to subtract.
+	/// @return This matrix, post-operation.
+	const ThisType& operator-=(const ThisType& other) noexcept;
+	const ThisType& operator-=(const TransposeType& other) noexcept;
+	/// Scales this matrix in-place.
+	/// @param[in] other The value to scale this matrix's components by.
+	/// @return This matrix, post-operation.
+	const ThisType& operator*=(Component other) noexcept;
+	/// Scales this matrix in-place by the inverse of a value.
+	/// @param[in] other The value to divide this matrix's components by.
+	/// @return This matrix, post-operation.
+	const ThisType& operator/=(Component other) noexcept;
+
+	inline const VectorType& operator[](size_t i) const noexcept { return vectors[i]; }
+	inline VectorType& operator[](size_t i) noexcept { return vectors[i]; }
+
+	/// Returns the sum of this matrix and another.
+	/// @param[in] other The matrix to add this to.
+	/// @return The sum of the two matrices.
+	inline const ThisType operator+(const ThisType& other) const noexcept
+	{
+		ThisType result(*this);
+		result += other;
+		return result;
+	}
+	inline const ThisType operator+(const TransposeType& other) const noexcept
+	{
+		ThisType result(*this);
+		result += other;
+		return result;
+	}
+	/// Returns the result of subtracting another matrix from this matrix.
+	/// @param[in] other The matrix to subtract from this matrix.
+	/// @return The result of the subtraction.
+	inline const ThisType operator-(const ThisType& other) const noexcept
+	{
+		ThisType result(*this);
+		result -= other;
+		return result;
+	}
+	inline const ThisType operator-(const TransposeType& other) const noexcept
+	{
+		ThisType result(*this);
+		result -= other;
+		return result;
+	}
+	/// Returns the result of multiplying this matrix by a scalar.
+	/// @param[in] other The scalar value to multiply by.
+	/// @return The result of the scale.
+	inline const ThisType operator*(Component other) const noexcept
+	{
+		ThisType result(*this);
+		result *= other;
+		return result;
+	}
+	/// Returns the result of dividing this matrix by a scalar.
+	/// @param[in] other The scalar value to divide by.
+	/// @return The result of the scale.
+	inline const ThisType operator/(Component other) const noexcept
+	{
+		ThisType result(*this);
+		result *= other;
+		return result;
+	}
+
+	/// Returns the result of multiplying this matrix by a vector.
+	/// @param[in] other The scalar value to multiply by.
+	/// @return The result of the scale.
+	const VectorType operator*(const VectorType& other) const noexcept { return VectorMultiplier<Component, Storage>::Multiply(*this, other); }
+
+	/// Returns the result of multiplying this matrix by another matrix.
+	/// @param[in] other The matrix value to multiply by.
+	/// @return The result of the multiplication.
+	template <class Storage2>
+	const ThisType operator*(const Matrix4<Component, Storage2>& other) const noexcept
+	{
+		return MatrixMultiplier<Component, Storage, Storage2>::Multiply(*this, other);
+	}
+
+	/// Multiplies this matrix by another matrix in place.
+	/// @return The result of the multiplication.
+	inline const ThisType& operator*=(const ThisType& other) noexcept
+	{
+		*this = *this * other;
+		return *this;
+	}
+	inline const ThisType& operator*=(const TransposeType& other) noexcept
+	{
+		*this = *this * other;
+		return *this;
+	}
+
+	/// Equality operator.
+	/// @param[in] other The matrix to compare this against.
+	/// @return True if the two matrices are equal, false otherwise.
+	bool operator==(const ThisType& other) const noexcept;
+	bool operator==(const TransposeType& other) const noexcept;
+	/// Inequality operator.
+	/// @param[in] other The matrix to compare this against.
+	/// @return True if the two matrices are not equal, false otherwise.
+	bool operator!=(const ThisType& other) const noexcept;
+	bool operator!=(const TransposeType& other) const noexcept;
+
+	/// Return the identity matrix.
+	/// @return The identity matrix.
+	inline static const ThisType& Identity() noexcept;
+	/// Return a diagonal matrix.
+	/// @return A diagonal matrix.
+	static ThisType Diag(Component a, Component b, Component c, Component d = 1) noexcept;
+
+	/// Create an orthographic projection matrix
+	/// @param l The horizontal coordinate of the left clipping plane
+	/// @param r The horizontal coordinate of the right clipping plane
+	/// @param b The vertical coordinate of the bottom clipping plane
+	/// @param t The vertical coordinate of the top clipping plane
+	/// @param n The depth coordinate of the near clipping plane
+	/// @param f The depth coordinate of the far clipping plane
+	/// @return The specified orthographic projection matrix.
+	static ThisType ProjectOrtho(Component l, Component r, Component b, Component t, Component n, Component f) noexcept;
+	/// Create a perspective projection matrix
+	/// @param l The horizontal coordinate of the left clipping plane
+	/// @param r The horizontal coordinate of the right clipping plane
+	/// @param b The vertical coordinate of the bottom clipping plane
+	/// @param t The vertical coordinate of the top clipping plane
+	/// @param n The depth coordinate of the near clipping plane
+	/// @param f The depth coordinate of the far clipping plane
+	/// @return The specified perspective projection matrix.
+	static ThisType ProjectPerspective(Component l, Component r, Component b, Component t, Component n, Component f) noexcept;
+	/// Create a perspective projection matrix
+	/// @param d The distance to the z-plane
+	static ThisType Perspective(Component d) noexcept;
+
+	/// Return a translation matrix.
+	/// @return A translation matrix.
+	static ThisType Translate(const Vector3<Component>& v) noexcept;
+	static ThisType Translate(Component x, Component y, Component z) noexcept;
+	static ThisType TranslateX(Component x) noexcept;
+	static ThisType TranslateY(Component y) noexcept;
+	static ThisType TranslateZ(Component z) noexcept;
+
+	/// Return a scaling matrix.
+	/// @return A scaling matrix.
+	static ThisType Scale(Component x, Component y, Component z) noexcept;
+	static ThisType ScaleX(Component x) noexcept;
+	static ThisType ScaleY(Component y) noexcept;
+	static ThisType ScaleZ(Component z) noexcept;
+
+	/// Return a rotation matrix.
+	/// @return A rotation matrix.
+	static ThisType Rotate(const Vector3<Component>& v, Component angle) noexcept;
+	static ThisType RotateX(Component angle) noexcept;
+	static ThisType RotateY(Component angle) noexcept;
+	static ThisType RotateZ(Component angle) noexcept;
+
+	/// Return a skew/shearing matrix.
+	/// @return A skew matrix.
+	static ThisType Skew(Component angle_x, Component angle_y) noexcept;
+	static ThisType SkewX(Component angle) noexcept;
+	static ThisType SkewY(Component angle) noexcept;
+
+	static ThisType Compose(const Vector3<Component>& translation, const Vector3<Component>& scale, const Vector3<Component>& skew,
+		const Vector4<Component>& perspective, const Vector4<Component>& quaternion) noexcept;
 
 #if defined(RMLUI_MATRIX4_USER_EXTRA)
 	RMLUI_MATRIX4_USER_EXTRA

File diff suppressed because it is too large
+ 268 - 435
Include/RmlUi/Core/Matrix4.inl


+ 47 - 50
Include/RmlUi/Core/ObserverPtr.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,9 +29,9 @@
 #ifndef RMLUIOBSERVERPTR_H
 #define RMLUIOBSERVERPTR_H
 
-#include <utility>
-#include <type_traits>
 #include "Header.h"
+#include <type_traits>
+#include <utility>
 
 namespace Rml {
 
@@ -42,44 +42,43 @@ struct RMLUICORE_API ObserverPtrBlock {
 RMLUICORE_API ObserverPtrBlock* AllocateObserverPtrBlock();
 RMLUICORE_API void DeallocateObserverPtrBlockIfEmpty(ObserverPtrBlock* block);
 
-template<typename T>
+template <typename T>
 class EnableObserverPtr;
 
-
 /**
-	Observer pointer.
+    Observer pointer.
 
-	Holds a weak reference to an object owned by someone else. Can tell whether or not the pointed to object has been destroyed.
+    Holds a weak reference to an object owned by someone else. Can tell whether or not the pointed to object has been destroyed.
 
-	Usage: Given a class T, derive from EnableObserverPtr<T>. Then, we can use the observer pointer as follows:
+    Usage: Given a class T, derive from EnableObserverPtr<T>. Then, we can use the observer pointer as follows:
 
-		auto object = MakeUnique<T>();
-		ObserverPtr<T> observer_ptr = object->GetObserverPtr();
-		// ...
-		if(obserer_ptr) { 
-			// Will only enter if object is still alive.
-			observer_ptr->do_a_thing(); 
-		} 
+        auto object = MakeUnique<T>();
+        ObserverPtr<T> observer_ptr = object->GetObserverPtr();
+        // ...
+        if(obserer_ptr) {
+            // Will only enter if object is still alive.
+            observer_ptr->do_a_thing();
+        }
 
-	Note: Not thread safe.
+    Note: Not thread safe.
  */
 
-template<typename T>
+template <typename T>
 class RMLUICORE_API ObserverPtr {
 public:
 	ObserverPtr() noexcept : block(nullptr) {}
 	ObserverPtr(std::nullptr_t) noexcept : block(nullptr) {}
-	~ObserverPtr() noexcept {
-		reset(); 
-	}
+	~ObserverPtr() noexcept { reset(); }
 
 	// Copy
-	ObserverPtr(const ObserverPtr<T>& other) noexcept : block(other.block) {
+	ObserverPtr(const ObserverPtr<T>& other) noexcept : block(other.block)
+	{
 		if (block)
 			block->num_observers += 1;
 	}
-	ObserverPtr<T>& operator=(const ObserverPtr<T>& other) noexcept {
-		if(this == &other)
+	ObserverPtr<T>& operator=(const ObserverPtr<T>& other) noexcept
+	{
+		if (this == &other)
 			return *this;
 		reset();
 		block = other.block;
@@ -90,8 +89,9 @@ public:
 
 	// Move
 	ObserverPtr(ObserverPtr<T>&& other) noexcept : block(std::exchange(other.block, nullptr)) {}
-	ObserverPtr<T>& operator=(ObserverPtr<T>&& other) noexcept {
-		if(this == &other)
+	ObserverPtr<T>& operator=(ObserverPtr<T>&& other) noexcept
+	{
+		if (this == &other)
 			return *this;
 		reset();
 		block = std::exchange(other.block, nullptr);
@@ -106,17 +106,14 @@ public:
 	bool operator==(const ObserverPtr<T>& other) const noexcept { return get() == other.get(); }
 
 	// Retrieve the pointer to the observed object if we have one and it's still alive.
-	T* get() const noexcept {
-		return block ? static_cast<T*>(block->pointed_to_object) : nullptr;
-	}
+	T* get() const noexcept { return block ? static_cast<T*>(block->pointed_to_object) : nullptr; }
 	// Dereference the pointed to object.
-	T* operator->() const noexcept {
-		return static_cast<T*>(block->pointed_to_object);
-	}
+	T* operator->() const noexcept { return static_cast<T*>(block->pointed_to_object); }
 
 	// Reset the pointer so that it does not point to anything.
 	// When the pointed to object and all observer pointers to it have been destroyed, it will deallocate the block.
-	void reset() noexcept {
+	void reset() noexcept
+	{
 		if (block)
 		{
 			block->num_observers -= 1;
@@ -128,7 +125,8 @@ public:
 private:
 	friend class Rml::EnableObserverPtr<T>;
 
-	explicit ObserverPtr(ObserverPtrBlock* block) noexcept : block(block) {
+	explicit ObserverPtr(ObserverPtrBlock* block) noexcept : block(block)
+	{
 		if (block)
 			block->num_observers += 1;
 	}
@@ -136,23 +134,20 @@ private:
 	ObserverPtrBlock* block;
 };
 
-
-
-template<typename T>
+template <typename T>
 class RMLUICORE_API EnableObserverPtr {
 public:
-
-	ObserverPtr<T> GetObserverPtr() {
+	ObserverPtr<T> GetObserverPtr()
+	{
 		InitializeBlock();
 		return ObserverPtr<T>(block);
 	}
 
 protected:
-	EnableObserverPtr() noexcept {
-		static_assert(std::is_base_of<EnableObserverPtr<T>, T>::value, "T must derive from EnableObserverPtr<T>.");
-	}
+	EnableObserverPtr() noexcept { static_assert(std::is_base_of<EnableObserverPtr<T>, T>::value, "T must derive from EnableObserverPtr<T>."); }
 
-	~EnableObserverPtr() noexcept {
+	~EnableObserverPtr() noexcept
+	{
 		if (block)
 		{
 			block->pointed_to_object = nullptr;
@@ -160,24 +155,27 @@ protected:
 		}
 	}
 
-	EnableObserverPtr(const EnableObserverPtr<T>&) noexcept {
+	EnableObserverPtr(const EnableObserverPtr<T>&) noexcept
+	{
 		// Do not copy or modify the block, it should always point to the same object.
 	}
-	EnableObserverPtr<T>& operator=(const EnableObserverPtr<T>&) noexcept { 
+	EnableObserverPtr<T>& operator=(const EnableObserverPtr<T>&) noexcept
+	{
 		// Assignment should not do anything, the block must point to the initially constructed object.
-		return *this; 
+		return *this;
 	}
 
-	EnableObserverPtr(EnableObserverPtr<T>&&) noexcept {
+	EnableObserverPtr(EnableObserverPtr<T>&&) noexcept
+	{
 		// Do not move or modify the block, it should always point to the same object.
 	}
-	EnableObserverPtr<T>& operator=(EnableObserverPtr<T>&&) noexcept {
+	EnableObserverPtr<T>& operator=(EnableObserverPtr<T>&&) noexcept
+	{
 		// Assignment should not do anything, the block must point to the initially constructed object.
 		return *this;
 	}
 
 private:
-
 	inline void InitializeBlock()
 	{
 		if (!block)
@@ -191,6 +189,5 @@ private:
 	ObserverPtrBlock* block = nullptr;
 };
 
-
 } // namespace Rml
 #endif

+ 7 - 70
Include/RmlUi/Core/Platform.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -51,12 +51,11 @@
 #endif
 
 #if defined __LP64__ || defined _M_X64 || defined _WIN64 || defined __MINGW64__ || defined _LP64
-    #define RMLUI_ARCH_64
+	#define RMLUI_ARCH_64
 #else
-    #define RMLUI_ARCH_32
+	#define RMLUI_ARCH_32
 #endif
 
-
 #if defined(RMLUI_PLATFORM_WIN32) && !defined(__MINGW32__)
 	// declaration of 'identifier' hides class member
 	#pragma warning(disable : 4458)
@@ -68,75 +67,13 @@
 	#pragma warning(disable : 4996)
 #endif
 
-// Wraps unused variables in methods or functions to avoid compiler warnings.  This should
-// be wrapped around the name of all parameters that are wrapped with RMLUI_UNUSED_PARAMETER
-// to cover warnings generated by non-llvm/gcc style compilers that can't be covered with
-// RMLUI_UNUSED_PARAMETER
-#if defined __llvm__
-//#  define RMLUI_UNUSED(x) UNUSED_ ## x __unused
-#  define RMLUI_UNUSED(x)
-#elif defined __GNUC__
-//#  define RMLUI_UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
-#  define RMLUI_UNUSED(x)
-#else
-#  define RMLUI_UNUSED(x) (void)(UNUSED_ ## x)
-#endif
-
-// Wraps unused parameter names in method or function declarations.  When used, the first lines
-// of the function should contain a matching RMLUI_UNUSED call with the name of the function
-// as well to cover compilers with no-op RMLUI_UNUSED_PARAMETER macros.
-#if defined __llvm__
-#  define RMLUI_UNUSED_PARAMETER(x) UNUSED_ ## x __attribute__((unused))
-#elif defined __GNUC__
-#  define RMLUI_UNUSED_PARAMETER(x) UNUSED_ ## x __attribute__((__unused__))
-#else
-#  define RMLUI_UNUSED_PARAMETER(x) UNUSED_ ## x
-#endif
-
-// RMLUI_UNUSED_ASSERT_PARAMETERS wraps method parameters which are not used in the method other than
-// by a RMLUI_ASSERT check.  This safely deals with debug versus release mode configurations
-// and will warn if the parameter starts being used when compiled with GCC
-#ifdef RMLUI_DEBUG
-   // In this case, the parameter is used by a RMLUI_ASSERT test, so we just pass through as is
-#  define RMLUI_UNUSED_ASSERT_PARAMETER(x) x
-#  define RMLUI_UNUSED_ASSERT(x)
-#else
-   // If not in DEBUG builds, this parameter is unused, mark it as such
-#  if defined __llvm__
-#    define RMLUI_UNUSED_ASSERT_PARAMETER(x) UNUSED_ ## x __attribute__((unused))
-#    define RMLUI_UNUSED_ASSERT(x)
-#  elif defined __GNUC__
-#    define RMLUI_UNUSED_ASSERT_PARAMETER(x) UNUSED_ ## x __attribute__((__unused__))
-#    define RMLUI_UNUSED_ASSERT(x)
-#  else
-#    define RMLUI_UNUSED_ASSERT_PARAMETER(x) UNUSED_ ## x
-#    define RMLUI_UNUSED_ASSERT(x) (void)(UNUSED_ ## x)
-#  endif
-#endif
-
-// Wraps functions which are not referenced or exported to avoid compiler warnings
-#if defined __llvm__
-#  define RMLUI_UNUSED_FUNCTION(x) __attribute__((unused)) UNUSED_ ## x
-#elif defined __GNUC__
-#  define RMLUI_UNUSED_FUNCTION(x) __attribute__((__unused__)) UNUSED_ ## x
-#else
-#  define RMLUI_UNUSED_FUNCTION(x) UNUSED_ ## x
-#endif
-
-// Squelchs warnings for unused enums in switch statements, this should only be used for special values
-// that are known to NEVER be used.
-#define RMLUI_UNUSED_SWITCH_ENUM(x) \
-  case x: \
-    RMLUI_ERRORMSG("Switch case for unhandled ENUM has been hit!  This shouldn't happen!  ENUM Name: " # x); \
-    break;
-
 // Tell the compiler of printf-like functions, warns on incorrect usage.
 #if defined __MINGW32__
-#  define RMLUI_ATTRIBUTE_FORMAT_PRINTF(i, f) __attribute__((format (__MINGW_PRINTF_FORMAT, i, f)))
+	#define RMLUI_ATTRIBUTE_FORMAT_PRINTF(i, f) __attribute__((format(__MINGW_PRINTF_FORMAT, i, f)))
 #elif defined __GNUC__ || defined __clang__
-#  define RMLUI_ATTRIBUTE_FORMAT_PRINTF(i, f) __attribute__((format (printf, i, f)))
+	#define RMLUI_ATTRIBUTE_FORMAT_PRINTF(i, f) __attribute__((format(printf, i, f)))
 #else
-#  define RMLUI_ATTRIBUTE_FORMAT_PRINTF(i, f)
+	#define RMLUI_ATTRIBUTE_FORMAT_PRINTF(i, f)
 #endif
 
 #endif

+ 13 - 16
Include/RmlUi/Core/Plugin.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -39,30 +39,27 @@ class ElementDocument;
 class Context;
 
 /**
-	Generic Interface for plugins to RmlUi.
+    Generic Interface for plugins to RmlUi.
 
-	@author Lloyd Weehuizen
+    @author Lloyd Weehuizen
  */
 
-class RMLUICORE_API Plugin
-{
+class RMLUICORE_API Plugin {
 public:
 	virtual ~Plugin();
 
-	enum EventClasses
-	{
-		EVT_BASIC		= (1 << 0),		// Initialise, Shutdown, ContextCreate, ContextDestroy
-		EVT_DOCUMENT	= (1 << 1),		// DocumentOpen, DocumentLoad, DocumentUnload
-		EVT_ELEMENT		= (1 << 2),		// ElementCreate, ElementDestroy
+	enum EventClasses {
+		EVT_BASIC = (1 << 0),    // Initialise, Shutdown, ContextCreate, ContextDestroy
+		EVT_DOCUMENT = (1 << 1), // DocumentOpen, DocumentLoad, DocumentUnload
+		EVT_ELEMENT = (1 << 2),  // ElementCreate, ElementDestroy
 
-		EVT_ALL			= EVT_BASIC | EVT_DOCUMENT | EVT_ELEMENT
+		EVT_ALL = EVT_BASIC | EVT_DOCUMENT | EVT_ELEMENT
 	};
-	/// Called when the plugin is registered to determine
-	/// which of the above event types the plugin is interested in
+	/// Called when the plugin is registered to determine which of the above event types the plugin is interested in.
 	virtual int GetEventClasses();
 
-	/// Called when RmlUi is initialised, or immediately when the plugin registers itself if 
-	/// RmlUi has already been initialised.
+	/// Called when RmlUi is initialised, or immediately when the plugin registers itself if RmlUi has already been
+	/// initialised.
 	virtual void OnInitialise();
 	/// Called when RmlUi shuts down.
 	virtual void OnShutdown();

+ 34 - 36
Include/RmlUi/Core/Profiling.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,55 +29,53 @@
 #ifndef RMLUI_CORE_PROFILING_H
 #define RMLUI_CORE_PROFILING_H
 
-
 #ifdef RMLUI_ENABLE_PROFILING
 
-#define TRACY_ENABLE
-#include <Tracy.hpp>
+	#define TRACY_ENABLE
+	#include <Tracy.hpp>
 
-#define RMLUI_ZoneNamed(varname, active)                 ZoneNamed(varname, active)
-#define RMLUI_ZoneNamedN(varname, name, active)          ZoneNamedN(varname, name, active)
-#define RMLUI_ZoneNamedC(varname, color, active)         ZoneNamedC(varname, color, active)
-#define RMLUI_ZoneNamedNC(varname, name, color, active)  ZoneNamedNC(varname, name, color, active)
+	#define RMLUI_ZoneNamed(varname, active) ZoneNamed(varname, active)
+	#define RMLUI_ZoneNamedN(varname, name, active) ZoneNamedN(varname, name, active)
+	#define RMLUI_ZoneNamedC(varname, color, active) ZoneNamedC(varname, color, active)
+	#define RMLUI_ZoneNamedNC(varname, name, color, active) ZoneNamedNC(varname, name, color, active)
 
-#define RMLUI_ZoneScoped                 ZoneScoped
-#define RMLUI_ZoneScopedN(name)          ZoneScopedN(name)
-#define RMLUI_ZoneScopedC(color)         ZoneScopedC(color)
-#define RMLUI_ZoneScopedNC(name, color)  ZoneScopedNC(name, color)
+	#define RMLUI_ZoneScoped ZoneScoped
+	#define RMLUI_ZoneScopedN(name) ZoneScopedN(name)
+	#define RMLUI_ZoneScopedC(color) ZoneScopedC(color)
+	#define RMLUI_ZoneScopedNC(name, color) ZoneScopedNC(name, color)
 
-#define RMLUI_ZoneText(txt, size)        ZoneText(txt, size)
-#define RMLUI_ZoneName(txt, size)        ZoneName(txt, size)
+	#define RMLUI_ZoneText(txt, size) ZoneText(txt, size)
+	#define RMLUI_ZoneName(txt, size) ZoneName(txt, size)
 
-#define RMLUI_TracyPlot(name,val)        TracyPlot(name, val)
+	#define RMLUI_TracyPlot(name, val) TracyPlot(name, val)
 
-#define RMLUI_FrameMark                  FrameMark
-#define RMLUI_FrameMarkNamed(name)       FrameMarkNamed(name)
-#define RMLUI_FrameMarkStart(name)       FrameMarkStart(name)
-#define RMLUI_FrameMarkEnd(name)         FrameMarkEnd(name)
+	#define RMLUI_FrameMark FrameMark
+	#define RMLUI_FrameMarkNamed(name) FrameMarkNamed(name)
+	#define RMLUI_FrameMarkStart(name) FrameMarkStart(name)
+	#define RMLUI_FrameMarkEnd(name) FrameMarkEnd(name)
 
 #else
 
-#define RMLUI_ZoneNamed(varname, active)
-#define RMLUI_ZoneNamedN(varname, name, active)
-#define RMLUI_ZoneNamedC(varname, color, active)
-#define RMLUI_ZoneNamedNC(varname, name, color, active)
+	#define RMLUI_ZoneNamed(varname, active)
+	#define RMLUI_ZoneNamedN(varname, name, active)
+	#define RMLUI_ZoneNamedC(varname, color, active)
+	#define RMLUI_ZoneNamedNC(varname, name, color, active)
 
-#define RMLUI_ZoneScoped
-#define RMLUI_ZoneScopedN(name)
-#define RMLUI_ZoneScopedC(color)
-#define RMLUI_ZoneScopedNC(name, color)
+	#define RMLUI_ZoneScoped
+	#define RMLUI_ZoneScopedN(name)
+	#define RMLUI_ZoneScopedC(color)
+	#define RMLUI_ZoneScopedNC(name, color)
 
-#define RMLUI_ZoneText(txt, size)
-#define RMLUI_ZoneName(txt, size)
+	#define RMLUI_ZoneText(txt, size)
+	#define RMLUI_ZoneName(txt, size)
 
-#define RMLUI_TracyPlot(name,val)
+	#define RMLUI_TracyPlot(name, val)
 
-#define RMLUI_FrameMark
-#define RMLUI_FrameMarkNamed(name)
-#define RMLUI_FrameMarkStart(name)
-#define RMLUI_FrameMarkEnd(name)
+	#define RMLUI_FrameMark
+	#define RMLUI_FrameMarkNamed(name)
+	#define RMLUI_FrameMarkStart(name)
+	#define RMLUI_FrameMarkEnd(name)
 
 #endif
 
-
 #endif

+ 12 - 12
Include/RmlUi/Core/PropertiesIteratorView.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -28,25 +28,25 @@
 #ifndef RMLUI_CORE_PROPERTIESITERATORVIEW_H
 #define RMLUI_CORE_PROPERTIESITERATORVIEW_H
 
-#include "Types.h"
 #include "Property.h"
+#include "Types.h"
 
 namespace Rml {
 
 class PropertiesIterator;
 
 /**
-	Provides an iterator for properties defined in the element's style or definition.
-	Construct it through the desired Element.
-	Warning: Modifying the underlying style invalidates the iterator.
+    Provides an iterator for properties defined in the element's style or definition.
+    Construct it through the desired Element.
+    Warning: Modifying the underlying style invalidates the iterator.
 
-	Usage:
-		for(auto it = element.IterateLocalProperties(); !it.AtEnd(); ++it) { ... }
+    Usage:
+        for(auto it = element.IterateLocalProperties(); !it.AtEnd(); ++it) { ... }
 
-	Note: Not an std-style iterator. Implemented as a wrapper over the internal
-	iterator to avoid exposing internal headers to the user.
+    Note: Not an std-style iterator. Implemented as a wrapper over the internal
+    iterator to avoid exposing internal headers to the user.
 
-	@author Michael R. P. Ragazzon
+    @author Michael R. P. Ragazzon
  */
 
 class RMLUICORE_API PropertiesIteratorView {
@@ -73,4 +73,4 @@ private:
 };
 
 } // namespace Rml
-#endif
+#endif

+ 37 - 39
Include/RmlUi/Core/Property.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,8 +29,8 @@
 #ifndef RMLUI_CORE_PROPERTY_H
 #define RMLUI_CORE_PROPERTY_H
 
-#include "Variant.h"
 #include "Header.h"
+#include "Variant.h"
 #include <type_traits>
 
 namespace Rml {
@@ -38,61 +38,58 @@ namespace Rml {
 class PropertyDefinition;
 
 struct RMLUICORE_API PropertySource {
-	PropertySource(String path, int line_number, String rule_name) 
-		: path(std::move(path)), line_number(line_number), rule_name(std::move(rule_name)) {}
+	PropertySource(String path, int line_number, String rule_name) : path(std::move(path)), line_number(line_number), rule_name(std::move(rule_name))
+	{}
 	String path;
 	int line_number;
 	String rule_name;
 };
 
-
 /**
-	@author Peter Curry
+    @author Peter Curry
  */
 
-class RMLUICORE_API Property
-{
+class RMLUICORE_API Property {
 public:
-	enum Unit
-	{
+	enum Unit {
 		UNKNOWN = 1 << 0,
 
-		KEYWORD = 1 << 1,           // generic keyword; fetch as < int >
+		KEYWORD = 1 << 1, // generic keyword; fetch as < int >
 
-		STRING = 1 << 2,            // generic string; fetch as < String >
+		STRING = 1 << 2,  // generic string; fetch as < String >
 
 		// Absolute values.
-		NUMBER = 1 << 3,            // number unsuffixed; fetch as < float >
-		PX = 1 << 4,                // number suffixed by 'px'; fetch as < float >
-		DEG = 1 << 5,               // number suffixed by 'deg'; fetch as < float >
-		RAD = 1 << 6,               // number suffixed by 'rad'; fetch as < float >
-		COLOUR = 1 << 7,            // colour; fetch as < Colourb >
-		DP = 1 << 8,                // density-independent pixel; number suffixed by 'dp'; fetch as < float >
-		X = 1 << 9,                 // dots per px unit; number suffixed by 'x'; fetch as < float >
-		VW = 1 << 10,               // viewport-width percentage; number suffixed by 'vw'; fetch as < float >
-		VH = 1 << 11,               // viewport-height percentage; number suffixed by 'vh'; fetch as < float >
+		NUMBER = 1 << 3, // number unsuffixed; fetch as < float >
+		PX = 1 << 4,     // number suffixed by 'px'; fetch as < float >
+		DEG = 1 << 5,    // number suffixed by 'deg'; fetch as < float >
+		RAD = 1 << 6,    // number suffixed by 'rad'; fetch as < float >
+		COLOUR = 1 << 7, // colour; fetch as < Colourb >
+		DP = 1 << 8,     // density-independent pixel; number suffixed by 'dp'; fetch as < float >
+		X = 1 << 9,      // dots per px unit; number suffixed by 'x'; fetch as < float >
+		VW = 1 << 10,    // viewport-width percentage; number suffixed by 'vw'; fetch as < float >
+		VH = 1 << 11,    // viewport-height percentage; number suffixed by 'vh'; fetch as < float >
 		ABSOLUTE_UNIT = NUMBER | PX | DP | X | DEG | RAD | COLOUR | VW | VH,
 
 		// Relative values.
-		EM = 1 << 12,               // number suffixed by 'em'; fetch as < float >
-		PERCENT = 1 << 13,          // number suffixed by '%'; fetch as < float >
-		REM = 1 << 14,              // number suffixed by 'rem'; fetch as < float >
+		EM = 1 << 12,      // number suffixed by 'em'; fetch as < float >
+		PERCENT = 1 << 13, // number suffixed by '%'; fetch as < float >
+		REM = 1 << 14,     // number suffixed by 'rem'; fetch as < float >
 		RELATIVE_UNIT = EM | REM | PERCENT,
 
 		// Values based on pixels-per-inch.
-		INCH = 1 << 15,             // number suffixed by 'in'; fetch as < float >
-		CM = 1 << 16,               // number suffixed by 'cm'; fetch as < float >
-		MM = 1 << 17,               // number suffixed by 'mm'; fetch as < float >
-		PT = 1 << 18,               // number suffixed by 'pt'; fetch as < float >
-		PC = 1 << 19,               // number suffixed by 'pc'; fetch as < float >
+		INCH = 1 << 15, // number suffixed by 'in'; fetch as < float >
+		CM = 1 << 16,   // number suffixed by 'cm'; fetch as < float >
+		MM = 1 << 17,   // number suffixed by 'mm'; fetch as < float >
+		PT = 1 << 18,   // number suffixed by 'pt'; fetch as < float >
+		PC = 1 << 19,   // number suffixed by 'pc'; fetch as < float >
 		PPI_UNIT = INCH | CM | MM | PT | PC,
 
-		TRANSFORM = 1 << 20,        // transform; fetch as < TransformPtr >, may be empty
-		TRANSITION = 1 << 21,       // transition; fetch as < TransitionList >
-		ANIMATION = 1 << 22,        // animation; fetch as < AnimationList >
-		DECORATOR = 1 << 23,        // decorator; fetch as < DecoratorsPtr >
-		FONTEFFECT = 1 << 24,       // font-effect; fetch as < FontEffectsPtr >
-		RATIO = 1 << 25,            // ratio defined as x/y; fetch as < Vector2f >
+		TRANSFORM = 1 << 20,  // transform; fetch as < TransformPtr >, may be empty
+		TRANSITION = 1 << 21, // transition; fetch as < TransitionList >
+		ANIMATION = 1 << 22,  // animation; fetch as < AnimationList >
+		DECORATOR = 1 << 23,  // decorator; fetch as < DecoratorsPtr >
+		FONTEFFECT = 1 << 24, // font-effect; fetch as < FontEffectsPtr >
+		RATIO = 1 << 25,      // ratio defined as x/y; fetch as < Vector2f >
 
 		LENGTH = PX | DP | PPI_UNIT | EM | REM | VW | VH | X,
 		LENGTH_PERCENT = LENGTH | PERCENT,
@@ -102,14 +99,15 @@ public:
 	};
 
 	Property();
-	template < typename PropertyType >
+	template <typename PropertyType>
 	Property(PropertyType value, Unit unit, int specificity = -1) : value(value), unit(unit), specificity(specificity)
 	{
 		definition = nullptr;
 		parser_index = -1;
 	}
-	template<typename EnumType, typename = typename std::enable_if< std::is_enum<EnumType>::value, EnumType >::type>
-	Property(EnumType value) : value(static_cast<int>(value)), unit(KEYWORD), specificity(-1) {}
+	template <typename EnumType, typename = typename std::enable_if<std::is_enum<EnumType>::value, EnumType>::type>
+	Property(EnumType value) : value(static_cast<int>(value)), unit(KEYWORD), specificity(-1)
+	{}
 
 	/// Get the value of the property as a string.
 	String ToString() const;

+ 6 - 8
Include/RmlUi/Core/PropertyDefinition.h

@@ -4,7 +4,7 @@
  * For the latest information, see http://github.com/mikke89/RmlUi
  *
  * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
+ * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -15,7 +15,7 @@
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -36,13 +36,12 @@
 namespace Rml {
 
 /**
-	@author Peter Curry
+    @author Peter Curry
  */
 
 enum class RelativeTarget { None, ContainingBlockWidth, ContainingBlockHeight, FontSize, ParentFontSize, LineHeight };
 
-class RMLUICORE_API PropertyDefinition final : public NonCopyMoveable
-{
+class RMLUICORE_API PropertyDefinition final : public NonCopyMoveable {
 public:
 	PropertyDefinition(PropertyId id, const String& default_value, bool inherited, bool forces_layout);
 	~PropertyDefinition();
@@ -89,13 +88,12 @@ private:
 	bool inherited;
 	bool forces_layout;
 
-	struct ParserState
-	{
+	struct ParserState {
 		PropertyParser* parser;
 		ParameterMap parameters;
 	};
 
-	Vector< ParserState > parsers;
+	Vector<ParserState> parsers;
 
 	RelativeTarget relative_target;
 };

Some files were not shown because too many files changed in this diff